/* =============================================================================
   SIMULADOR DE CABINA + DOSSIÊ PARA ASSEMBLEIA
   Elemento interativo exclusivo da Embelezart (Fase 3 do protocolo).
   Depende dos tokens de embelezart.css.
   ============================================================================= */

.sim {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}

/* ---------------------------------------------------- palco do desenho ---- */
.sim__stage {
  position: sticky;
  top: 96px;
  background: var(--surface-shaft);
  border: 1px solid var(--line-hairline-dk);
}
.sim__canvas { display: block; width: 100%; height: auto; background: #0B0C0E; }

.sim__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--line-hairline-dk);
}
.sim__code {
  font-family: var(--font-display);
  font-size: 1.32rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--action-primary);
  font-variant-numeric: tabular-nums;
}
.sim__codelabel {
  display: block;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--text-muted-shaft);
  margin-bottom: 5px;
}
.sim__nome { font-size: 13px; color: var(--text-on-shaft); text-align: right; }

.sim__nota {
  padding: 13px var(--s-4) var(--s-4);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-muted-shaft);
  border-top: 1px solid var(--line-hairline-dk);
}

/* referência fotográfica real ao lado do desenho */
.sim__ref { border-top: 1px solid var(--line-hairline-dk); padding: var(--s-3) var(--s-4) var(--s-4); }
.sim__ref img { width: 100%; border: 1px solid var(--line-hairline-dk); }
.sim__ref figcaption {
  margin-top: 10px;
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-muted-shaft);
  line-height: 1.5;
}

/* ---------------------------------------------------------- controles ---- */
.sim__controls { display: grid; gap: var(--s-5); }

.opt-group { border-top: 1px solid var(--line-hairline); padding-top: var(--s-3); }
.opt-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.opt-group__head h3 {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -.02em;
}
.opt-group__n {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--action-primary);
  font-variant-numeric: tabular-nums;
}

.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; background: var(--line-hairline); border: 1px solid var(--line-hairline); }

.opt {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px;
  background: var(--surface-hall);
  text-align: left;
  transition: background-color .3s ease;
}
.opt:hover { background: var(--surface-panel); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }

.opt__swatch {
  width: 100%;
  aspect-ratio: 5 / 3;
  border: 1px solid var(--line-hairline);
  transition: border-color .3s ease;
}
.opt__nome { font-size: 13px; font-weight: 600; line-height: 1.25; }
.opt__desc { font-size: 11.5px; line-height: 1.45; color: var(--text-secondary); }

.opt:has(input:checked) { background: var(--surface-panel); }
.opt:has(input:checked) .opt__swatch { border-color: var(--action-primary); border-width: 2px; }
.opt:has(input:checked) .opt__nome { color: var(--action-primary); }
.opt:has(input:focus-visible) { outline: 2px solid var(--action-primary); outline-offset: -2px; }

/* acessórios: lista com interruptor */
.toggles { display: grid; gap: 1px; background: var(--line-hairline); border: 1px solid var(--line-hairline); }
.toggle {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 15px var(--s-3);
  background: var(--surface-hall);
  transition: background-color .3s ease;
}
.toggle:hover { background: var(--surface-panel); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle__box {
  flex: none;
  width: 42px; height: 23px;
  background: var(--line-hairline);
  position: relative;
  transition: background-color .3s ease;
}
.toggle__box::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 17px; height: 17px;
  background: var(--surface-panel);
  transition: transform .32s var(--ease-cabin);
}
.toggle:has(input:checked) .toggle__box { background: var(--action-primary); }
.toggle:has(input:checked) .toggle__box::after { transform: translateX(19px); }
.toggle:has(input:focus-visible) { outline: 2px solid var(--action-primary); outline-offset: -2px; }
.toggle__txt strong { display: block; font-size: 14px; font-weight: 600; }
.toggle__txt span { display: block; font-size: 12px; color: var(--text-secondary); line-height: 1.45; margin-top: 3px; }

/* ------------------------------------------------------------ resultado --- */
.sim__out { border: 1px solid var(--line-hairline); background: var(--surface-panel); padding: var(--s-4); }
.sim__out h3 { font-size: 1.3rem; letter-spacing: -.02em; }
.ficha { margin-top: var(--s-3); border-top: 1px solid var(--line-hairline); }
.ficha div {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 11px 0;
  border-bottom: 1px solid var(--line-hairline);
  font-size: 13.5px;
}
.ficha dt { color: var(--text-secondary); text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; padding-top: 3px; }
.ficha dd { text-align: right; font-weight: 500; max-width: 62%; line-height: 1.4; }
.sim__acts { display: grid; gap: 11px; margin-top: var(--s-4); }

/* ------------------------------------------------------------- dossiê ----- */
.dossie { display: none; }
.dossie__logo { width: 210px; }

@media print {
  body > *:not(.dossie) { display: none !important; }
  .dossie {
    display: block !important;
    padding: 0;
    color: #000;
    font-size: 10.5pt;
    line-height: 1.5;
  }
  @page { size: A4; margin: 14mm 15mm; }
  .dossie__titulo { font-family: var(--font-display); font-weight: 800; font-size: 22pt; letter-spacing: -.03em; line-height: .95; margin-bottom: 4mm; }
  .dossie h2 { font-size: 12pt; margin: 6mm 0 2mm; letter-spacing: -.02em; }
  .dossie__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10mm; border-bottom: 1.5pt solid #000; padding-bottom: 4mm; margin-bottom: 5mm; }
  .dossie__cod { font-size: 14pt; font-weight: 800; font-family: var(--font-display); }
  .dossie__grid { display: grid; grid-template-columns: 62mm 1fr; gap: 8mm; align-items: start; }
  .dossie__canvas { width: 100%; border: .75pt solid #999; }
  .dossie table { width: 100%; border-collapse: collapse; }
  .dossie td { border-bottom: .5pt solid #bbb; padding: 2mm 0; vertical-align: top; font-size: 9.5pt; }
  .dossie td:first-child { width: 34mm; color: #555; text-transform: uppercase; font-size: 7.5pt; letter-spacing: .06em; padding-top: 2.6mm; }
  .dossie ol { margin: 2mm 0 0 5mm; }
  .dossie li { margin-bottom: 2mm; font-size: 9.5pt; }
  .dossie__foot { margin-top: 6mm; border-top: 1pt solid #000; padding-top: 3mm; font-size: 8.5pt; display: flex; justify-content: space-between; gap: 6mm; }
  .dossie__orc { margin-top: 5mm; border: .75pt solid #000; padding: 4mm; }
  .dossie__orc div { border-bottom: .5pt solid #777; height: 7mm; margin-top: 3mm; }
}

/* ------------------------------------------------------------ desktop ----- */
@media (min-width: 1000px) {
  .sim { grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); gap: var(--s-6); }
}
