/* ================================================================
   SETUP-TABS.CSS — Painel único com abas para páginas de setup
   Prefixo: stab-   |   Stack: HTML/CSS/JS puro
================================================================ */

/* ── Variáveis do componente (escopo local) ───────────────── */
.stab-section {
  --stab-bg:       #0a0a0a;
  --stab-bg2:      #111111;
  --stab-surface:  #1a1a1a;
  --stab-surface2: #222222;
  --stab-line:     #2a2a2a;
  --stab-orange:   #ff6d1f;
  --stab-orange2:  #ff9445;
  --stab-gold:     #e8c45f;
  --stab-gold2:    #f3d98a;
  --stab-text:     #f0f0f0;
  --stab-muted:    #aaaaaa;
  --stab-muted2:   #777777;
  --stab-pix:      #32c08a;
  --stab-green:    #1faa54;
  --stab-font-t:   'Sora', 'Manrope', sans-serif;
  --stab-font-b:   'Manrope', sans-serif;
}

/* ── Seção ────────────────────────────────────────────────── */
.stab-section {
  background: var(--stab-bg2);
  padding: var(--space-12) 0 calc(var(--space-12) + 80px);
}

/* ── Layout 2 colunas ─────────────────────────────────────── */
.stab-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 34px;
  align-items: start;
}

/* ── Viewer (esquerda, sticky) ───────────────────────────── */
.stab-viewer {
  position: sticky;
  top: calc(var(--navbar-height, 56px) + 16px);
  min-width: 0;   /* impede item de grid de extrapolar a coluna */
  width: 100%;
}

.stab-stage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

/* Imagem principal — idêntica à galeria superior das páginas de produto */
.stab-gallery__main {
  background: #f0f0f0;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 1;
  width: 100%;        /* âncora a largura antes do aspect-ratio */
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,.5);
}

.stab-gallery__main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: opacity .22s ease;
}

/* Miniaturas */
.stab-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.stab-thumb {
  background: #f0f0f0;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s ease, opacity .2s ease;
  opacity: 0.62;
  padding: 4px;
}

.stab-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.stab-thumb:hover  { opacity: 0.85; }

.stab-thumb.is-active {
  border-color: var(--stab-gold);
  opacity: 1;
}

/* Caption abaixo das miniaturas */
.stab-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}

.stab-caption__name {
  font-family: var(--stab-font-t);
  font-weight: 600;
  font-size: 13px;
  color: var(--stab-text);
}

.stab-caption__plat {
  font-size: 11px;
  color: var(--stab-muted);
}

/* ── Coluna direita ──────────────────────────────────────── */
.stab-right {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Seletor de configuração (multi-opção) ───────────────── */
.stab-config-selector {
  margin-bottom: 4px;
}

.stab-config__label {
  font-family: var(--stab-font-b);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--stab-gold);
  margin-bottom: 10px;
}

.stab-config-opts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stab-config-opt {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--stab-line);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s, background .2s;
}

.stab-config-opt:hover:not(.is-active) {
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
}

.stab-config-opt.is-active {
  border-color: rgba(232,196,95,.5);
  background: rgba(232,196,95,.07);
}

.stab-config-opt__label {
  font-family: var(--stab-font-b);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--stab-gold);
}

.stab-config-opt__desc {
  font-family: var(--stab-font-b);
  font-size: 12px;
  color: var(--stab-muted);
  line-height: 1.45;
}

/* ── Já incluso ──────────────────────────────────────────── */
.stab-incl {
  background: var(--stab-surface);
  border: 1px solid var(--stab-line);
  border-radius: 16px;
  padding: 18px 20px;
}

