:root {
    /* Palette conserv?e; dis-moi si tu veux affiner une teinte */
    --bg: #202838;
    --bg-brick: #20283894;
    --bg-brick-2: #27272778;
    --TopBar-BG: #151a24;
    --bg-edit: #ef6e00; /* plus clair en mode edit */
    --card: #151a24;
    --panel: #111621;
    --ink: #e8eef8;
    --ink-weak: #a9b6cf;
    --accent: #16d3a8;
    --danger: #ff6363;
    --muted: #ffffff;
    --outline-strong: 1px dashed #e11d48;
    --radius: 14px;
    --gap: 12px;
    --shadow: 0 10px 24px rgba(0,0,0,.35);
    --maxw: 1900px;
    --Color_S1: #069263;
    --Color_S2: #CCAB4B;
    --Color_S3: #61287C;
    --Color_S4: #4F93AD;
    --Color_TCU: #852F36;
    --Color_Cloud: #94E3E4;
    --Valeo_GREEN: #82E600;
    --Valeo_GREY: #4E6B7C;
}

/* Base: Montserrat partout... */
* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Montserrat", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

/* ...sauf topbar (police syst?me pour lisibilit?) */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 12px;
    background: var(--TopBar-BG);
    border-bottom: 1px solid #1f2a3c;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

    .topbar .left, .topbar .right {
        display: flex;
        gap: 10px;
        align-items: center
    }

.btn {
    border: 1px solid #2a344a;
    background: #121724;
    color: var(--ink);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer
}

    .btn.primary {
        background: #162033
    }

    .btn.success {
        background: #0e2a22;
        border-color: #1f5c4f
    }

    .btn.ghost {
        background: #ff40405c;
    }

    .btn.danger {
        background: #2b0d12;
        border-color: #6e1421;
        color: #ffb3b6
    }

/* Controls */
.controls {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 2px 16px;
    display: grid;
    display: flex;
    gap: 12px;
}

.control {
    display: flex;
    flex-direction: row;
    gap: 2px;
    /* align-content: center; */
    justify-content: space-around;
    align-items: center;
}

    .control label {
        color: var(--Valeo_GREEN);
        font-size: 12px;
        letter-spacing: .08em;
        padding: 1%;
        font-weight: bold
    }

    .control select {
        background: var(--panel);
        color: var(--ink);
        border: 1px solid #2a3242;
        border-radius: 10px;
        padding: 10px 12px
    }

/* Visions strip (hauteur 30px) */
.visions {
    max-width: var(--maxw);
    margin: 10px auto;
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    cursor: pointer;
}

.vision {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--card);
    border: 1px solid #427400;
    border-radius: 10px;
    padding: 2px 5px;
    box-shadow: var(--shadow);
    max-height: 50px;
    overflow: hidden;
}

    .vision:hover, .btn:hover, .add-brick:hover {
        background-color: var(--Valeo_GREEN);
        color: var(--card);
    }

 

        .vision .pin.left {
            left: 6px;
            top: 6px
        }

        .vision .pin.right {
            right: 6px;
            top: 6px
        }

.pencil {
    border: 1px solid #2e6e5c;
    background: #0f2a22;
    color: #bfffe9;
    border-radius: 8px;
    width: 32px;
    height: 24px
}

.trash {
    border: 1px solid #6e1421;
    background: #2b0d12;
    color: #ffb3b6;
    border-radius: 8px;
    width: 24px;
    height: 24px
}

.vision-img {
    width: 20px;
    height: 20px;
    object-fit: contain
}

.vision-title {
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 100%;
}

section#visionsStrip {
    align-content: center;
    justify-content: space-evenly;
}


/* Layout */
.layout {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0px 16px 16px 16px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    max-height: 80%;
    height: 80%;
}

/* Shelves (main, hors Cloud/TCU) */
.shelves {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 50%;
}

.shelf {
    position: relative;
    background: #121827;
    border: 1px solid #212b3f;
    border-radius: 14px;
    padding: 10px;
    /* width: 85%; */
}

#Shelf_ID_S1 {
    background: var(--Color_S1);
}

#Shelf_ID_S2 {
    background: var(--Color_S2);
}

#Shelf_ID_S3 {
    background: var(--Color_S3);
}

#Shelf_ID_S4 {
    background: var(--Color_S4);
}

#Shelf_ID_TCU {
    background: var(--Color_TCU);
}

#Shelf_ID_Cloud {
    background: var(--Color_Cloud);
}



