/* =========================================================
   WD RACING — CONFIGURATORE (MODAL LOOK)
   Obiettivo: simile al sito WD Racing
   - Header dark
   - accenti rossi
   - cards bianche
   - CTA verde (Aggiungi al carrello)
   - layout pulito + responsive
   ========================================================= */

:root{
  /* brand */
  --wd-black: #111214;
  --wd-black-2:#1b1c1f;
  --wd-red:   #e31e24;
  --wd-green: #57b26a;

  /* UI neutrals */
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-2:#fafafa;
  --text: #121316;
  --muted:#6b7280;
  --stroke: rgba(0,0,0,.10);

  --radius: 18px;
  --radius-sm: 12px;

  --shadow-lg: 0 28px 70px rgba(0,0,0,.22);
  --shadow-md: 0 14px 35px rgba(0,0,0,.12);

  --focus: rgba(227,30,36,.35);
}

/* reset */
*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Roboto Condensed", sans-serif;
  background: transparent; /* importante se in iframe/modal */
  color: var(--text);
}
body,
button,
input,
select,
label,
.card h3,
.slotTitle,
.smallNote,
.warn,
#statusLine,
.finishFlag,
.swatch {
  font-family: "Roboto Condensed", sans-serif;
}

/* =========================================================
   Modal container
   ========================================================= */
.layout{
  height: 92vh;
  max-height: 940px;
  width: min(1380px, calc(100vw - 40px));
  margin: 20px auto;
  border: 1px solid rgba(0,0,0,.12);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display:flex;
  flex-direction:column;
}

/* =========================================================
   Topbar (dark, WD-like)
   ========================================================= */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--wd-black) 0%, var(--wd-black-2) 100%);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand{
  display:flex;
  flex-direction:column;
  gap: 2px;
}
.brand h1{
  margin:0;
  font-size:16px;
  font-weight:800;
  letter-spacing:.2px;
  color:#fff;
}
.brand p{
  margin:0;
  font-size:12px;
  color: rgba(255,255,255,.70);
}

/* red underline accent (come “separatore” brand) */
.topbar::after{
  content:"";
  display:block;
  position:absolute;
  left:0;
  right:0;
  height:3px;
  bottom:0;
  background: var(--wd-red);
  opacity:.95;
}

/* serve perché ::after è absolute */
.topbar{ position:relative; }

.brand{
  display:flex;
  flex-direction: column; /* logo sopra testo */
  align-items: flex-start;
  gap: 6px;
}

.wdTopLogo{
  height: 25px;
  width: auto;
  display:block;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.closeBtn{
  width:44px;height:44px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color:#fff;
  cursor:pointer;
  font-size:20px;
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: transform .08s ease, background .15s ease;
}
.closeBtn:hover{ background: rgba(255,255,255,.10); }
.closeBtn:active{ transform: scale(.98); }
.closeBtn:focus{ outline: 3px solid var(--focus); outline-offset: 2px; }

/* =========================================================
   Main content split
   ========================================================= */
.content{
  flex:1;
  display:flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  min-height:0;
}

/* left column */
.sidebar{
  width: 370px;
  min-width: 340px;
  overflow:auto;
  padding-right: 10px;
}

/* scroll look */
.sidebar::-webkit-scrollbar{ width: 10px; }
.sidebar::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,.12);
  border: 2px solid rgba(255,255,255,.55);
}
.sidebar::-webkit-scrollbar-track{ background: transparent; }

/* =========================================================
   Cards
   ========================================================= */
.card{
  background: var(--panel);
  border: 1px solid var(--stroke);
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.06);
}

.card h3{
  margin:0 0 10px;
  font-size:13px;
  font-weight:800;
  letter-spacing:.2px;
  color: #111;
  text-transform: none;
}

/* small red divider under titles (WD vibe) */
.card h3::after{
  content:"";
  display:block;
  height:2px;
  width:52px;
  background: var(--wd-red);
  margin-top:8px;
  opacity:.9;
}

label{
  display:block;
  font-size:12px;
  color: var(--muted);
  margin: 10px 0 6px;
}

input, select{
  width:100%;
  padding: 11px 12px;
  border: 1px solid rgba(0,0,0,.12);
  background:#fff;
  outline:none;
  transition: box-shadow .15s ease, border-color .15s ease;
}
input:focus, select:focus{
  border-color: rgba(227,30,36,.35);
  box-shadow: 0 0 0 4px var(--focus);
}

