/* =========================================================
   MACROTEC — configuratore
   ========================================================= */
.conf-intro { padding: calc(var(--header-h) + 64px) 0 48px; background: var(--bg-soft); text-align: center; }
.conf-intro .lead { margin-bottom: 0; }

.steps-bar {
  position: sticky; top: var(--header-h); z-index: 50; background: #fff; border-bottom: 1px solid var(--line);
}
.steps-bar ol {
  list-style: none; margin: 0 auto; padding: 14px 24px; max-width: 1400px;
  display: flex; justify-content: space-between; gap: 8px; overflow-x: auto; scrollbar-width: none;
}
.steps-bar ol::-webkit-scrollbar { display: none; }
.steps-bar button {
  border: 0; background: none; cursor: pointer; white-space: nowrap;
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink);
  padding: 7px 16px; border-radius: 30px; transition: background .2s, color .2s;
}
.steps-bar button:hover { color: var(--accent); }
.steps-bar button[aria-current="step"] { background: var(--accent); color: #fff; }
.steps-bar button.done::after { content: " ✓"; color: var(--accent); }
.steps-bar button[aria-current="step"].done::after { color: #fff; }

.conf { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(360px, 1fr); background: var(--bg-soft); }
.conf-stage {
  position: sticky; top: calc(var(--header-h) + 58px); align-self: start;
  height: calc(100vh - var(--header-h) - 58px); display: flex; flex-direction: column; background: #dfe2e4;
}
.conf-preview { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.conf-preview svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.conf-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: #fff; border-top: 1px solid var(--line); font-size: 14px;
}
.conf-toolbar .title { font-weight: 700; }
.conf-toolbar .title span { font-weight: 400; color: var(--ink-soft); }
.tool-btns { display: flex; gap: 6px; }
.tool-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 30px; cursor: pointer;
  padding: 7px 14px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center;
}
.tool-btn:hover { border-color: var(--accent); color: var(--accent); }
.tool-btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.conf-panel { padding: 36px 36px 48px; background: #fff; min-height: calc(100vh - var(--header-h) - 58px); }
.step { display: none; animation: fadeStep .35s ease; }
.step.active { display: block; }
@keyframes fadeStep { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.step > h2 { font-size: 28px; font-weight: 300; color: var(--title); margin: 0 0 6px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.step > h2 b { font-weight: 700; color: var(--accent); margin-right: 6px; }
.group { margin-top: 28px; }
.group > h3 { font-size: 17px; margin: 0 0 12px; }
.group > h3 small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.hint { font-size: 14px; color: var(--ink-soft); margin: 10px 0 0; }
.warn { font-size: 14px; color: #8a5a00; background: #fff6df; border-radius: var(--radius); padding: 10px 12px; margin: 12px 0 0; }

/* opzioni a scheda */
.opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.opts--wide { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.opts--list { grid-template-columns: 1fr; }
.opt {
  position: relative; border: 1.5px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer;
  padding: 10px; text-align: center; font-size: 14px; color: var(--ink); transition: border-color .2s, box-shadow .2s;
  display: flex; flex-direction: column; align-items: center; gap: 8px; font-family: inherit;
}
.opt:hover { border-color: #aab4be; }
.opt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt[aria-checked="true"]::after {
  content: "✓"; position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; line-height: 20px; text-align: center;
}
.opt[disabled] { opacity: .4; cursor: not-allowed; }
.opt .pic { width: 100%; aspect-ratio: 4/3; border-radius: 4px; display: flex; align-items: center; justify-content: center; background: #eef0f2; overflow: hidden; }
.opt .pic svg { width: 84%; height: auto; }
.opt .pic.track svg { width: 100%; }
.opt .name { font-weight: 700; }
.opt .sub { font-size: 12.5px; color: var(--ink-soft); line-height: 1.4; }
.opt--row { flex-direction: row; text-align: left; align-items: center; gap: 14px; padding: 12px 14px; }
.opt--row .txt { flex: 1; }
.tex { width: 100%; aspect-ratio: 1; border-radius: 4px; border: 1px solid rgba(0,0,0,.08); }

/* colori */
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 12px 8px; }
.color {
  border: 0; background: none; cursor: pointer; padding: 0; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); line-height: 1.25;
}
.color i { width: 48px; height: 48px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); display: block; transition: box-shadow .2s; }
.color[aria-checked="true"] i { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--accent); }
.color[aria-checked="true"] { color: var(--ink); font-weight: 700; }
.color[disabled] { opacity: .3; cursor: not-allowed; }

/* misure */
.dim { display: grid; grid-template-columns: 1fr 110px; gap: 16px; align-items: center; margin-bottom: 16px; }
.dim label { font-size: 14px; font-weight: 700; display: block; margin-bottom: 4px; }
.dim input[type=range] { width: 100%; accent-color: var(--accent); }
.dim .num { display: flex; align-items: center; border: 1px solid #cfd3d7; border-radius: var(--radius); overflow: hidden; }
.dim .num input { width: 100%; border: 0; padding: 10px; font: inherit; font-size: 16px; text-align: right; }
.dim .num span { padding: 0 10px; color: var(--ink-soft); font-size: 14px; }

/* interruttori accessori */
.toggle { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.toggle .txt { flex: 1; font-size: 15px; }
.toggle .txt small { display: block; color: var(--ink-soft); font-size: 13px; }
.toggle input { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #cfd4d8; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(18px); }
.toggle input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.qty { display: flex; align-items: center; gap: 0; border: 1px solid #cfd3d7; border-radius: 30px; overflow: hidden; }
.qty button { width: 34px; height: 32px; border: 0; background: #fff; cursor: pointer; font-size: 18px; color: var(--ink); }
.qty output { width: 28px; text-align: center; font-weight: 700; }

/* navigazione fra i passaggi */
.step-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }

/* riepilogo */
.summary { width: 100%; border-collapse: collapse; font-size: 15px; }
.summary th, .summary td { padding: 10px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.summary th { color: var(--ink-soft); font-weight: 400; width: 42%; }
.summary td { font-weight: 700; }
.summary td a { font-weight: 400; font-size: 13px; margin-left: 6px; }
.conf-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg-soft); border-radius: var(--radius); padding: 12px 14px; margin: 20px 0; font-size: 14px; }
.conf-code code { font-size: 15px; font-weight: 700; letter-spacing: .06em; }
.summary-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.disclaimer { font-size: 12.5px; color: var(--ink-soft); margin-top: 22px; line-height: 1.5; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--bg-dark); color: #fff; padding: 12px 20px; border-radius: 30px; font-size: 14px; transition: .3s; z-index: 300;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1020px) {
  .conf { grid-template-columns: 1fr; }
  .conf-stage { top: calc(var(--header-h) + 58px); height: 42vh; z-index: 20; }
  .conf-panel { min-height: 0; padding: 28px 16px 40px; }
  /* Indietro/Avanti sempre raggiungibili: altrimenti l'anteprima fissa li copre a fine passaggio */
  .step-nav:not(.step-nav--fine) { position: sticky; bottom: 0; z-index: 30; background: #fff; margin-top: 28px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 16px -12px rgba(0,0,0,.25); }
  .conf-toolbar { padding: 8px 12px; }
  .conf-toolbar .title { font-size: 13px; }
}
@media (max-width: 760px) {
  .conf-stage { height: 34vh; }
  .conf-toolbar .title { display: none; }
  .tool-btns { width: 100%; justify-content: center; }
  .dim { grid-template-columns: 1fr 96px; }
}

@media print {
  .site-header, .menu-panel, .steps-bar, .conf-intro, .site-footer, .conf-toolbar, .step-nav, .summary-actions, .quote-form, .toast { display: none !important; }
  .conf { display: block; background: #fff; }
  .conf-stage { position: static; height: auto; background: #fff; }
  .conf-preview svg { height: auto; }
  .step { display: none !important; }
  .step[data-step="7"] { display: block !important; }
  .conf-panel { padding: 16px 0; }
}

/* Spazi intorno al foro: schema di rilievo MACROTEC e campi in cm */
.ril { display: grid; gap: 14px; }
.ril-disegno { width: 100%; height: auto; background: #f6f7f8; border: 1px solid var(--line); border-radius: var(--radius); }
.ril-disegno .ril-tit { font-weight: 700; font-size: 11px; letter-spacing: .12em; fill: var(--ink-soft); text-anchor: middle; }
.ril-disegno .ril-nota { font-size: 11px; fill: var(--ink-soft); text-anchor: middle; }
.ril-disegno .ril-soffitto { fill: #9aa1a8; }
.ril-disegno .ril-muro { fill: #e2e5e8; }
.ril-disegno .ril-foro { fill: #fff; stroke: #8a9199; stroke-width: 1.5; }
.ril-disegno .ril-pannelli { stroke: #d5d9dd; stroke-width: 1; fill: none; }
.ril-disegno .ril-pavimento { stroke: #5d646b; stroke-width: 3; }
.ril-disegno .ril-ostacolo { fill: #9aa1a8; }
.ril-disegno .ril-anta { stroke: #8a9199; stroke-width: 4; stroke-dasharray: 2 5; fill: none; }
.ril-disegno .ril-rif { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 3; }
.ril-disegno .ril-mis { stroke: var(--accent); stroke-width: 2; }
.ril-disegno .ril-punta { fill: var(--accent); }
.ril-disegno .ril-q circle { fill: var(--accent); }
.ril-disegno .ril-q text { fill: #fff; font-weight: 700; font-size: 13px; text-anchor: middle; }
.ril-disegno .ril-q { transition: opacity .2s; }
.ril-disegno.focus .ril-q { opacity: .25; }
.ril-disegno.focus .ril-q.on { opacity: 1; }
.ril-campi { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ril-campo { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; gap: 6px 10px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: text; }
.ril-campo:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ril-lettera { grid-row: 1 / 3; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.ril-testo b { display: block; font-size: 14px; }
.ril-testo small { display: block; font-size: 12px; line-height: 1.35; color: var(--ink-soft); }
.ril-valore { display: flex; align-items: baseline; gap: 6px; border-bottom: 2px solid #cfd3d7; }
.ril-campo:focus-within .ril-valore { border-color: var(--accent); }
.ril-valore input { width: 100%; border: 0; padding: 4px 0; font: inherit; font-size: 18px; font-weight: 700; background: transparent; outline: none; }
.ril-valore i { font-style: normal; font-size: 13px; color: var(--ink-soft); }
@media (max-width: 560px) { .ril-campi { grid-template-columns: 1fr; } }

/* Casella del consenso comoda da toccare anche col dito */
.quote-form .check input[type=checkbox], .form .check input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px; accent-color: var(--accent, #1f5fa0); }