.shelves .title {
    position: relative;
    font-size: 18px;
    color: var(--muted);
    font-weight: bolder;
    text-shadow: 3px 2px 6px #000000;
    z-index: 1000;
    background-color: #0000002e;
    border-radius: 12px;
    max-width: fit-content;
    padding: 0 12px 0 12px;
    margin-bottom: 4px;
}



.side-shelves .shelf .title {
    position: absolute;
    font-size: 19px;
    color: var(--muted);
    font-weight: bolder;
    text-shadow: 3px 2px 6px #000000;
    z-index: 1000;
}

.shelf .grid {
    /* maxwidth a 100% pour ajuster la hauteur */
    position: relative;
    display: grid;
    grid-template-columns: repeat(7,1fr);
    gap: 8px;
    width: 85%;
}

.brick {
    position: relative;
    background: var(--bg-brick-2);
    border: 1px solid #2a3244;
    border-radius: 10px;
    padding: 2px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .brick .pin {
        position: absolute
    }

        .brick .pin.left {
            left: 6px;
            top: 6px
        }

        .brick .pin.right {
            right: 6px;
            top: 6px
        }

.brick-img-wrap {
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--bg-brick);
    border: 1px solid #1d2433;
    border-radius: 8px;
    overflow: hidden
}

.brick-img {
    width: 100%;
    height: 100%;
    object-fit: contain
}

.brick-title {
    font-weight: 700;
    text-align: center;
    font-size: .8em;
}


.add-brick {
    display: grid;
    place-items: center;
    border: 2px dashed #395;
    color: #b5ffd9;
    background: #0d221b;
    font-weight: 800;
    border-radius: 10px;
    cursor: pointer;
    font-size: 24px;
}

#videoTitle {
    font-size: 12px;
}

.offer-title {
    letter-spacing: .12em;
    color: var(--Valeo_GREEN);
    font-weight: bold;
}

.panel {
    background: var(--panel);
    border: 1px solid #212b3f;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
    position: relative
}

    .panel.popup {
        background: #e8eaef;
        color: #111
    }

    .panel .pin {
        position: absolute
    }

        .panel .pin.left {
            left: 8px;
            top: 8px
        }

        .panel .pin.right {
            right: 8px;
            top: 8px
        }

.panel-head {
    display: flex;
    justify-content: center;
    margin-bottom: 6px
}

.caps-strong {
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: .12em
}

/* Shelves Cloud & TCU dans le side */
.side-shelves {
    display: flex;
    flex-direction: row;
    gap: 10px;
    margin-bottom: 12px;
    justify-content: space-around;
}

    .side-shelves .shelf {
        display: flex;
        background: #121827;
        max-width: 38%;
        grid-template-columns: repeat(7,1fr);
        flex-direction: column;
        align-content: center;
        align-items: center;
        justify-content: space-between;
    }

        .side-shelves .shelf .grid {
            grid-template-columns: repeat(1, 1fr);
        }
/* side + ?troit */

/* Pop-up text */
#popupText {
    background: #fff;
    color: #111;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    line-height: 1.3;
    width: 100%;
    resize: vertical;
}

.counter {
    font-size: 12px;
    color: #3a4660;
    margin-top: 6px
}

/* Video */
.video .video-wrap {
    position: relative;
    border: 1px solid #1e2636;
    background: #0a0e15;
    border-radius: 10px;
    overflow: auto;
}

.video .pin.left {
    left: 8px;
    top: 8px;
    z-index: 100;
}

.video .pin.right {
    right: 8px;
    top: 10px;
    z-index: 100;
}

#visionVideo {
    width: 100%;
    height: 220px;
    display: block;
    background: #000
}

.vid-title {
    text-align: center;
    color: #9fb0cc;
    padding: 8px 6px
}

/* Modal catalog */
.modal {
    position: fixed;
    z-index: 9999;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.6)
}

    .modal.hidden {
        display: none
    }

.modal-card {
    width: min(1920px,92vw);
    max-height: 86vh;
    overflow: auto;
    background: #121722;
    border: 1px solid #2a344a;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 12px
}

    .modal-card.small {
        width: min(520px,92vw)
    }

.modal-head {
    position: sticky;
    top: 0;
    background: #0f1522;
    border-bottom: 1px solid #2a344a;
    border-radius: 12px 12px 0 0;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px
}

    .modal-head .title {
        font-weight: 800
    }

.search {
    background: #0e1320;
    color: var(--ink);
    border: 1px solid #2a3242;
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 220px
}

.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(140px,1fr));
    gap: 10px;
    padding: 10px
}

