﻿/* ============================================================
   Simulateur 2D — habillage « moderne clair épuré » (07/2026)
   Chargé via <link> par Simulator2DWidget.cshtml (les 2 pages
   hôtes /simulator et /simulator2d) et Simulator2DEstimate.cshtml.
   Tokens : rouge #D32F1E, hover #B32517, teinte #FBEDEB,
            texte #252525, secondaire #6B7280, filet #E6E8EB,
            zone de jeu #F5F6F7, rayons 12px (cartes) / 8px (boutons).
   Hex en dur volontairement (compatibilité minifier si bundlé un jour).
   Tout est scopé sous .sim2d pour ne rien casser du thème Slicing.
   ============================================================ */

/* ---------- stage (carte autour du canvas Unity) ---------- */
.sim2d .sim2d-stage {
    border: 1px solid #E6E8EB;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(35, 31, 32, .08);
    background: #F5F6F7;
}

/* ---------- bouton plein écran ---------- */
.sim2d .fullscreen-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #E6E8EB;
    border-radius: 50%;
    background: #FFFFFF;
    color: #4A4A4A;
    font-size: 15px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(35, 31, 32, .08);
    z-index: 10;
    transition: color .15s ease;
}

.sim2d .fullscreen-btn:hover { color: #D32F1E; }

.sim2d .fullscreen-btn:focus { outline: 2px solid #D32F1E; outline-offset: 2px; }

/* ---------- overlay de chargement Unity ---------- */
.sim2d #sim2d-loading {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    background: #F5F6F7;
    opacity: 1;
    transition: opacity .4s ease;
}

.sim2d #sim2d-loading.sim2d-done {
    opacity: 0;
    pointer-events: none;
}

.sim2d .sim2d-load-logo {
    background: #D32F1E;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 26px;
    line-height: 1;
    letter-spacing: .04em;
    padding: 10px 16px 8px;
    margin-bottom: 18px;
}

.sim2d .sim2d-progress-track {
    width: 260px;
    height: 6px;
    border-radius: 999px;
    background: #E6E8EB;
    overflow: hidden;
    margin-bottom: 14px;
}

.sim2d #sim2d-progress-bar {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: #D32F1E;
    transition: width .3s ease;
}

.sim2d .sim2d-load-caption {
    font-size: 13px;
    color: #6B7280;
}

.sim2d #sim2d-loading.sim2d-error .sim2d-progress-track { visibility: hidden; }

.sim2d #sim2d-loading.sim2d-error .sim2d-load-caption {
    color: #D32F1E;
    max-width: 46ch;
    text-align: center;
}

/* ---------- boutons ---------- */
.sim2d .sim2d-btn {
    display: inline-block;
    border-radius: 8px;
    padding: 11px 20px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.4;
    transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.sim2d .sim2d-btn .fa { margin-left: 7px; margin-right: 0; }

.sim2d .sim2d-btn .fa-upload,
.sim2d .sim2d-btn .fa-download { margin-left: 0; margin-right: 7px; }

.sim2d .sim2d-btn-primary {
    background: #D32F1E;
    border-color: #D32F1E;
    color: #FFFFFF;
}

.sim2d .sim2d-btn-primary:hover,
.sim2d .sim2d-btn-primary:focus {
    background: #B32517;
    border-color: #B32517;
    color: #FFFFFF;
    box-shadow: 0 6px 20px rgba(35, 31, 32, .08);
}

.sim2d .sim2d-btn-outline {
    background: #FFFFFF;
    border-color: #E6E8EB;
    color: #252525;
}

.sim2d .sim2d-btn-outline:hover,
.sim2d .sim2d-btn-outline:focus {
    border-color: #252525;
    color: #252525;
}

/* état désactivé (classe togglée par Simulator2DDimensionsPartialTable) */
.sim2d .sim2d-btn.disabled,
.sim2d .sim2d-btn.disabled:hover {
    background: #F5F6F7;
    border-color: #E6E8EB;
    color: #A8ADB3;
    pointer-events: none;
    cursor: not-allowed;
    opacity: 1;
    box-shadow: none;
}

/* ---------- rangée d'actions sous le stage ---------- */
.sim2d .sim2d-actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: end;
    -ms-flex-pack: end;
    justify-content: flex-end;
    gap: 10px;
    margin: 18px 0;
}