.stab-incl__title {
  font-family: var(--stab-font-t);
  font-weight: 600;
  font-size: 13px;
  color: var(--stab-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 12px;
}

.stab-incl__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.stab-incl__list li {
  font-family: var(--stab-font-b);
  font-size: 13px;
  color: var(--stab-text);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.4;
}

.stab-incl__ic {
  color: var(--stab-gold);
  font-size: 10px;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Painel com abas ─────────────────────────────────────── */
.stab-panel {
  background: var(--stab-surface);
  border: 1px solid var(--stab-line);
  border-radius: 20px;
  padding: 8px 8px 22px;
}

.stab-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px;
  border-bottom: 1px solid var(--stab-line);
  scrollbar-width: thin;
  scrollbar-color: var(--stab-line) transparent;
}

.stab-tab {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--stab-font-b);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--stab-muted);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s;
}

.stab-tab:hover { color: var(--stab-text); }

.stab-tab.is-active {
  background: var(--stab-gold);
  color: #1a1206;
  border-color: var(--stab-gold);
  font-weight: 700;
}

.stab-tab.is-done::after {
  content: " ✓";
  font-size: 10px;
  color: var(--stab-gold);
  font-weight: 700;
}

.stab-tab.is-active.is-done::after { color: #1a1206; }

@keyframes stabTabPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,196,95,0); }
  50%       { box-shadow: 0 0 0 3px rgba(232,196,95,.4); }
}

.stab-tab.is-pulse:not(.is-active) { animation: stabTabPulse 1.5s ease-in-out infinite; }

.stab-tab__icon {
  display: flex;
  align-items: center;
  opacity: 0.75;
}

/* ── Barra de progresso ──────────────────────────────────── */
.stab-prog {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 0;
  font-family: var(--stab-font-b);
  font-size: 11px;
  color: var(--stab-muted2);
}

.stab-prog__bar {
  flex: 1;
  height: 3px;
  background: var(--stab-line);
  border-radius: 3px;
  overflow: hidden;
}

.stab-prog__fill {
  display: block;
  height: 100%;
  width: 20%;
  background: var(--stab-gold);
  transition: width .3s ease;
}

/* ── Panes ───────────────────────────────────────────────── */
.stab-tab-content { padding: 16px 14px 0; }

.stab-pane { display: none; }

.stab-pane.is-active {
  display: block;
  animation: stabFade .2s ease;
}

@keyframes stabFade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.stab-pane__label {
  font-family: var(--stab-font-t);
  font-size: 14px;
  font-weight: 600;
  color: var(--stab-text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stab-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--stab-gold);
  border: 1px solid rgba(232,196,95,.35);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ── Swatches ────────────────────────────────────────────── */
.stab-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.stab-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--stab-line);
  transition: transform .15s, border-color .15s, box-shadow .15s;
  flex-shrink: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
}

.stab-swatch:hover { transform: scale(1.1); }

.stab-swatch.is-active {
  border-color: var(--stab-orange);
  box-shadow: 0 0 0 2px var(--stab-surface), 0 0 0 4px var(--stab-orange);
}

.stab-cor-cap {
  font-family: var(--stab-font-b);
  font-size: 12.5px;
  color: var(--stab-muted);
  margin-top: 4px;
  min-height: 18px;
}

