/* WORKLAB — configurateur d'etabli. Interface sombre industrielle. */

:root {
    --bg: #0d1214;
    --bg-2: #141b1f;
    --card: #1b2327;
    --card-2: #212b30;
    --border: #293238;
    --text: #f4f6f6;
    --muted: #8e999f;
    --accent: #50ed69;
    --accent-dark: #2fa843;
    --radius: 3px;
    --header-h: 62px;
    --status-h: 38px;
}

* { box-sizing: border-box; }

/* Les regles display: flex ci-dessous prendraient le pas sur [hidden]. */
[hidden] { display: none !important; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: Inter, "Segoe UI", system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    overflow: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- */
/* Header                                                            */
/* ---------------------------------------------------------------- */

.header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 0 20px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
    width: 30px; height: 22px;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.4;
    stroke-linecap: square;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: 0.06em; }
.brand-sub {
    font-size: 8px; font-weight: 600; color: var(--muted);
    letter-spacing: 0.34em; text-transform: uppercase;
}

.tagline {
    padding-left: 20px;
    border-left: 1px solid var(--border);
    font-size: 9.5px; font-weight: 600; line-height: 1.35;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--muted);
}

.project {
    padding-left: 20px;
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 1px;
}

.project-label {
    font-size: 8.5px; font-weight: 600; color: var(--muted);
    letter-spacing: 0.24em; text-transform: uppercase;
}

.project-input {
    width: 150px;
    padding: 1px 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 12px; font-weight: 600;
}
.project-input:hover { border-color: var(--border); }
.project-input:focus { outline: none; border-color: var(--accent); background: var(--bg); }

.header-nav { display: flex; align-items: center; gap: 6px; }

.link {
    padding: 7px 11px;
    color: var(--muted);
    font-size: 12px; font-weight: 500;
    border-radius: var(--radius);
    transition: color .15s, background .15s;
}
.link:hover { color: var(--text); background: var(--card); }

.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius);
    font-size: 12.5px; font-weight: 600;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #07140b; }
.btn-primary:hover { background: #6cf383; }
.btn-ghost { border: 1px solid var(--border); color: var(--text); background: var(--card); }
.btn-ghost:hover { border-color: #3c474e; }
.btn-block { width: 100%; justify-content: center; }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.8; }

.dropdown { position: relative; }

.dropdown-menu {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
    min-width: 190px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .55);
    padding: 4px;
}
.dropdown-menu button {
    display: block; width: 100%;
    padding: 8px 10px;
    text-align: left; font-size: 12px; color: var(--muted);
    border-radius: var(--radius);
}
.dropdown-menu button:hover { background: var(--card-2); color: var(--text); }

/* ---------------------------------------------------------------- */
/* Layout                                                            */
/* ---------------------------------------------------------------- */

.layout {
    display: grid;
    grid-template-columns: 92px 372px 1fr;
    height: calc(100% - var(--header-h) - var(--status-h));
}

/* Etapes ------------------------------------------------------- */

.steps {
    display: flex; flex-direction: column;
    padding: 14px 0;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
}

.step {
    position: relative;
    display: flex; flex-direction: column; gap: 2px;
    padding: 12px 10px 12px 14px;
    text-align: left;
    color: var(--muted);
    transition: background .15s, color .15s;
}
.step::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0;
    width: 3px; background: transparent;
}
.step:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.step-num { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.step-name { font-size: 10px; font-weight: 500; letter-spacing: .03em; }

.step.is-active { color: var(--text); background: var(--card); }
.step.is-active::before { background: var(--accent); }
.step.is-active .step-num { color: var(--accent); }

.step-check {
    position: absolute; right: 10px; top: 13px;
    width: 11px; height: 11px;
    stroke: var(--accent); stroke-width: 2.6; fill: none;
    opacity: 0;
}
.step.is-done .step-check { opacity: 1; }

.steps-footer {
    margin-top: auto;
    padding: 0 14px;
    font-size: 9px; font-weight: 600; line-height: 1.4;
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--muted);
}
.steps-footer::before {
    content: ""; display: block;
    width: 22px; height: 2px; margin-bottom: 8px;
    background: var(--accent);
}

