/* Boutique Vata : configurateur de carte, abonnements, remerciements. Même identité que la page d'accueil (fond sombre, accent doré). */
:root {
  --bg: #0d0a12;
  --surface: rgba(255, 255, 255, .06);
  --surface-2: rgba(255, 255, 255, .1);
  --line: rgba(255, 255, 255, .14);
  --text: #f7f4fb;
  --muted: #bdb6ca;
  --accent: #d4af5f;
  --accent-ink: #17120a;
  --danger: #ff9f9f;
  --warn: #f0c36d;
  --ok: #8be0b0;
  --radius: 16px;
  --guide-bleed: #3b6fd4;
  --guide-trim: #d23a32;
  --guide-safe: #5aa845;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 45% at 8% 6%, rgba(212, 175, 95, .2), transparent 70%),
    radial-gradient(50% 40% at 96% 38%, rgba(150, 90, 210, .14), transparent 70%),
    var(--bg);
}
a { color: var(--accent); }
a:hover { color: #f0d28c; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
.brand img { height: 28px; width: auto; }
.top nav { display: flex; gap: 14px; font-size: 14px; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #e4c071; color: var(--accent-ink); }
.btn.sm { min-height: 34px; padding: 0 11px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 38px; min-height: 38px; padding: 0; }
.btn.on { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.btn.danger { color: var(--danger); }

/* Configurateur */
.cfg { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; max-width: 1360px; margin: 0 auto; padding: 16px; }
@media (min-width: 1000px) { .cfg { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; } }
.cfg-side { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 1000px) { .cfg-side { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; padding-right: 4px; } }

.intro h1 { font-size: 24px; }
.intro p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.seg button { min-height: 38px; padding: 0 20px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }

.stage-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
.stage-bar .sp { flex: 1; }

.canvas-wrap { position: relative; width: 100%; max-width: 1063px; margin: 0 auto; border-radius: 6px; line-height: 0; background: #1a1622; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); touch-action: manipulation; }
.canvas-wrap .canvas-container { max-width: 100%; }
.canvas-wrap svg.guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 6px; }
.legend .l-bleed i { border-color: var(--guide-bleed); }
.legend .l-trim i { border-color: var(--guide-trim); }
.legend .l-safe i { border-color: var(--guide-safe); }

/* Panneaux */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel > summary, .panel > h2 { padding: 12px 14px; font-size: 14px; font-weight: 700; cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; font-size: 12px; color: var(--muted); transition: transform .2s; }
.panel[open] > summary::after { transform: rotate(180deg); }
.panel .body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.panel .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.panel .row > * { flex: none; }
.panel .row .grow { flex: 1; min-width: 0; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
label.f.inline { flex-direction: row; align-items: center; gap: 8px; }
input[type="text"], input[type="email"], input[type="number"], select {
  min-height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3);
  color: var(--text); font: inherit; font-size: 14px; width: 100%;
}
input[type="color"] { width: 42px; height: 38px; padding: 2px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatches button:hover { border-color: var(--accent); }
.tpls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tpl { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px; color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-align: center; }
.tpl:hover { border-color: var(--accent); }
.tpl span { display: block; height: 38px; border-radius: 6px; margin-bottom: 6px; }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }

/* Inspecteur de l'objet sélectionné */
#inspector { margin-top: 14px; }
#inspector .body { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
#inspector .title { width: 100%; font-weight: 700; font-size: 13px; color: var(--accent); }
#inspector label.f { min-width: 90px; }
#inspector select { width: 190px; }
#inspector input[type="number"] { width: 84px; }

/* Vérifications */
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checks li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.4; background: rgba(0, 0, 0, .25); border-left: 3px solid var(--line); }
.checks li.error { border-color: var(--danger); }
.checks li.warn { border-color: var(--warn); }
.checks li.ok { border-color: var(--ok); }
.checks li i { flex: none; margin-top: 2px; }
.checks li.error i { color: var(--danger); }
.checks li.warn i { color: var(--warn); }
.checks li.ok i { color: var(--ok); }
.checks li[data-pick] { cursor: pointer; }
.checks .side { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-right: 6px; }

/* Prix */
.price { display: grid; gap: 4px; font-size: 14px; }
.price .line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.price .total { color: var(--text); font-size: 20px; font-weight: 800; }
.tiers { width: 100%; border-collapse: collapse; font-size: 12.5px; color: var(--muted); }
.tiers td { padding: 3px 0; border-bottom: 1px solid var(--line); }
.tiers td:last-child { text-align: right; }
.tiers tr.cur td { color: var(--accent); font-weight: 700; }

/* Commande */
dialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; border: 1px solid var(--line); border-radius: 20px; background: #17121f; color: var(--text); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog h2 { font-size: 20px; }
.msg { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; background: rgba(0, 0, 0, .3); }
.msg.error { color: var(--danger); border: 1px solid rgba(255, 159, 159, .4); }
.msg.warn { color: var(--warn); border: 1px solid rgba(240, 195, 109, .4); }
.consent-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Pages boutique et remerciements */
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.offer { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.offer h2 { font-size: 18px; }
.offer .price-tag { font-size: 24px; font-weight: 800; color: var(--accent); }
.offer .price-tag small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.stat b { color: var(--text); }
.center { text-align: center; }
.big-ok { font-size: 48px; color: var(--ok); }

/* Éditeur de l'élément sélectionné : en haut de la barre de droite */
#inspector { margin-top: 0; border-color: var(--accent); }
#inspector select { width: 100%; }
#inspector label.f { flex: 1 1 100%; min-width: 0; }
#inspector label.f:has(input[type="number"]), #inspector label.f:has(input[type="color"]) { flex: 0 0 auto; }
#inspector .btn { flex: none; }
#profilePanel .stat { padding: 3px 0; }

/* Aperçu 3D : carte PVC (coins arrondis, tranche blanche) */
.viewer3d { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; border-radius: 6px; overflow: hidden; line-height: normal; touch-action: none; cursor: grab; user-select: none;
  background: radial-gradient(70% 80% at 50% 38%, #2f2740 0%, #14101c 62%, #0d0a12 100%); }
.viewer3d:active { cursor: grabbing; }
.v3-stage { position: absolute; inset: 0; display: grid; place-items: center; perspective: 1500px; }
.v3-card { position: relative; transform-style: preserve-3d; will-change: transform; }
.v3-face, .v3-slice { position: absolute; inset: 0; border-radius: 4.07% / 6.48%; }
.v3-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; background-size: 100% 100%; background-repeat: no-repeat; filter: brightness(var(--b, 1)); }
.v3-face::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(112deg, rgba(255, 255, 255, 0) calc(var(--shine, 50%) - 16%), rgba(255, 255, 255, .34) var(--shine, 50%), rgba(255, 255, 255, 0) calc(var(--shine, 50%) + 16%)); }
.v3-slice { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05); }
.v3-shadow { position: absolute; left: 50%; bottom: 11%; width: 56%; height: 6%; transform: translateX(-50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0)); filter: blur(7px); }
.v3-bar { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; z-index: 2; }
.v3-hint { position: absolute; top: 12px; left: 0; right: 0; margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .v3-card { transition: none; } }

/* Modèles : vignettes réelles (recto) */
.tpl span { aspect-ratio: 86 / 54; height: auto; background-size: cover; background-position: center; background-color: #1b1722; transition: opacity .3s; opacity: .55; }
.tpl span.ready { opacity: 1; }
.tpls.portrait { grid-template-columns: repeat(3, 1fr); }
.tpls.portrait .tpl span { aspect-ratio: 54 / 86; }
.stage-bar .seg button i { margin-right: 4px; }
.tpls { grid-template-columns: repeat(2, 1fr); }

/* Contraste du QR code */
.qr-status { margin: 0; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.4; background: rgba(0, 0, 0, .25); border-left: 3px solid var(--line); }
.qr-status.ok { border-color: var(--ok); color: var(--ok); }
.qr-status.warn { border-color: var(--warn); color: var(--warn); }
.qr-status.error { border-color: var(--danger); color: var(--danger); }

/* Commande : une ligne par carte */
.odh { font-size: 15px; margin: 4px 0; }
#oRows { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.orow { display: grid; grid-template-columns: 22px repeat(4, minmax(0, 1fr)) auto; gap: 6px; align-items: center; }
.orow .onum { font-size: 12px; font-weight: 700; color: var(--muted); text-align: center; }
.orow input { min-width: 0; }
.orow .olocked { grid-column: 2 / span 4; display: flex; flex-direction: column; font-size: 13.5px; }
.orow .olocked span { color: var(--muted); font-size: 12px; }
@media (max-width: 640px) { .orow { grid-template-columns: 22px 1fr 1fr auto; } .orow .o-fonction, .orow .o-email { grid-column: 2 / span 2; } .orow .olocked { grid-column: 2 / span 2; } }
.oactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
dialog { width: min(760px, calc(100vw - 24px)); }

/* Code promo */
.promo-row { display: flex; gap: 8px; }
.promo-row input { flex: 1; text-transform: uppercase; letter-spacing: .06em; }
.promo-ok { color: var(--ok); }
.promo-ko { color: var(--danger); }
.price .line.promo { color: var(--ok); }

/* Glisser-déposer d'une image sur la carte */
.canvas-wrap.dropping::after { content: "Déposez l'image ici"; position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; border-radius: 6px;
  background: rgba(13, 10, 18, .6); border: 3px dashed var(--accent); color: var(--accent); font-weight: 700; font-size: 18px; pointer-events: none; }

/* Adresse de livraison */
#oShip { display: flex; flex-direction: column; gap: 10px; }
.ship-row { display: grid; grid-template-columns: 120px 1fr; gap: 8px; }

/* Erreurs de commande : impossibles à manquer */
.msg.order-error { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; margin: 12px 0; font-size: 15px; font-weight: 600; line-height: 1.45;
  color: #fff; background: #b3261e; border: 2px solid #ff8a80; border-radius: 12px; box-shadow: 0 0 0 4px rgba(255, 138, 128, .25); }
.msg.order-error::before { content: "⚠"; font-size: 20px; line-height: 1.2; }
.msg.order-error a { color: #fff; text-decoration: underline; }
.msg.order-error.shake { animation: errshake .45s; }
@keyframes errshake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
.err-toast { position: fixed; z-index: 1000; top: 12px; left: 50%; transform: translateX(-50%); width: min(92vw, 560px); display: flex; gap: 10px; align-items: center;
  padding: 12px 14px; border-radius: 12px; background: #b3261e; color: #fff; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, .5); }
.err-toast[hidden] { display: none; }
.err-toast span { flex: 1; font-size: 14.5px; line-height: 1.4; }
.err-toast button { background: transparent; border: 0; color: #fff; cursor: pointer; font-size: 16px; }

#checks.flash { animation: checkflash 1.6s ease-out 2; border-radius: 12px; }
@keyframes checkflash { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 80, .9); outline: 3px solid #ff5a50; } 100% { box-shadow: 0 0 0 18px rgba(255, 90, 80, 0); outline: 3px solid rgba(255, 90, 80, 0); } }

/* Calques de la face */
.layers { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.layers h3 { font-size: 15px; margin: 0 0 4px; }
.layers h3 span { color: var(--muted); font-weight: 400; }
.layers ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.layers .layer { display: flex; align-items: center; gap: 4px; border: 1px solid transparent; border-radius: 10px; padding: 2px; }
.layers .layer.on { border-color: var(--accent); background: rgba(212, 175, 95, .12); }
.layers .lname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; text-align: left; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 13.5px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.layers .lname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers .lname:hover { background: var(--surface-2); }
.layers .lbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.layers .lbtn:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.layers .lbtn:disabled { opacity: .3; cursor: default; }
.layers .empty { color: var(--muted); font-size: 13px; padding: 6px 8px; }
/* Alertes des vérifications : lien vers le calque ; et dans la liste des calques */
.checks .go { display: block; margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--accent); }
.checks li[data-pick]:hover { background: rgba(255, 255, 255, .06); }
.layers .layer.warn { background: rgba(240, 195, 109, .06); }
.layers .layer.error { background: rgba(255, 159, 159, .07); }
.layers .ltext { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.layers .lname .ltext .lmsg { white-space: normal; overflow: visible; font-size: 12px; line-height: 1.35; margin-top: 2px; }
.layers .lmsg.warn { color: var(--warn); }
.layers .lmsg.error { color: var(--danger); }