.stab-cor-cap b    { color: var(--stab-text); font-weight: 600; }
.stab-cor-cap .stab-pos  { color: var(--stab-gold); }
.stab-cor-cap .stab-neg  { color: #7fd6a0; }
.stab-cor-cap .stab-same { color: var(--stab-muted2); }

/* ── Chips / pílulas ─────────────────────────────────────── */
.stab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.stab-chip {
  background: var(--stab-bg2);
  border: 1px solid var(--stab-line);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: var(--stab-font-b);
  font-size: 13px;
  font-weight: 600;
  color: var(--stab-muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.stab-chip:hover {
  color: var(--stab-text);
  border-color: var(--stab-orange2);
}

.stab-chip.is-active {
  background: transparent;
  border-color: var(--stab-orange);
  color: var(--stab-orange);
}

.stab-chip__price {
  font-size: 11px;
  font-weight: 700;
  opacity: .82;
}

.stab-chip.is-active .stab-chip__price { opacity: 1; }

.stab-chip__inc {
  font-size: 9.5px;
  font-weight: 700;
  opacity: .55;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stab-chip.is-active .stab-chip__inc { opacity: 1; }

@keyframes stabChipFlash {
  0%   { box-shadow: 0 0 0 0 rgba(255,109,31,0); }
  22%  { box-shadow: 0 0 0 3px rgba(255,109,31,.5), 0 0 16px 4px rgba(255,109,31,.6); }
  100% { box-shadow: 0 0 0 0 rgba(255,109,31,0); }
}

.stab-chip.flash { animation: stabChipFlash .5s ease-out; }

/* ── Resumo / Pagamento ──────────────────────────────────── */
.stab-summary {
  background: var(--stab-surface);
  border: 1px solid var(--stab-line);
  border-radius: 18px;
  padding: 20px;
}

.stab-coupon-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.stab-cup-input {
  flex: 1;
  background: var(--stab-bg2);
  border: 1px solid var(--stab-line);
  border-radius: 11px;
  padding: 11px 14px;
  color: var(--stab-text);
  font-family: var(--stab-font-b);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
  min-width: 0;
}

.stab-cup-input:focus { border-color: var(--stab-orange2); }
.stab-cup-input::placeholder { color: var(--stab-muted2); }

.stab-cup-apply {
  background: transparent;
  border: 1px solid var(--stab-line);
  border-radius: 11px;
  padding: 10px 16px;
  color: var(--stab-text);
  font-family: var(--stab-font-b);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}

.stab-cup-apply:hover { border-color: var(--stab-gold); color: var(--stab-gold); }

.stab-cup-msg {
  font-family: var(--stab-font-b);
  font-size: 12px;
  margin-bottom: 4px;
  min-height: 16px;
}

.stab-cup-remove {
  background: none;
  border: none;
  font-family: var(--stab-font-b);
  font-size: 12px;
  color: var(--stab-muted);
  cursor: pointer;
  padding: 0;
  margin-bottom: 8px;
  transition: color .15s;
  display: block;
}

.stab-cup-remove:hover { color: var(--stab-text); }

/* Linhas de valores */
.stab-sum-rows {
  border-top: 1px solid var(--stab-line);
  padding-top: 10px;
  margin-top: 8px;
}

.stab-srow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--stab-font-b);
  font-size: 13px;
  color: var(--stab-muted);
  padding: 5px 0;
}

.stab-srow--disc .stab-srow__v { color: #7fd6a0; }

.stab-srow--total {
  padding: 10px 0 4px;
  border-top: 1px solid var(--stab-line);
  margin-top: 4px;
}

.stab-srow--total .stab-srow__k {
  font-family: var(--stab-font-t);
  font-weight: 600;
  font-size: 15px;
  color: var(--stab-text);
}

.stab-srow--total .stab-srow__v {
  font-family: var(--stab-font-t);
  font-weight: 800;
  font-size: 24px;
  color: var(--stab-text);
}

.stab-inst {
  font-family: var(--stab-font-b);
  font-size: 12.5px;
  color: var(--stab-muted);
  margin-top: 8px;
}

.stab-inst strong { color: var(--stab-gold2); }

/* Pix */
.stab-pixbox {
  background: linear-gradient(135deg, rgba(50,192,138,.14), rgba(50,192,138,.04));
  border: 1px solid rgba(50,192,138,.34);
  border-radius: 13px;
  padding: 13px 16px;
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stab-pixbox__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stab-pixbox__label {
  font-family: var(--stab-font-b);
  font-size: 12px;
  color: var(--stab-pix);
  font-weight: 700;
}

.stab-pixbox__sub {
  font-family: var(--stab-font-b);
  font-size: 10.5px;
  color: var(--stab-muted);
  font-weight: 500;
}

.stab-pixbox__val {
  font-family: var(--stab-font-t);
  font-weight: 800;
  font-size: 20px;
  color: var(--stab-pix);
}

/* Botões de ação */
.stab-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.stab-btn-wpp {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--stab-green);
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 13px 20px;
  font-family: var(--stab-font-b);
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter .18s, transform .18s;
  white-space: nowrap;
}

.stab-btn-wpp:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.stab-btn-pdf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--stab-line);
  border-radius: 11px;
  padding: 12px 16px;
  color: var(--stab-muted);
  font-family: var(--stab-font-b);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  white-space: nowrap;
}

.stab-btn-pdf:hover { border-color: var(--stab-gold); color: var(--stab-gold); }

.stab-deliv {
  font-family: var(--stab-font-b);
  font-size: 11.5px;
  color: var(--stab-muted2);
  text-align: center;
  margin-top: 12px;
}

/* ── Rodapé do painel (botão Próximo) ────────────────────── */
.stab-pfoot {
  padding: 16px 14px 4px;
  display: flex;
  justify-content: flex-end;
}

.stab-next-btn {
  font-family: var(--stab-font-b);
  font-size: 12.5px;
  font-weight: 700;
  color: #1a1206;
  background: linear-gradient(135deg, var(--stab-gold), var(--stab-gold2));
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: filter .15s, transform .15s;
  white-space: nowrap;
}

.stab-next-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ── Bar: Pix label ──────────────────────────────────────── */
.stab-bar__pix {
  color: #32c08a !important;
  font-weight: 600 !important;
}

/* ── Responsivo ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .stab-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .stab-viewer { position: static; }

  .stab-tab-content { padding: 16px 10px 0; }

  .stab-gallery__main { border-radius: 14px; }

  .stab-gallery__thumbs { gap: 6px; }
}

@media (max-width: 480px) {
  .stab-srow--total .stab-srow__v { font-size: 20px; }
  .stab-pixbox__val { font-size: 18px; }
  .stab-btn-wpp { font-size: 13px; }

  .stab-thumb { border-radius: 8px; padding: 3px; }
}

/* ── Mobile fine-tuning (≤767px) ────────────────────────── */
@media (max-width: 767px) {
  /* Galeria do configurador: containment total */
  .stab-viewer,
  .stab-stage,
  .stab-gallery__main,
  .stab-gallery__thumbs {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
  }
  .stab-gallery__main-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    transform: none;
  }
  .stab-thumb {
    min-width: 0;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* Chips: fonte menor, padding menor */
  .stab-chip { font-size: 12.5px; padding: 9px 14px; }

  /* Botão Próximo: largura total para fácil toque */
  .stab-pfoot { justify-content: stretch; padding: 12px 10px 4px; }
  .stab-next-btn {
    width: 100%;
    display: flex;
    justify-content: center;
    font-size: 13px;
    padding: 11px 16px;
  }

  /* Sumário: padding lateral menor */
  .stab-summary { padding: 16px 14px; }

  /* Painel: menos padding lateral */
  .stab-panel { padding: 6px 6px 18px; }
  .stab-tab-content { padding: 14px 8px 0; }

  /* Progress bar: fonte menor */
  .stab-prog { font-size: 10.5px; padding: 8px 12px 0; }

  /* Swatches: tamanho confortável no touch */
  .stab-swatch { width: 30px; height: 30px; }
}

/* ── 390px e abaixo ─────────────────────────────────────── */
@media (max-width: 390px) {
  .stab-gallery__thumbs { gap: 4px; }
  .stab-thumb { padding: 2px; border-radius: 7px; }

  /* Chips ainda mais compactos */
  .stab-chip { font-size: 12px; padding: 8px 12px; gap: 6px; }
  .stab-chip__price { font-size: 10px; }

  /* Sumário: padding mínimo */
  .stab-summary { padding: 14px 12px; }

  /* Pixbox mais compacto */
  .stab-pixbox { padding: 10px 12px; }
  .stab-pixbox__val { font-size: 17px; }
}