/* Panneau de configuration ------------------------------------- */

.panel {
    display: flex; flex-direction: column;
    padding: 22px 22px 18px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.panel-head { margin-bottom: 18px; }
.panel-head h2 {
    display: flex; align-items: baseline; justify-content: space-between;
    font-size: 21px; letter-spacing: .02em;
}
.panel-head .unit { font-size: 11px; font-weight: 500; color: var(--muted); }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.panel-body { flex: 1; }

.panel-foot {
    display: flex; flex-direction: column; gap: 8px;
    padding-top: 18px;
}

/* Prix permanent, au-dessus du CTA. Le vert reste reserve a la selection et
   aux actions : le prix est une information, pas un etat actif. */
.panel-price {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px;
    padding-bottom: 12px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
}
.panel-price-text { display: flex; flex-direction: column; gap: 3px; }
.panel-price-label {
    font-size: 9px; font-weight: 600; color: var(--muted);
    letter-spacing: .18em; text-transform: uppercase;
}
.panel-price-note { font-size: 10.5px; color: var(--muted); }
.panel-price-value {
    font-size: 22px; font-weight: 800; letter-spacing: .01em;
    font-variant-numeric: tabular-nums;
}

.field { margin-bottom: 20px; }

.field-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 7px;
}
.field-label { font-size: 12.5px; font-weight: 600; }

.stepper {
    display: flex; align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}
.stepper button {
    width: 30px; height: 30px;
    color: var(--muted); font-size: 15px; line-height: 1;
    transition: background .12s, color .12s;
}
.stepper button:hover { background: var(--card-2); color: var(--accent); }
.stepper input {
    width: 62px; height: 30px;
    text-align: center; font-size: 13px; font-weight: 600;
    background: transparent; border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--bg-2); }

.slider {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; margin: 6px 0 4px;
    border-radius: 2px;
    background: var(--border);
    cursor: pointer;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 15px; height: 15px; border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 1px var(--accent);
}
.slider::-moz-range-thumb {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--accent); border: 2px solid var(--bg);
}
.slider:focus-visible { outline: 1px solid var(--accent); outline-offset: 4px; }

.range-legend {
    display: flex; justify-content: space-between;
    font-size: 10.5px; color: var(--muted);
}

