/* ═══════════════ CSS VARIABLES ═══════════════ */
:root {
    --pvc: #F5F0E8;
    --steel: #7C8895;
    --glass: #88CCBB;
    --bg: #0a0e15;
    --bg2: #121828;
    --text: #e8e8ed;
    --text2: #9ca3af;
    --accent: #ef7c1a;
    --accent-dark: #003168;
    --d1: #3B82F6;
    --d2: #10B981;
    --d3: #F97316;
    --d4: #EAB308;
    --d5: #EF4444;
    --glass-bg: rgba(10, 14, 30, 0.80);
    --glass-border: rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
}

/* ═══════════════ RESET ═══════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; touch-action: manipulation; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

/* ═══════════════ LAYOUT ═══════════════ */
#app {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr 360px;
    height: 100vh;
    gap: 0;
}

/* ═══════════════ HEADER ═══════════════ */
#header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--bg2) 0%, #12141e 100%);
    border-bottom: 1px solid var(--glass-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}
#header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
#header h1 span { color: var(--accent); }
#header .subtitle {
    font-size: 12px;
    color: var(--text2);
    margin-left: 16px;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-return {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(239, 124, 26, 0.15);
    color: var(--accent);
    border: 1px solid rgba(239, 124, 26, 0.3);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-return:hover {
    background: rgba(239, 124, 26, 0.25);
    border-color: var(--accent);
}
.btn-return svg { flex-shrink: 0; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(239, 124, 26, 0.15);
    color: var(--accent);
    border: 1px solid rgba(239, 124, 26, 0.3);
}

/* ═══════════════ CANVAS 3D ═══════════════ */
#canvas-container {
    position: relative;
    overflow: hidden;
    background: radial-gradient(ellipse at center, #1e2130 0%, var(--bg) 70%);
}
#canvas3d {
    width: 100%;
    height: 100%;
    display: block;
}

/* ═══════════════ TOOLTIP ═══════════════ */
#tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 20;
}
#tooltip.visible { opacity: 1; }

/* ═══════════════ CAMERA PRESETS ═══════════════ */
.camera-presets {
    position: absolute;
    top: 52px; /* sous le bouton d'aide (32px + 12px + marge) — avant: chevauchement */
    left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 5;
}
.cam-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cam-btn:hover { background: rgba(239, 124, 26, 0.2); color: var(--text); border-color: var(--accent); }

.view-toggle {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    padding: 6px 12px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.view-toggle:hover { background: rgba(239, 124, 26, 0.2); color: var(--text); border-color: var(--accent); }
.view-toggle.tehnic { background: rgba(239, 124, 26, 0.4); color: #fff; border-color: var(--accent); }
.view-toggle.explozie { background: rgba(239, 68, 68, 0.4); color: #fff; border-color: var(--d5); }

/* ═══════════════ STEP COUNTER ═══════════════ */
.step-counter {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px 16px;
    text-align: center;
    z-index: 5;
}
.step-counter .num { font-size: 28px; font-weight: 700; color: var(--accent); }
.step-counter .label { font-size: 11px; color: var(--text2); }

/* ═══════════════ INFO PANEL (right) ═══════════════ */
#panel {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.panel-section {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px;
}
.panel-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text2);
    margin-bottom: 10px;
}
.component-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1.2;
}
.component-name-en {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 12px;
}
.dim-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}
.component-desc {
    font-size: 13px;
    color: var(--text2);
    line-height: 1.6;
}
/* Opening info panel */
.opening-info-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    font-size: 13px;
}
.opening-info-grid .oi-label {
    color: var(--text2);
}
.opening-info-grid .oi-value {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.opening-info-grid .oi-value.oi-accent {
    color: var(--accent);
}
.opening-info-grid .oi-sep {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--glass-border);
    margin: 4px 0;
}
.winarhi-code {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 124, 26, 0.08);
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--accent);
}

/* ═══════════════ STATS PANEL ═══════════════ */
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.stat-row:last-child { border-bottom: none; }
.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    display: inline-block;
}
.stat-label { font-size: 12px; color: var(--text2); }
.stat-value { font-size: 13px; font-weight: 600; }
.stat-bar {
    flex: 1;
    height: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    margin: 0 12px;
    overflow: hidden;
}
.stat-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }

/* ═══════════════ TOGGLE BUTTONS ═══════════════ */
.toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.toggle-btn {
    flex: 0 1 auto;
    min-width: 56px;
    padding: 5px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}
.toggle-btn:hover { background: rgba(239, 124, 26, 0.15); color: var(--text); }
.toggle-btn.active {
    background: rgba(239, 124, 26, 0.2);
    border-color: var(--accent);
    color: var(--accent);
}

/* ═══════════════ QUIZ ═══════════════ */
#quiz {
    display: none;
    text-align: center;
    padding: 20px;
}
#quiz.visible { display: block; }
#quiz .question { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.quiz-options { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.quiz-opt {
    padding: 8px 20px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.quiz-opt:hover { border-color: var(--accent); background: rgba(239, 124, 26, 0.15); }
.quiz-opt.correct { background: rgba(16, 185, 129, 0.3); border-color: #10B981; }
.quiz-opt.wrong { background: rgba(239, 68, 68, 0.2); border-color: #EF4444; }
#quiz .explanation {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text2);
    display: none;
}

/* ═══════════════ STEPPER (bottom) ═══════════════ */
#stepper {
    grid-column: 1 / -1;
    background: linear-gradient(0deg, var(--bg2) 0%, rgba(26,29,39,0.95) 100%);
    border-top: 1px solid var(--glass-border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}
.stepper-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}
.step-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}
.step-btn:hover { background: rgba(239, 124, 26, 0.2); border-color: var(--accent); }
.step-btn.primary {
    width: 42px;
    height: 42px;
    background: var(--accent);
    border-color: var(--accent);
    font-size: 18px;
}
.step-btn.primary:hover { background: #5558e6; }
.progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #818cf8);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}
.progress-label {
    font-size: 11px;
    color: var(--text2);
    display: flex;
    justify-content: space-between;
}
.stepper-right {
    display: flex;
    gap: 6px;
}

/* ═══════════════ LOADING ═══════════════ */
#loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 100;
    transition: opacity 0.5s;
}
#loading.hidden { opacity: 0; pointer-events: none; }
.loader {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════ RESPONSIVE ═══════════════ */

/* Tablet landscape & small desktops */
@media (max-width: 1024px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto auto;
    }
    #panel {
        border-left: none;
        border-top: 1px solid var(--glass-border);
        max-height: 240px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .camera-presets {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: calc(100% - 84px); /* ne passe pas sous le compteur d'étapes */
        top: 48px;
        left: 8px;
    }
    .step-counter {
        top: 8px;
        right: 8px;
        padding: 6px 12px;
    }
    .step-counter .num { font-size: 22px; }
}

/* Tablet portrait */
@media (max-width: 768px) {
    #header h1 { font-size: 15px; }
    #header .subtitle { font-size: 11px; display: none; }
    .toggle-btn {
        min-width: 48px;
        min-height: 36px;
        font-size: 11px;
        padding: 6px 10px;
    }
    .cam-btn {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 11px;
    }
    .step-btn {
        width: 40px;
        height: 40px;
    }
    .step-btn.primary {
        width: 46px;
        height: 46px;
    }
    #panel { max-height: 220px; padding: 14px; gap: 12px; }
    .panel-section { padding: 12px; }
    .component-name { font-size: 17px; }
    .section-card { max-width: 180px; }
    .section-card .section-img { max-height: 80px; object-fit: contain; }
}