/* ---------- chip longueur (état vide) ---------- */
.sim2d .sim2d-chip {
    display: inline-block;
    background: #FBEDEB;
    color: #D32F1E;
    border-radius: 999px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.sim2d .sim2d-chip span { font-size: 15px; }

/* ---------- cartes ---------- */
.sim2d .sim2d-card {
    background: #FFFFFF;
    border: 1px solid #E6E8EB;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(35, 31, 32, .06);
    overflow: hidden;
    margin-bottom: 16px;
}

.sim2d .sim2d-card-head {
    padding: 14px 22px 0;
    font-size: 15px;
    font-weight: 700;
    color: #252525;
}

.sim2d .sim2d-card-head span {
    font-size: 12.5px;
    font-weight: 400;
    color: #6B7280;
    margin-left: 8px;
}

/* ---------- tableau des dimensions ---------- */
.sim2d table.sim2d-dims {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 0;
}

.sim2d table.sim2d-dims th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6B7280;
    padding: 10px 22px;
    border-bottom: 1px solid #E6E8EB;
    background: transparent;
}

.sim2d table.sim2d-dims td {
    padding: 11px 22px;
    border-bottom: 1px solid #E6E8EB;
    font-size: 14px;
    color: #252525;
}

.sim2d table.sim2d-dims tr:last-child td { border-bottom: none; }

.sim2d table.sim2d-dims th.sim2d-num,
.sim2d table.sim2d-dims td.sim2d-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* rangée du total (une seule, après les chaînes) */
.sim2d .sim2d-total {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: baseline;
    -ms-flex-align: baseline;
    align-items: baseline;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    background: #F5F6F7;
    padding: 13px 22px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #252525;
}

.sim2d .sim2d-total b {
    color: #D32F1E;
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

/* alignement numérique générique (dimensions + panier) */
.sim2d th.sim2d-num,
.sim2d td.sim2d-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ---------- hero (Simulator2DIndex) ---------- */
.sim2d-hero { padding: 10px 0 22px; }

.sim2d-hero h1 { margin-bottom: 12px; }

.sim2d-hero .sim2d-lead,
.sim2d .sim2d-lead {
    max-width: 62ch;
    color: #6B7280;
    font-size: 15px;
    line-height: 1.6;
}

/* ---------- page devis ---------- */
.sim2d .sim2d-estimate-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
    gap: 22px;
    margin-bottom: 40px;
}

.sim2d .sim2d-estimate-cart {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 480px;
    flex: 1 1 480px;
    min-width: 0;
}

.sim2d .sim2d-estimate-form {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 380px;
    flex: 1 1 380px;
    min-width: 0;
}

.sim2d table.sim2d-cart-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.sim2d table.sim2d-cart-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6B7280;
    padding: 14px 18px 10px;
    border-bottom: 1px solid #E6E8EB;
}

.sim2d table.sim2d-cart-table td {
    padding: 10px 18px;
    border-bottom: 1px solid #E6E8EB;
    font-size: 14px;
    color: #252525;
    vertical-align: middle;
}

.sim2d table.sim2d-cart-table tr:last-child td { border-bottom: none; }

.sim2d table.sim2d-cart-table .cartImage {
    width: 56px;
    height: 56px;
    -o-object-fit: contain;
    object-fit: contain;
    border-radius: 8px;
    background: #F5F6F7;
}

.sim2d .sim2d-ref {
    display: inline-block;
    background: #F5F6F7;
    border: 1px solid #E6E8EB;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    white-space: nowrap;
}

/* formulaire */
.sim2d .sim2d-form-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #6B7280;
    margin: 0 0 5px;
}

.sim2d .sim2d-form .form-control {
    border: 1px solid #E6E8EB;
    border-radius: 8px;
    background: #FFFFFF;
    padding: 10px 12px;
    height: auto;
    font-size: 14px;
    color: #252525;
    box-shadow: none;
}

.sim2d .sim2d-form .form-control:focus {
    border-color: #D32F1E;
    box-shadow: 0 0 0 3px #FBEDEB;
    outline: none;
}

.sim2d .sim2d-form .form-group { margin-bottom: 14px; }