/* Note d'information */
.note {
    display: flex; gap: 10px;
    padding: 12px 13px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.note svg { flex: none; width: 16px; height: 16px; stroke: var(--accent); fill: none; stroke-width: 1.7; }
.note strong { display: block; font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.note span { font-size: 11.5px; color: var(--muted); }

/* Groupes de choix --------------------------------------------- */

.group-label {
    display: block;
    margin: 0 0 8px;
    font-size: 11px; font-weight: 600;
    letter-spacing: .05em;
}

.segmented {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    gap: 4px; padding: 4px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 18px;
}
.segmented button {
    padding: 7px 4px;
    font-size: 12px; font-weight: 500; color: var(--muted);
    border-radius: 2px;
    transition: background .14s, color .14s;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active { background: var(--accent); color: #07140b; font-weight: 600; }

.tile-row {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 7px; margin-bottom: 16px;
}

.tile {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 9px 4px 7px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    transition: border-color .14s, color .14s, background .14s;
}
.tile:hover { border-color: #3c474e; color: var(--text); }
.tile svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.5; }
.tile span { font-size: 9.5px; text-align: center; line-height: 1.2; }
.tile.is-active { border-color: var(--accent); color: var(--text); background: var(--card-2); }
.tile.is-active svg { stroke: var(--accent); }

/* Materiaux ----------------------------------------------------- */

.swatch-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin-bottom: 20px;
}

.swatch { display: flex; flex-direction: column; gap: 5px; }
.swatch-chip {
    height: 52px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background-size: cover; background-position: center;
    transition: border-color .14s, transform .14s;
}
.swatch:hover .swatch-chip { border-color: #3c474e; }
.swatch span { font-size: 10.5px; color: var(--muted); text-align: center; }
.swatch.is-active .swatch-chip { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.swatch.is-active span { color: var(--text); }

/* Accessoires --------------------------------------------------- */

.toggle-row {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.toggle-row:last-of-type { border-bottom: none; }
.toggle-row .icon { flex: none; display: grid; place-items: center; width: 20px; height: 20px; }
.toggle-row .icon svg { width: 20px; height: 20px; stroke: var(--muted); fill: none; stroke-width: 1.5; }
.toggle-row.is-on .icon svg { stroke: var(--accent); }
.toggle-text { flex: 1; min-width: 0; }
.toggle-text strong { display: block; font-size: 12.5px; font-weight: 600; }
.toggle-text span { font-size: 11px; color: var(--muted); }

.switch {
    flex: none;
    width: 38px; height: 21px;
    padding: 2px;
    border-radius: 11px;
    background: #39434a;
    transition: background .18s;
}
.switch::after {
    content: ""; display: block;
    width: 17px; height: 17px; border-radius: 50%;
    background: var(--text);
    transition: transform .18s;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(17px); background: #07140b; }

/* Summary ------------------------------------------------------- */

.summary-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 13px;
    margin-bottom: 7px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.summary-row .icon { flex: none; display: grid; place-items: center; width: 18px; height: 18px; }
.summary-row .icon svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.5; }
.summary-row .summary-text { flex: 1; min-width: 0; }
.summary-row strong { display: block; font-size: 12px; font-weight: 600; }
.summary-row span { font-size: 11.5px; color: var(--muted); }
.summary-edit {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; color: var(--accent);
}
.summary-edit svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; }
.summary-edit:hover { text-decoration: underline; }

.price-block {
    margin-top: 16px; padding-top: 16px;
    border-top: 1px solid var(--border);
}
.price-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--muted);
}
.price-label svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.price-value { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.price-excl { font-size: 10.5px; color: var(--muted); }

.price-lines { margin: 12px 0 0; padding: 0; list-style: none; }
.price-lines li {
    display: flex; justify-content: space-between;
    padding: 3px 0;
    font-size: 11.5px; color: var(--muted);
}
.price-lines li span:last-child { color: var(--text); font-variant-numeric: tabular-nums; }

/* Viewer -------------------------------------------------------- */

.viewer { position: relative; background: #000; overflow: hidden; }
#render-canvas { display: block; width: 100%; height: 100%; outline: none; }

.viewer-tools {
    position: absolute; right: 14px; bottom: 14px;
    display: flex; align-items: center; gap: 6px;
}
.viewer-mode {
    padding: 7px 13px;
    background: var(--accent); color: #07140b;
    font-size: 11.5px; font-weight: 700;
    border-radius: var(--radius);
}
.tool {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    background: rgba(20, 27, 31, .86);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(4px);
    transition: border-color .14s, background .14s;
}
.tool svg { width: 16px; height: 16px; stroke: var(--text); fill: none; stroke-width: 1.7; stroke-linecap: round; }
.tool:hover { border-color: var(--accent); }
.tool:hover svg { stroke: var(--accent); }

/* Ecran de chargement ---------------------------------------------- */

/* z-index 100 : au-dessus de tout le reste (modales a 60, toast a 80). */
.loading-screen {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    color: var(--muted); font-size: 12px;
    letter-spacing: .12em; text-transform: uppercase;
    transition: opacity .45s;
}
.loading-screen.is-hidden { opacity: 0; pointer-events: none; }

.loading-box { width: min(300px, 78vw); }

/* Le conteneur est en capitales espacees : la marque reprend sa casse. */
.loading-brand {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 30px;
    color: var(--text);
    text-transform: none; letter-spacing: normal;
}
.loading-head {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 9px;
}
#loading-percent { color: var(--text); font-variant-numeric: tabular-nums; }
.loading-track { height: 2px; background: var(--border); overflow: hidden; }
.loading-bar {
    height: 100%; width: 0; background: var(--accent);
    /* Lineaire et court : l'avancee est mesuree, l'animation ne doit que
       lisser les paliers, pas inventer un mouvement continu. */
    transition: width .12s linear;
}

/* Cotes projetees dans la scene */
.dim-labels { position: absolute; inset: 0; pointer-events: none; }
.dim-label {
    position: absolute; top: 0; left: 0;
    padding: 2px 7px;
    background: rgba(13, 18, 20, .88);
    border: 1px solid var(--accent);
    border-radius: 2px;
    font-size: 10.5px; font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Apparition des cotes a la fin du chargement.
   Le fondu porte sur le conteneur et non sur chaque etiquette : celles-ci
   sont recreees a chaque reconstruction, elles clignoteraient a chaque
   mouvement de slider. */
.dim-labels.is-entering { animation: dim-labels-in .24s ease-out both; }

@keyframes dim-labels-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Barre de statut ------------------------------------------------ */

.statusbar {
    height: var(--status-h);
    display: flex; align-items: center; gap: 12px;
    padding: 0 20px;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}
.statusbar .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border); }
.statusbar .sep { flex: 1; }
.statusbar .muted { color: var(--muted); }

/* Modales -------------------------------------------------------- */

.modal {
    position: fixed; inset: 0; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: rgba(5, 8, 9, .72);
    backdrop-filter: blur(3px);
    animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0; } }

.modal-box {
    width: 100%; max-width: 440px;
    max-height: 100%;
    overflow-y: auto;
    padding: 22px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal-box-wide { max-width: 720px; }

.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 4px;
}
.modal-head h2 { font-size: 18px; }
.modal-close { font-size: 22px; line-height: 1; color: var(--muted); padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-intro { margin: 0 0 16px; color: var(--muted); font-size: 12px; }

.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.preset {
    padding: 22px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px; font-weight: 600; color: var(--muted);
    transition: border-color .14s, color .14s;
}
.preset:hover { border-color: var(--accent); color: var(--text); }

.tech-list { margin: 16px 0 0; }
.tech-list div {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.tech-list dt { color: var(--muted); font-size: 12px; }
.tech-list dd { margin: 0; font-size: 12.5px; font-weight: 600; text-align: right; }
.disclaimer { margin: 14px 0 0; font-size: 10.5px; color: var(--muted); }

.quote-grid { display: grid; grid-template-columns: 1fr 240px; gap: 20px; margin-top: 16px; }
.quote-form { display: flex; flex-direction: column; gap: 11px; }
.quote-form label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.quote-form .optional { font-weight: 400; text-transform: none; opacity: .7; }
.quote-form input, .quote-form textarea {
    display: block; width: 100%; margin-top: 4px;
    padding: 8px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12.5px; font-weight: 400;
    resize: vertical;
}
.quote-form input:focus, .quote-form textarea:focus { outline: none; border-color: var(--accent); }
.form-error { margin: 0; color: #ff7a6b; font-size: 11.5px; }

.quote-summary {
    padding: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 11.5px;
}
.quote-summary h3 {
    font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
    color: var(--muted); margin-bottom: 10px;
}
.quote-summary div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.quote-summary div span:first-child { color: var(--muted); }
.quote-summary div span:last-child { text-align: right; }

/* Toast ---------------------------------------------------------- */

.toast {
    position: fixed; left: 50%; bottom: 58px; z-index: 80;
    transform: translateX(-50%);
    padding: 10px 18px;
    background: var(--card);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    font-size: 12px; font-weight: 600;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
    animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Responsive ------------------------------------------------------ */

@media (max-width: 1240px) {
    .layout { grid-template-columns: 78px 320px 1fr; }
    .tagline { display: none; }
}

@media (max-width: 1000px) {
    body { overflow: auto; }
    .header { height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
    .header-nav { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
    .project { padding-left: 14px; }

    .layout {
        display: flex; flex-direction: column;
        height: auto;
    }
    /* Viewer en haut : c'est le contenu le plus important sur petit ecran. */
    .viewer { order: 1; height: 52vh; min-height: 320px; }
    .steps { order: 2; flex-direction: row; overflow-x: auto; padding: 0; border-right: none; border-bottom: 1px solid var(--border); }
    .step { flex: 1 0 auto; padding: 10px 14px; }
    .step::before { top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 3px; }
    .step-check { display: none; }
    .steps-footer { display: none; }
    .panel { order: 3; border-right: none; overflow: visible; }
    .statusbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 8px; }
    .quote-grid { grid-template-columns: 1fr; }
}