.smallNote{
  font-size:12px;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.35;
}

/* =========================================================
   Palettes / swatches
   ========================================================= */
.palRow{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin: 8px 0 10px;
}

.swatch{
  width: 24px;
  height: 24px;
  border: 2px solid rgba(0,0,0,.14);
  cursor:pointer;
  padding:0;
  box-shadow: 0 2px 6px rgba(0,0,0,.10);
  transition: transform .08s ease, box-shadow .12s ease;
}
.swatch:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,.14);
}
.swatch.selected{
  outline: 3px solid rgba(227,30,36,.40);
  outline-offset: 2px;
  border-color: rgba(0,0,0,.22);
}

.warn{
  font-size:12px;
  color: #b45309;
  margin-top: 6px;
}

.slotBlock{
  margin-bottom: 14px;
}

.slotTitle{
  display:block;
  font-size:12px;
  color: var(--muted);
  margin: 10px 0 6px;
}

.finishFlags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin: 6px 0 10px;
}

.finishFlag{
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  color: #222;
  font-size: 12px;
  line-height: 1;
  padding: 8px 10px;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
}

.finishFlag:hover{
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.finishFlag.selected{
  border-color: rgba(227,30,36,0.45);
  box-shadow: 0 0 0 3px rgba(227,30,36,0.12);
  font-weight: 700;
}

/* =========================================================
   Actions
   ========================================================= */
.actions{
  padding: 8px 0 0;
}

#addToCartBtn{
  width:100%;
  padding: 13px 14px;
  border: 0;
  background: var(--wd-green);
  color:#fff;
  font-weight: 800;
  letter-spacing: .2px;
  cursor:pointer;
  box-shadow: 0 10px 20px rgba(87,178,106,.25);
  transition: transform .08s ease, filter .15s ease, opacity .15s ease;
}
#addToCartBtn:hover{ filter: brightness(1.05); }
#addToCartBtn:active{ transform: scale(.99); }
#addToCartBtn:disabled{
  opacity:.6;
  cursor:not-allowed;
  box-shadow:none;
}

#statusLine{
  font-size:12px;
  color: var(--muted);
  margin-top: 10px;
}

/* =========================================================
   Viewer (right side)
   ========================================================= */
.viewer{
  flex:1;
  min-width:0;
  display:flex;
  align-items:stretch;
  justify-content:center;
}

.viewer-card{
  width:100%;
  border: 1px solid rgba(0,0,0,.10);
  background: var(--panel);
  padding: 14px;
  box-shadow: var(--shadow-md);
  min-height:0;
  display:flex;
  align-items:stretch;
  justify-content:center;
}

/* white stage like product page */
.viewer-inner{
  width:100%;
  height: min(74vh, 780px);
  min-height: 480px;
  background: #ffffff;
  display:flex;
  align-items:center;
  justify-content:center;

  overflow: visible; /* evita tagli */
  padding: 12px;
  border: 1px solid rgba(0,0,0,.08);
}

/* canvas fills the stage (your JS manages real pixel size) */
#seatCanvas{
  width:100%;
  height:100%;
  display:block;
  background:#fff;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px){
  .layout{
    width: calc(100vw - 24px);
    margin: 12px auto;
    height: 94vh;
  }
  .sidebar{
    width: 340px;
    min-width: 320px;
  }
}

@media (max-width: 920px){
  .content{
    flex-direction: column;
    padding: 12px;
  }
  .sidebar{
    width: 100%;
    min-width: 0;
    max-height: 42vh;
    padding-right: 0;
  }
  .viewer-inner{
    height: min(52vh, 560px);
    min-height: 360px;
  }
}

@media (max-width: 520px){
  .topbar{
    padding: 12px 12px;
  }
  .closeBtn{
    width: 40px;
    height: 40px;
  }
  .card{
    padding: 12px;
  }
  input, select{
    padding: 10px 11px;
  }
}

.finishFlags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin: 6px 0 14px;
}

.finishFlag{
  border:1px solid rgba(0,0,0,.12);
  background:#fff;
  padding:8px 10px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  transition: all .15s ease;
}

.finishFlag:hover{
  border-color: rgba(227,30,36,.35);
}

.finishFlag.selected{
  background:#111214;
  color:#fff;
  border-color:#111214;
}