/**
 * Verpackungsrechner für Aluminiumprofile
 * Stylesheet Version 1.6.2
 * 
 * @author aluscreen GmbH Development Team
 * @license MIT
 * 
 * Struktur:
 * 1. Reset & Base Styles
 * 2. Layout & Container
 * 3. Header
 * 4. Forms & Inputs
 * 5. Buttons
 * 6. Packaging Options
 * 7. Results & Info Cards
 * 8. Visualization
 * 9. Import/Export Section
 * 10. Utilities & Helpers
 * 11. Animations
 * 12. Responsive Design
 * 13. Print Styles
 */

/* ========================================
   1. RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* ========================================
   2. LAYOUT & CONTAINER
   ======================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

.section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.section h2 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
    font-size: 1.5em;
}

.section h3 {
    color: #764ba2;
    margin-top: 20px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 1.2em;
}

.full-width {
    grid-column: 1 / -1;
}

/* ========================================
   3. HEADER
   ======================================== */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.header h1 {
    font-size: 1.7em;
    margin-bottom: 10px;
    margin-top: 25px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2em;
    opacity: 0.95;
}

.version-info {
    position: absolute;
    top: 20px;
    left: 30px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    font-weight: 600;
}

/* Language Switcher */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 30px;
    display: flex;
    gap: 10px;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

/* Unit System Switcher */
.unit-switcher {
    position: absolute;
    top: 8px;
    left: 120px;
    display: flex;
    gap: 10px;
}

.unit-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.unit-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.unit-btn.active {
    background: white;
    color: #667eea;
    border-color: white;
}

/* ========================================
   4. FORMS & INPUTS
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 0.95em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: #fafafa;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:invalid {
    border-color: #ff6b6b;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

.input-addon {
    background: #f0f0f0;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    color: #667eea;
    min-width: 60px;
    text-align: center;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 250px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9em;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ========================================
   5. BUTTONS
   ======================================== */
.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    margin-left: 10px;
}

.btn-pdf {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    margin-top: 20px;
    width: 100%;
}

.btn-export {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    margin-top: 10px;
    margin-right: 10px;
}

.btn-import {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6a88 100%);
    margin-top: 10px;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

/* ========================================
   6. PACKAGING OPTIONS
   ======================================== */
.packaging-options {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border: 1px solid #e0e0e0;
}

.packaging-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.option-group {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.option-group h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.radio-option {
    margin-bottom: 8px;
}

.radio-option input[type="radio"] {
    margin-right: 8px;
    width: auto;
    padding: 0;
    cursor: pointer;
}

.radio-option label {
    margin-bottom: 0;
    font-weight: normal;
    cursor: pointer;
    font-size: 13px;
    display: inline;
}

.radio-option input[type="radio"]:disabled + label {
    color: #ccc;
    cursor: not-allowed;
}

/* Packaging Code Display */
.verpackungscode-display {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
}

.verpackungscode-label {
    font-size: 14px;
    color: #1976d2;
    font-weight: 600;
    margin-bottom: 5px;
}

.verpackungscode-value {
    font-size: 24px;
    font-weight: 700;
    color: #0d47a1;
    font-family: 'Courier New', monospace;
}

/* ========================================
   7. RESULTS & INFO CARDS
   ======================================== */
.results {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.result-item {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    animation: slideIn 0.5s ease-out;
}

.result-item strong {
    color: #667eea;
    font-size: 1.1em;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.info-card h3 {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
    font-weight: 500;
    color: white;
    border: none;
}

.info-card .value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.info-card .unit {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Calculation Details */
.calculation-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    font-size: 0.95em;
}

.calculation-details h4 {
    color: #667eea;
    margin-bottom: 10px;
}

.calculation-details ul {
    list-style: none;
    padding-left: 0;
}

.calculation-details li {
    padding: 5px 0;
    border-bottom: 1px solid #e0e0e0;
}

.calculation-details li:last-child {
    border-bottom: none;
}

/* Calculated Values */
.calculated-value {
    background: #e8f4f8;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
    border: 1px solid #b8e0f0;
    color: #0066cc;
    font-weight: 600;
}

.calculated-dimensions {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid #28a745;
}

.calculated-dimensions h4 {
    color: #155724;
    margin-bottom: 10px;
    font-weight: 600;
}

.calculated-dimensions .dimension-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.calculated-dimensions .dimension-item:last-child {
    border-bottom: none;
}

.calculated-dimensions .dimension-value {
    font-weight: 600;
    color: #28a745;
}

/* Alerts */
.warning {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid #f5576c;
}

.success {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 4px solid #28a745;
}

.highlight {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* ========================================
   8. VISUALIZATION
   ======================================== */
.visualization-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.visualization-section h3 {
    color: #667eea;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

#visualizationCanvas {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    height: auto;
    background: white;
    display: block;
    margin: 0 auto;
}

.visualization-info {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9em;
}

.visualization-info span {
    color: #667eea;
    font-weight: 600;
}

/* Profile Image Upload */
.file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.file-upload-label {
    display: block;
    padding: 12px;
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(132, 250, 176, 0.3);
}

.profile-preview {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.profile-preview img {
    max-width: 150px;
    max-height: 150px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    padding: 5px;
}

/* ========================================
   9. IMPORT/EXPORT SECTION
   ======================================== */
.export-import-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #e0e0e0;
}

.export-import-section h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.format-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.format-btn {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.format-btn:hover {
    background: #e0e0e0;
}

.format-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.import-drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f9f9f9;
    margin-top: 10px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.import-drop-zone:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.import-drop-zone.dragover {
    border-color: #667eea;
    background: #e8f0ff;
}

/* ========================================
   10. UTILITIES & HELPERS
   ======================================== */
.footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9em;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Hidden Elements */
[style*="display: none"] {
    display: none !important;
}

/* ========================================
   11. ANIMATIONS
   ======================================== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* Apply animations */
.section {
    animation: fadeIn 0.5s ease-out;
}

.btn:hover {
    animation: pulse 0.3s ease-in-out;
}

/* ========================================
   12. RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
    }
}

@media (max-width: 968px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }

    .language-switcher {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 20px;
    }

    .version-info {
        position: relative;
        top: auto;
        left: auto;
        text-align: center;
        margin-bottom: 10px;
    }

    .btn-row {
        flex-direction: column;
    }

    .btn-row .btn {
        width: 100%;
        margin: 5px 0;
    }

    .format-selector {
        flex-direction: column;
    }

    .format-btn {
        width: 100%;
    }

    .packaging-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header p {
        font-size: 1em;
    }
}

@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 10px;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .main-content {
        padding: 15px;
        gap: 15px;
    }

    .section {
        padding: 15px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .tooltip .tooltiptext {
        width: 200px;
        margin-left: -100px;
    }
}

/* ========================================
   13. PRINT STYLES
   ======================================== */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
    }

    .header {
        background: none;
        color: black;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .btn, 
    .language-switcher, 
    .version-info,
    .export-import-section,
    .file-upload {
        display: none !important;
    }

    .section {
        box-shadow: none;
        page-break-inside: avoid;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    @page {
        margin: 2cm;
    }
}