/* Mobile */
@media (max-width: 640px) {
    #app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    #header { padding: 8px 12px; }
    #header h1 { font-size: 13px; }
    #header .subtitle { display: none; }
    .badge { font-size: 10px; padding: 3px 8px; }

    #stepper { padding: 8px 10px; gap: 8px; }
    .step-btn { width: 36px; height: 36px; font-size: 14px; }
    .step-btn.primary { width: 40px; height: 40px; font-size: 16px; }
    .progress-label { font-size: 10px; }

    /* Panel = bottom sheet */
    #panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 60vh;
        z-index: 15;
        border-left: none;
        border-top: none;
        border-radius: var(--radius) var(--radius) 0 0;
        transform: translateY(calc(100% - 48px));
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 0 14px 14px;
        gap: 10px;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
        will-change: transform;
    }
    #panel.expanded { transform: translateY(0); }
    #panel.dragging { transition: none; }

    .panel-drag {
        display: flex !important;
        justify-content: center;
        padding: 10px 8px 6px;
        cursor: grab;
        position: sticky;
        top: 0;
        background: var(--glass-bg);
        z-index: 1;
    }
    .panel-drag-bar {
        width: 40px;
        height: 4px;
        background: rgba(255,255,255,0.25);
        border-radius: 2px;
    }

    .panel-section { padding: 10px; }
    .panel-section h3 { font-size: 10px; margin-bottom: 6px; }
    .component-name { font-size: 16px; }
    .component-name-en { font-size: 12px; }
    .component-desc { font-size: 12px; }
    .dim-badge { font-size: 11px; padding: 4px 10px; }
    .winarhi-code { font-size: 11px; padding: 6px 10px; }

    /* Touch-friendly toggles */
    .toggles { gap: 5px; }
    .toggle-btn {
        min-width: 50px;
        min-height: 38px;
        font-size: 10px;
        padding: 6px 8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Camera presets */
    .camera-presets {
        flex-direction: row;
        flex-wrap: wrap;
        max-width: calc(100% - 84px);
        top: 48px;
        left: 8px;
        gap: 4px;
    }
    .cam-btn {
        padding: 5px 8px;
        font-size: 10px;
        min-height: 30px;
    }

    /* Step counter */
    .step-counter {
        top: 8px;
        right: 8px;
        padding: 6px 10px;
    }
    .step-counter .num { font-size: 20px; }
    .step-counter .label { font-size: 10px; }

    /* Section overlay */
    #sectionOverlay {
        bottom: 56px;
        left: 8px;
    }
    .section-card { max-width: 160px; padding: 8px; }
    .section-card .section-img { max-height: 60px; object-fit: contain; }
    .section-label { font-size: 11px; }
    .section-details { font-size: 10px; }

    /* Stats compact */
    .stat-label { font-size: 11px; }
    .stat-value { font-size: 12px; }
}

/* Very small phones */
@media (max-width: 380px) {
    #header h1 { font-size: 12px; }
    .badge { display: none; }
    .cam-btn { padding: 4px 6px; font-size: 9px; }
    .toggle-btn { min-width: 44px; font-size: 9px; }
    .step-counter { display: none; }
    #panel { max-height: 55vh; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #app {
        grid-template-columns: 1fr 280px;
        grid-template-rows: auto 1fr auto;
    }
    #header { padding: 4px 12px; }
    #header h1 { font-size: 13px; }
    #stepper { padding: 4px 10px; }
    .step-btn { width: 30px; height: 30px; font-size: 12px; }
    .step-btn.primary { width: 34px; height: 34px; }
    #panel {
        position: static;
        transform: none;
        max-height: none;
        border-left: 1px solid var(--glass-border);
        border-top: none;
        border-radius: 0;
        box-shadow: none;
        padding: 10px;
        gap: 8px;
    }
    .panel-drag { display: none !important; }
    .panel-section { padding: 8px; }
    .component-name { font-size: 15px; }
    .component-desc { font-size: 11px; }
    .toggle-btn { min-height: 30px; font-size: 9px; padding: 4px 6px; min-width: 42px; }
}

/* ═══════════════ SECTION OVERLAY ═══════════════ */
#sectionOverlay {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 6;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.section-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 12px;
    max-width: 220px;
}
.section-img {
    width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #fff;
}
.section-label {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}
.section-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: var(--text2);
}

