/* ==========================================================================
   ModulBox — Configurateur 3D « Prévisualiser mon container »
   Style : maquette architecturale épurée (blanc / gris + accents rouges)
   ========================================================================== */
.mbx { --mbx-top: 96px; --mbx-r: 16px; position: relative; }
.mbx { max-width: 100%; }
.mbx-grid > * { min-width: 0; }
.mbx-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr); gap: var(--sp-4, 2rem); align-items: start; }

/* ---------- scène ---------- */
.mbx-stage {
  position: sticky; top: var(--mbx-top); height: min(76vh, 720px); min-height: 460px;
  border-radius: var(--mbx-r); overflow: hidden; isolation: isolate;
  background: linear-gradient(180deg, #fafbfb 0%, #e8eaed 100%);
  border: 1px solid var(--line, #d9d8d3);
  box-shadow: 0 24px 60px -34px rgba(23,24,27,.35);
  transition: background .6s ease;
}
.mbx-stage.is-night { background: linear-gradient(180deg, #1b2230 0%, #0b0f18 100%); border-color: #232b3a; }
.mbx-view, .mbx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mbx-canvas { touch-action: none; cursor: grab; outline: none; }
.mbx-canvas.is-drag { cursor: grabbing; }

.mbx-loader {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: .8rem; z-index: 5;
  background: linear-gradient(180deg, #fafbfb, #e8eaed); color: var(--ink-soft, #43464c); font-weight: 600; transition: opacity .5s ease, visibility .5s;
}
.mbx-loader.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }
.mbx-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #dfe1e4; border-top-color: var(--accent, #D7291A); animation: mbx-rot .8s linear infinite; }
@keyframes mbx-rot { to { transform: rotate(360deg); } }

.mbx-chip--info {
  position: absolute; left: 14px; top: 14px; z-index: 3; display: flex; flex-wrap: wrap; gap: .1rem .15rem; align-items: baseline;
  padding: .5rem .85rem; border-radius: 999px; background: rgba(255,255,255,.88); backdrop-filter: blur(8px);
  font-size: .8125rem; color: var(--ink-soft, #43464c); box-shadow: 0 6px 20px -10px rgba(0,0,0,.25); max-width: calc(100% - 28px);
}
.mbx-chip--info strong { color: var(--ink, #17181b); font-family: var(--font-head); font-size: .95rem; }
.is-night .mbx-chip--info { background: rgba(20,26,38,.8); color: #c7cedb; }
.is-night .mbx-chip--info strong { color: #fff; }

.mbx-ribbon {
  position: absolute; left: 14px; top: 58px; z-index: 3; white-space: nowrap;
  padding: .45rem 1rem; border-radius: 999px; background: var(--accent, #D7291A); color: #fff; font-weight: 600; font-size: .8125rem; letter-spacing: .02em;
  box-shadow: 0 10px 24px -10px rgba(215,41,26,.7);
}
.mbx-ribbon[hidden] { display: none; }
.mbx-hint-drag {
  position: absolute; right: 14px; top: 14px; z-index: 2; display: flex; align-items: center; gap: .45rem; font-size: .75rem; color: #7a7e84;
  padding: .4rem .7rem; border-radius: 999px; background: rgba(255,255,255,.7); pointer-events: none;
}
.mbx-hint-drag svg { width: 16px; height: 16px; }
.is-night .mbx-hint-drag { background: rgba(20,26,38,.6); color: #9aa3b4; }

.mbx-toolbar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
}
.mbx-segs { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); box-shadow: 0 8px 22px -12px rgba(0,0,0,.35); }
.is-night .mbx-segs { background: rgba(24,31,45,.9); }
.mbx-seg {
  border: 0; background: transparent; color: var(--ink-soft, #43464c); font-weight: 600; font-size: .78rem; padding: .42rem .8rem; border-radius: 999px; transition: background .2s, color .2s;
  min-height: 32px;
}
.is-night .mbx-seg { color: #aeb7c7; }
.mbx-seg:hover:not(:disabled) { background: rgba(23,24,27,.06); }
.mbx-seg.is-on { background: var(--accent, #D7291A); color: #fff; }
.mbx-seg:disabled { opacity: .45; cursor: default; }
.mbx-segs[hidden] { display: none; }

/* ---------- panneau ---------- */
.mbx-panel {
  position: relative; background: #fff; border: 1px solid var(--line, #d9d8d3); border-radius: var(--mbx-r);
  display: flex; flex-direction: column; max-height: calc(100vh - var(--mbx-top) - 12px); min-height: 480px; overflow-y: auto; overscroll-behavior: contain;
  position: sticky; top: var(--mbx-top);
  box-shadow: 0 24px 60px -40px rgba(23,24,27,.35);
  scrollbar-width: thin;
}
.mbx-panel-top { position: sticky; top: 0; z-index: 3; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line, #e4e3df); }
.mbx-steps { display: flex; gap: .15rem; overflow-x: auto; padding: .65rem .75rem .5rem; scrollbar-width: none; scroll-behavior: smooth; }
.mbx-steps::-webkit-scrollbar { display: none; }
.mbx-tab { flex: 0 0 auto; display: flex; align-items: center; gap: .4rem; border: 0; background: transparent; padding: .3rem .55rem; border-radius: 999px; color: #80848a; font-weight: 600; font-size: .78rem; }
.mbx-tab i { font-style: normal; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #eceae6; color: #6d7177; font-size: .7rem; transition: .2s; }
.mbx-tab.is-done i { background: #f6d4d0; color: var(--accent-deep, #9E1D12); }
.mbx-tab.is-on { color: var(--ink, #17181b); }
.mbx-tab.is-on i { background: var(--accent, #D7291A); color: #fff; }
.mbx-tab:hover { color: var(--ink, #17181b); }
.mbx-progress { height: 3px; background: #efeeea; }
.mbx-progress i { display: block; height: 100%; background: var(--accent, #D7291A); transition: width .45s cubic-bezier(.2,.8,.2,1); }

.mbx-body { padding: 1.15rem 1.25rem 1rem; animation: mbx-in .35s ease both; flex: 1; }
@keyframes mbx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mbx-step-h span { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent, #D7291A); }
.mbx-step-h h2 { font-family: var(--font-head); font-size: 1.55rem; line-height: 1.15; margin-top: .2rem; color: var(--ink, #17181b); }
.mbx-sect { margin-top: 1.3rem; }
.mbx-sect-h h3 { font-family: var(--font-head); font-size: 1rem; font-weight: 700; color: var(--ink, #17181b); }
.mbx-sect-h p { font-size: .8125rem; color: #6d7177; margin-top: .15rem; margin-bottom: .6rem; }
.mbx-sect-h { margin-bottom: .55rem; }
.mbx-sub { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: #80848a; font-weight: 700; margin: .9rem 0 .4rem; }

.mbx-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.mbx-cards.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mbx-cards.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mbx-card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left; padding: .8rem .85rem; min-height: 64px;
  border-radius: 12px; border: 1.5px solid var(--line, #e1e0dc); background: #fff; color: var(--ink, #17181b);
  transition: border-color .2s, box-shadow .2s, transform .2s, background .2s;
}
.mbx-card:hover:not(:disabled) { border-color: #b9bbbe; transform: translateY(-1px); box-shadow: 0 10px 22px -16px rgba(0,0,0,.4); }
.mbx-card.is-on { border-color: var(--accent, #D7291A); background: #fff6f5; box-shadow: 0 0 0 3px rgba(215,41,26,.12); }
.mbx-card.is-on::after { content: ""; position: absolute; right: 9px; top: 9px; width: 16px; height: 16px; border-radius: 50%; background: var(--accent, #D7291A) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.2 8.4l2.3 2.3 5-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat; }
.mbx-card:disabled { opacity: .4; cursor: not-allowed; }
.mbx-card-ic { color: var(--accent, #D7291A); display: flex; }
.mbx-card-ic svg { width: 26px; height: 26px; }
.mbx-card-ic .mbx-plan { width: 72px; height: auto; max-width: 100%; }
.mbx-card-t { font-weight: 700; font-size: .9rem; line-height: 1.2; padding-right: 1rem; }
.mbx-card-s { font-size: .75rem; color: #6d7177; line-height: 1.3; }
.mbx-plan { width: 100%; max-width: 72px; height: auto; color: #b7b9bc; }
.mbx-plan rect { fill: #f1f1ef; stroke: #8a8d92; stroke-width: 1.4; }
.mbx-plan rect.p-on { fill: #fbe3e0; stroke: var(--accent, #D7291A); }
.mbx-plan .rib { stroke: rgba(215,41,26,.45); stroke-width: 1; }
.cols-3 .mbx-plan, .mbx-card .mbx-plan { margin-bottom: .1rem; }

.mbx-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.mbx-chip-b { border: 1.5px solid var(--line, #e1e0dc); background: #fff; color: var(--ink, #17181b); padding: .45rem .8rem; border-radius: 999px; font-weight: 600; font-size: .8125rem; transition: .2s; min-height: 36px; }
.mbx-chip-b:hover:not(:disabled) { border-color: #b9bbbe; }
.mbx-chip-b.is-on { border-color: var(--accent, #D7291A); background: var(--accent, #D7291A); color: #fff; }
.mbx-chip-b:disabled { opacity: .4; }

.mbx-swatches { display: flex; flex-wrap: wrap; gap: .6rem .7rem; }
.mbx-sw { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #cfcfcb, inset 0 -6px 10px rgba(0,0,0,.08); transition: transform .2s, box-shadow .2s; }
.mbx-sw:hover { transform: scale(1.08); }
.mbx-sw.is-on { box-shadow: 0 0 0 2.5px var(--accent, #D7291A), 0 6px 14px -6px rgba(0,0,0,.4); }
.mbx-sw-l { position: absolute; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); font-size: .65rem; white-space: nowrap; color: #6d7177; opacity: 0; pointer-events: none; transition: opacity .15s; font-weight: 600; }
.mbx-sw:hover .mbx-sw-l, .mbx-sw.is-on .mbx-sw-l { opacity: 1; }
.mbx-swatches { padding-bottom: .9rem; }

.mbx-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem .85rem; margin-top: .45rem; border: 1.5px solid var(--line, #e1e0dc); background: #fff; border-radius: 12px; text-align: left; transition: .2s; }
.mbx-toggle:hover { border-color: #b9bbbe; }
.mbx-toggle-t { display: flex; flex-direction: column; gap: .05rem; }
.mbx-toggle-t strong { font-size: .875rem; color: var(--ink, #17181b); }
.mbx-toggle-t em { font-style: normal; font-size: .75rem; color: #6d7177; }
.mbx-knob { flex: 0 0 auto; position: relative; width: 40px; height: 24px; border-radius: 999px; background: #d3d4d6; transition: background .25s; }
.mbx-knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .25s cubic-bezier(.3,.9,.3,1.2); }
.mbx-toggle.is-on { border-color: rgba(215,41,26,.45); background: #fff9f8; }
.mbx-toggle.is-on .mbx-knob { background: var(--accent, #D7291A); }
.mbx-toggle.is-on .mbx-knob::after { transform: translateX(16px); }

.mbx-counters { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin: .7rem 0 .1rem; }
.mbx-counter { display: flex; flex-direction: column; gap: .35rem; padding: .6rem .75rem; border: 1.5px solid var(--line, #e1e0dc); border-radius: 12px; font-size: .8rem; font-weight: 600; color: #50545a; }
.mbx-counter div { display: flex; align-items: center; justify-content: space-between; }
.mbx-counter b { font-size: 1.1rem; color: var(--ink, #17181b); }
.mbx-counter button { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line, #d9d8d3); background: #fff; font-size: 1.1rem; line-height: 1; color: var(--ink, #17181b); transition: .2s; }
.mbx-counter button:hover:not(:disabled) { border-color: var(--accent, #D7291A); color: var(--accent, #D7291A); }
.mbx-counter button:disabled { opacity: .35; }

.mbx-input, .mbx-f input, .mbx-f textarea { width: 100%; border: 1.5px solid var(--line, #d9d8d3); border-radius: 10px; padding: .7rem .85rem; background: #fff; color: var(--ink, #17181b); transition: border-color .2s, box-shadow .2s; font-size: .9375rem; }
.mbx-input:focus, .mbx-f input:focus, .mbx-f textarea:focus { outline: none; border-color: var(--accent, #D7291A); box-shadow: 0 0 0 3px rgba(215,41,26,.14); }

.mbx-nav { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: .75rem; padding: .8rem 1.25rem; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line, #e4e3df); z-index: 3; }
.mbx-nav .btn { flex: 0 0 auto; }
.mbx-nav .btn:only-child { margin-left: 0; }

/* ---------- étape finale ---------- */
.mbx-final-lead p { color: var(--ink-soft, #43464c); margin-top: .6rem; font-size: .9375rem; }
.mbx-badge { display: inline-block; padding: .25rem .7rem; border-radius: 999px; background: #fbe3e0; color: var(--accent-deep, #9E1D12); font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.mbx-gauge { margin-top: 1.1rem; }
.mbx-gauge-h { display: flex; justify-content: space-between; font-size: .8125rem; font-weight: 600; color: #50545a; }
.mbx-gauge-h b { color: var(--accent, #D7291A); }
.mbx-gauge-bar { height: 8px; border-radius: 999px; background: #eceae6; margin-top: .4rem; overflow: hidden; }
.mbx-gauge-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent, #D7291A), #ef6a5d); animation: mbx-grow 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes mbx-grow { from { width: 0 !important; } }
.mbx-locked { margin-top: .9rem; display: grid; gap: .35rem; }
.mbx-locked li { display: flex; align-items: center; gap: .55rem; padding: .55rem .75rem; border: 1.5px dashed #cfd0d2; border-radius: 10px; font-size: .84rem; color: #50545a; background: repeating-linear-gradient(135deg, #fafaf9 0 8px, #f4f4f2 8px 16px); }
.mbx-locked li span { display: flex; color: #8a8d92; }
.mbx-locked li svg { width: 16px; height: 16px; }
.mbx-locked li em { margin-left: auto; font-style: normal; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent, #D7291A); }
.mbx-recap { margin-top: 1rem; border: 1.5px solid var(--line, #e1e0dc); border-radius: 12px; padding: .2rem .85rem; }
.mbx-recap summary { cursor: pointer; font-weight: 700; padding: .6rem 0; font-size: .9rem; }
.mbx-recap dl { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: .35rem .9rem; padding-bottom: .8rem; font-size: .8125rem; }
.mbx-recap dt { color: #80848a; font-weight: 600; }
.mbx-recap dd { margin: 0; color: var(--ink, #17181b); }
.mbx-form { margin-top: 1.3rem; padding-top: 1.2rem; border-top: 1px solid var(--line, #e4e3df); display: grid; gap: .7rem; }
.mbx-form h3 { font-family: var(--font-head); font-size: 1.2rem; }
.mbx-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.mbx-f { display: grid; gap: .3rem; font-size: .78rem; font-weight: 600; color: #50545a; }
.mbx-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mbx-check { display: flex; gap: .6rem; align-items: flex-start; font-size: .78rem; color: #50545a; line-height: 1.4; }
.mbx-check input { margin-top: .2rem; width: 18px; height: 18px; accent-color: var(--accent, #D7291A); flex: 0 0 auto; }
.mbx-err { color: var(--accent-deep, #9E1D12); background: #fdeceb; border-radius: 10px; padding: .6rem .8rem; font-size: .84rem; font-weight: 600; }
.mbx-fine { font-size: .72rem; color: #8a8d92; }
.mbx-share { margin-top: .6rem; text-align: center; }
.mbx-link { border: 0; background: none; color: #6d7177; text-decoration: underline; font-size: .8125rem; padding: .4rem; }
.mbx-link:hover { color: var(--accent, #D7291A); }
.mbx-done { text-align: center; padding: 2rem .5rem; display: grid; gap: .8rem; justify-items: center; }
.mbx-done-ic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #e8f5ea; color: #2f8a3f; animation: mbx-pop .5s cubic-bezier(.2,1.4,.4,1) both; }
.mbx-done-ic svg { width: 32px; height: 32px; stroke-width: 2; }
@keyframes mbx-pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.mbx-done h3 { font-family: var(--font-head); font-size: 1.4rem; }
.mbx-done p { color: #50545a; max-width: 34ch; }
.mbx-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink, #17181b); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; font-size: .84rem; font-weight: 600; transition: .3s; z-index: 100; pointer-events: none; }
.mbx-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.mbx-nogl { padding: 3rem 1.5rem; text-align: center; border: 1px dashed var(--line, #d9d8d3); border-radius: var(--mbx-r); display: grid; gap: .8rem; justify-items: center; }

/* ---------- gabarit de page ---------- */
.mbx-intro { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--sp-4, 2rem); align-items: end; }
.mbx-intro p { color: var(--ink-soft, #43464c); font-size: var(--fs-lead, 1.15rem); max-width: 54ch; }
.mbx-points { display: flex; flex-wrap: wrap; gap: .5rem .6rem; justify-content: flex-end; }
.mbx-points li { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border: 1px solid var(--line, #d9d8d3); border-radius: 999px; background: #fff; font-size: .8125rem; font-weight: 600; color: var(--ink-soft, #43464c); }
.mbx-points li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent, #D7291A); }
.mbx-wrap { padding-top: var(--sp-4, 2rem); padding-bottom: var(--sp-6, 4.5rem); }
.mbx-reassure { margin-top: var(--sp-5, 3rem); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3, 1.25rem); }
.mbx-reassure article { padding: 1.4rem; border: 1px solid var(--line, #e1e0dc); border-radius: var(--mbx-r, 16px); background: #fff; }
.mbx-reassure b { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: #fbe3e0; color: var(--accent, #D7291A); font-family: var(--font-head); margin-bottom: .7rem; }
.mbx-reassure h3 { font-family: var(--font-head); font-size: 1.1rem; margin-bottom: .3rem; }
.mbx-reassure p { font-size: .9rem; color: #50545a; }

/* ---------- mobile ---------- */
@media (max-width: 960px) {
  .mbx-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .mbx-stage { top: var(--mbx-top); height: 44vh; min-height: 290px; max-height: 420px; z-index: 6; border-radius: 14px; }
  .mbx-panel { position: relative; top: 0; max-height: none; overflow: visible; margin-top: .8rem; border-radius: 14px; }
  .mbx-panel-top { top: calc(var(--mbx-top) + min(44vh, 420px) + 0px); position: sticky; z-index: 5; }
  .mbx-nav { bottom: 0; position: sticky; }
  .mbx-hint-drag { display: none; }
  .mbx-toolbar { gap: .35rem; left: 8px; right: 8px; bottom: 8px; }
  .mbx-seg { padding: .35rem .6rem; font-size: .72rem; min-height: 30px; }
  .mbx-segs--views { display: none; }
  .mbx-intro { grid-template-columns: 1fr; }
  .mbx-points { justify-content: flex-start; }
  .mbx-reassure { grid-template-columns: 1fr; }
  .mbx-ribbon { top: 50px; left: 8px; font-size: .68rem; max-width: 92%; white-space: normal; }
  .mbx-cards.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .mbx-row { grid-template-columns: 1fr; }
  .mbx-cards.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mbx-body { padding: 1rem; }
  .mbx-step-h h2 { font-size: 1.35rem; }
  .mbx-chip--info { font-size: .72rem; padding: .4rem .7rem; }
}
@media (prefers-reduced-motion: reduce) { .mbx-body, .mbx-gauge-bar i, .mbx-done-ic { animation: none; } }