.img-card {
    background: #0e1422;
    border: 1px solid #203048;
    border-radius: 10px;
    padding: 8px;
    display: grid;
    gap: 6px;
    cursor: pointer
}

    .img-card:hover {
        border-color: #3b6ea8
    }

    .img-card img {
        width: 100%;
        height: 110px;
        object-fit: contain;
        border-radius: 6px
    }

    .img-card .name {
        font-size: 12px;
        color: #9fb0cc;
        overflow: hidden;
    }

/* Toast */
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 22px;
    background: #0e2a22;
    color: #d9fff0;
    border: 1px solid #1e5c4f;
    padding: 10px 14px;
    border-radius: 10px
}

    .toast.hidden {
        display: none
    }

/* Mode edit : fond plus clair (moins sombre) */
body.editing {
    /* subtle animated dots on grey */
    background: radial-gradient(rgb(255 255 255 / 75%) 0px, #0e340091 2px) 0 0 / 64px 64px, linear-gradient(#000000, #82E600);
    animation: bgshift 5s cubic-bezier(0.65, 0.05, 0.36, 1) infinite;
    background-attachment: fixed;
}

/* ===============================
   System / Software Toggle (fond dynamique + texte intégré)
   =============================== */

:root{
  --toggle-bg-system: #0066ff;   /* bleu clair */
  --toggle-bg-software: #82e600;  /* vert clair */
  --toggle-pill: #151a24;
  --toggle-system: #0066ff;
  --toggle-software: #82e600;
  --toggle-shadow: 0 2px 8px rgba(0,0,0,.12);
  --toggle-focus: 0 0 0 3px rgba(45,126,247,.25);
}

#offerToggle.offer-toggle{
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  margin-left: .5rem;
  border-radius: 999px;
  overflow: hidden;
  transition: background-color .3s ease;
  max-width: max-content;
}

/* couleur du fond selon l’état du bouton interne */
#offerToggle.offer-toggle.system {
  background-color: var(--toggle-bg-system);
}
#offerToggle.offer-toggle.software {
  background-color: var(--toggle-bg-software);
}

#offerToggle .toggle-btn{
  --w: 140px;
  --h: 40px;
  position: relative;
  width: var(--w);
  height: var(--h);
  border: none;
  outline: none;
  cursor: pointer;
  border-radius: calc(var(--h) / 2);
  background: transparent; /* le fond est maintenant porté par le conteneur */
  padding: 0;
  transition: transform .1s ease;
}

/* Pastille mobile avec texte intégré */
#offerToggle .toggle-btn::before{
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 6px);
  height: calc(100% - 6px);
  border-radius: 999px;
  background: var(--toggle-pill);
  box-shadow: var(--toggle-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font: 600 13px/1 "Montserrat", system-ui, sans-serif;
  letter-spacing: .2px;
  transition: transform .25s ease, color .25s ease, background .25s ease;
}

/* Texte et position selon l’état */
#offerToggle .toggle-btn.is-system::before{
  content: "System";
  color: var(--toggle-system);
  transform: translateX(0);
}
#offerToggle .toggle-btn.is-software::before{
  content: "Software";
  color: var(--toggle-software);
  transform: translateX(100%);
}

/* Focus & effet clic */
#offerToggle .toggle-btn:focus-visible{
  box-shadow: var(--toggle-focus);
}
#offerToggle .toggle-btn:active{
  transform: translateY(1px);
}

/* Responsif */
@media (max-width: 768px){
  #offerToggle .toggle-btn{
    --w: 110px;
    --h: 34px;
  }
  #offerToggle .toggle-btn::before{
    font-size: 12px;
  }
}


/* Rduction sur petits crans */
@media (max-width: 768px) {
    #offerToggle.offer-toggle .toggle-btn {
        --w: 100px;
        --h: 32px;
    }
}


@keyframes bgshift {
    0% {
        background-position: 0 0, 0 0;
    }

    100% {
        background-position: 128px 128px, 0 0;
    }
}

/* Par défaut, cachés */
#addFeatureBtn,
#addVisionBtn {
  display: none;
}

/* En mode édition : affichés à droite des selects */
body.editing #addFeatureBtn,
body.editing #addVisionBtn {
  display: inline-flex !important;
}


/* ===================================
   TEST 2: Tuer les overlays
   =================================== */

[contenteditable="true"]::before,
[contenteditable="true"]::after {
    
    /* Désactive tous les pseudo-éléments sur vos éditables */
    display: none !important;
}