/* ═══════════════ SCROLLBAR ═══════════════ */
#panel::-webkit-scrollbar { width: 4px; }
#panel::-webkit-scrollbar-track { background: transparent; }
#panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ═══════════════ GLASS DETAIL PANEL ═══════════════ */
#glassDetailPanel {
    display: none;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 8px;
}
#glassDetailPanel.visible { display: block; }
#glassDetailPanel h4 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #10B981;
    margin: 0 0 10px 0;
}
.glass-selector {
    width: 100%;
    padding: 6px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
    margin-bottom: 12px;
    cursor: pointer;
}
.glass-selector option { background: var(--bg2); color: var(--text); }
.glass-svg-container {
    background: rgba(0,0,0,0.15);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
    overflow-x: auto;
    text-align: center;
}
.glass-svg-container svg { display: inline-block; }
.glass-properties { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.glass-prop-tag {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(16, 185, 129, 0.12);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.glass-prop-tag.warn { background: rgba(234,179,8,0.12); color: #EAB308; border-color: rgba(234,179,8,0.25); }
@media (max-width: 640px) {
    #glassDetailPanel { padding: 10px; }
    .glass-svg-container { padding: 8px; }
    .glass-svg-container svg { max-width: 100%; height: auto; }
}

/* ═══════════════ MINI-CONFIGURATOR TOOLBAR ═══════════════ */
.config-toolbar {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 6;
    display: flex;
    gap: 6px;
    align-items: center;
}
.config-select {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 11px;
    font-family: inherit;
    padding: 6px 10px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    min-width: 80px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239ca3af'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 22px;
    transition: all 0.2s;
}
.config-select:hover { border-color: var(--accent); }
.config-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(239,124,26,0.2); }
.config-select option { background: #1a1d27; color: var(--text); }

/* Color swatch preview in toolbar */
.color-preview {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.color-preview:hover { border-color: var(--accent); }
.color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.15);
}
.color-label { font-size: 11px; color: var(--text2); }

/* Color picker dropdown */
.color-picker-popup {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 6px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px;
    z-index: 10;
    min-width: 240px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: visible;
}
.color-picker-popup.visible { display: block; }
.color-picker-popup h4 { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text2); margin-bottom: 8px; }
.color-category-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text2);
    margin: 6px 0 3px;
    padding-top: 4px;
    border-top: 1px solid var(--glass-border);
}
.color-category-label:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.color-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}
.color-option {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}
.color-option:hover { border-color: var(--accent); transform: scale(1.1); }
.color-option.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(239,124,26,0.3); }
.color-option .color-tip {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #fff;
    background: rgba(0,0,0,0.8);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    z-index: 20;
}
.color-option:hover .color-tip { opacity: 1; }

/* Config link button */
.config-link {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-size: 11px;
    font-family: inherit;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.config-link:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 768px) {
    .config-toolbar { bottom: 8px; right: 8px; gap: 4px; }
    .config-select { font-size: 10px; padding: 5px 8px; min-width: 70px; }
    .color-option { width: 30px; height: 30px; }
}
@media (max-width: 640px) {
    .config-toolbar { bottom: 56px; right: 8px; flex-wrap: wrap; justify-content: flex-end; }
    .config-select { font-size: 10px; padding: 4px 6px; min-width: 60px; }
    .config-link { display: none; }
}

/* ═══════════════ HELP LINK ═══════════════ */
.help-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text2);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}
.help-btn:hover { background: rgba(239,124,26,0.2); color: var(--accent); border-color: var(--accent); }

/* ═══════════════ LANGUAGE SELECTOR ═══════════════ */
.lang-selector {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    padding: 2px;
}
.lang-btn {
    padding: 3px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--text2);
    font-size: 10px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
    background: rgba(239, 124, 26, 0.25);
    color: var(--accent);
}
@media (max-width: 640px) {
    .lang-selector { gap: 1px; padding: 1px; }
    .lang-btn { padding: 2px 6px; font-size: 9px; }
}

/* ═══════════════ PRINT: FIȘĂ TEHNICĂ ═══════════════ */
#printSpec { display: none; }
@media print {
    body, html { overflow: visible !important; height: auto !important; }
    #app, #header, #canvas-container, #panel, #stepper, .config-toolbar, .help-btn,
    .cam-presets, .step-counter, #sectionOverlay, #loading { display: none !important; }
    #printSpec {
        display: block !important;
        font-family: 'Inter', system-ui, sans-serif;
        color: #1a1a2e;
        padding: 20px;
        max-width: 700px;
        margin: 0 auto;
    }
    #printSpec h1 { font-size: 20px; margin-bottom: 4px; }
    #printSpec .spec-subtitle { font-size: 12px; color: #666; margin-bottom: 16px; }
    #printSpec table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
    #printSpec th, #printSpec td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #ddd; font-size: 12px; }
    #printSpec th { background: #f5f5f5; font-weight: 600; width: 35%; }
    #printSpec .spec-section { font-size: 14px; font-weight: 600; margin: 16px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #3B82F6; }
    #printSpec .spec-footer { font-size: 10px; color: #999; margin-top: 24px; text-align: center; }
}