.sim2d .sim2d-form-title {
    font-size: 15px;
    font-weight: 700;
    color: #252525;
    padding: 18px 22px 0;
}

.sim2d .sim2d-form-inner { padding: 4px 22px 20px; }

/* ============================================================
   v2 — moteur Konva : catalogue DOM, toolbar, dialogue, rotation
   ============================================================ */

/* ---------- catalogue ---------- */
.sim2d .sim2d-catalog {
    background: #FFFFFF;
    border-bottom: 1px solid #E6E8EB;
    padding: 12px 16px 10px;
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(2, auto);
    gap: 10px 12px;
    justify-content: start;
    overflow-x: auto;
}

.sim2d .sim2d-tile {
    width: 84px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 4px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.sim2d .sim2d-tile-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: #F5F6F7;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    position: relative;
    transition: border-color .15s ease, transform .15s ease;
}

.sim2d .sim2d-tile:hover .sim2d-tile-thumb { border-color: #D5D8DC; transform: translateY(-1px); }

.sim2d .sim2d-tile-thumb img { max-width: 62px; max-height: 62px; pointer-events: none; }

.sim2d .sim2d-tile-lbl {
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    color: #252525;
    max-width: 84px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sim2d .sim2d-tile-off { cursor: not-allowed; }

.sim2d .sim2d-tile-off .sim2d-tile-thumb::after {
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    border-radius: 8px;
    background: rgba(107, 114, 128, .45);
}

.sim2d .sim2d-tile-off:hover .sim2d-tile-thumb { border-color: transparent; transform: none; }

.sim2d .sim2d-tile-off .sim2d-tile-lbl { color: #6B7280; }

/* ---------- toolbar in-scène ---------- */
.sim2d .sim2d-toolbar {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 4px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    background: #FFFFFF;
    border: 1px solid #E6E8EB;
    border-radius: 999px;
    padding: 5px 10px;
    box-shadow: 0 6px 20px rgba(35, 31, 32, .08);
    z-index: 5;
}

.sim2d .sim2d-tb-btn {
    width: 42px;
    height: 42px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    cursor: pointer;
    color: #4A4A4A;
    transition: background .15s ease, color .15s ease;
}

.sim2d .sim2d-tb-btn:hover { background: #FBEDEB; color: #D32F1E; }

.sim2d .sim2d-tb-btn:disabled { color: #C8CCD0; background: transparent; cursor: default; }

.sim2d .sim2d-tb-sep { width: 1px; height: 22px; background: #E6E8EB; }

/* ---------- boutons rotation flottants ---------- */
.sim2d .sim2d-rot-btn {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 1px solid #E6E8EB;
    background: #FFFFFF;
    color: #D32F1E;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(35, 31, 32, .08);
    display: none;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    z-index: 6;
    padding: 0;
}

.sim2d .sim2d-rot-btn:hover { background: #FBEDEB; }

/* ---------- dialogue de confirmation ---------- */
.sim2d .sim2d-veil {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(35, 31, 32, .35);
    display: none;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    z-index: 30;
}

.sim2d .sim2d-veil.show {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.sim2d .sim2d-dlg {
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(35, 31, 32, .25);
    width: 380px;
    max-width: calc(100% - 40px);
    padding: 24px 26px 22px;
}

.sim2d .sim2d-dlg h4 { margin: 0 0 8px; font-size: 17px; font-weight: 700; color: #252525; }

.sim2d .sim2d-dlg p { margin: 0 0 20px; font-size: 14px; color: #6B7280; }

.sim2d .sim2d-dlg-actions {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    gap: 10px;
    -webkit-box-pack: end;
    -ms-flex-pack: end;
    justify-content: flex-end;
}

.sim2d .sim2d-btn-ghost {
    background: #FFFFFF;
    color: #6B7280;
    border-color: #E6E8EB;
}

.sim2d .sim2d-btn-ghost:hover { color: #252525; border-color: #6B7280; }

/* ---------- fantôme de drag catalogue -> scène ---------- */
#sim2d-ghost {
    position: fixed;
    pointer-events: none;
    opacity: .6;
    z-index: 100;
    display: none;
    max-width: 80px;
    max-height: 80px;
}
