/* ============================================================
   BAR DO JOTA — Design system (base compartilhada)
   Tokens de marca, reset, tipografia e componentes usados pelo
   site publico (tema noite) e pelo painel (tema claro).
   ============================================================ */

@font-face {
  font-family: "Anton";
  src: url("../fonts/anton-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- Marca (paleta bruta) ---- */
  --jota-noite: #1B0507;
  --jota-noite-2: #240709;
  --jota-vinho: #3A0A0E;
  --jota-vinho-2: #5A1218;
  --jota-vinho-3: #7A1A22;
  --jota-laranja: #F08A24;
  --jota-laranja-2: #FFA544;
  --jota-laranja-escuro: #B4560C;
  --jota-creme: #F6E7C8;
  --jota-papel: #F6F2EC;
  --jota-tinta: #24110F;
  --jota-verde: #1E9E5A;
  --jota-verde-claro: #5FD08A;
  --jota-vermelho: #C2362B;
  --jota-ambar: #B7791F;

  /* ---- Tipografia ---- */
  --fonte-display: "Anton", Impact, "Arial Narrow", sans-serif;
  --fonte-texto: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* ---- Espacamento (escala de 4) ---- */
  --e-1: 4px;  --e-2: 8px;  --e-3: 12px; --e-4: 16px; --e-5: 20px;
  --e-6: 24px; --e-8: 32px; --e-10: 40px; --e-12: 48px; --e-16: 64px; --e-20: 80px;

  /* ---- Raios ---- */
  --raio-sm: 10px;
  --raio: 14px;
  --raio-lg: 20px;
  --raio-xl: 28px;
  --raio-pilula: 999px;

  /* ---- Movimento ---- */
  --curva: cubic-bezier(.2, .7, .2, 1);
  --rapido: 140ms;
  --medio: 240ms;

  /* ---- Alvo de toque minimo ---- */
  --toque: 44px;

  --largura: 1180px;
}

/* ------------------------------------------------ Reset enxuto */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--fonte-texto);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--fundo);
  color: var(--texto);
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { line-height: 1.15; text-wrap: balance; }
p { text-wrap: pretty; }
[hidden] { display: none !important; }

.icone { width: 20px; height: 20px; flex: none; }
.icone-sm { width: 16px; height: 16px; flex: none; }
.icone-lg { width: 24px; height: 24px; flex: none; }

/* ------------------------------------------------ Acessibilidade */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.pular-link {
  position: absolute; left: 12px; top: -60px; z-index: 1000;
  padding: 10px 16px; border-radius: var(--raio-sm);
  background: var(--jota-laranja); color: var(--jota-noite); font-weight: 800; text-decoration: none;
  transition: top var(--rapido);
}
.pular-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--foco, var(--jota-laranja));
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------ Botoes */
.btn {
  --btn-bg: var(--jota-laranja);
  --btn-cor: var(--jota-noite);
  --btn-borda: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--toque);
  padding: 11px 20px;
  border: 1.5px solid var(--btn-borda);
  border-radius: var(--raio);
  background: var(--btn-bg);
  color: var(--btn-cor);
  font-weight: 750; font-size: 15px; line-height: 1.2; letter-spacing: -.005em;
  text-decoration: none; text-align: center; white-space: nowrap;
  transition: transform var(--rapido) var(--curva), background-color var(--rapido), border-color var(--rapido), box-shadow var(--rapido), opacity var(--rapido);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { --btn-bg: var(--jota-laranja-2); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn[disabled], .btn.desativado { opacity: .5; pointer-events: none; }
.btn .icone { width: 18px; height: 18px; }

.btn-escuro { --btn-bg: var(--jota-noite); --btn-cor: #fff; }
.btn-escuro:hover { --btn-bg: var(--jota-vinho); }
.btn-contorno { --btn-bg: transparent; --btn-cor: currentColor; --btn-borda: var(--borda-forte); }
.btn-contorno:hover { --btn-bg: var(--hover); }
.btn-fantasma { --btn-bg: transparent; --btn-cor: currentColor; }
.btn-fantasma:hover { --btn-bg: var(--hover); }
.btn-perigo { --btn-bg: var(--jota-vermelho); --btn-cor: #fff; }
.btn-perigo:hover { --btn-bg: #A62B21; }
.btn-sucesso { --btn-bg: var(--jota-verde); --btn-cor: #fff; }
.btn-sucesso:hover { --btn-bg: #188A4D; }

.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 14px; border-radius: var(--raio-sm); }
.btn-lg { min-height: 54px; padding: 15px 26px; font-size: 16.5px; border-radius: 16px; }
.btn-bloco { display: flex; width: 100%; }
.btn-icone { width: var(--toque); padding: 0; }
.btn-icone.btn-sm { width: 36px; }

.btn.carregando { position: relative; color: transparent !important; pointer-events: none; }
.btn.carregando::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--btn-cor); border-right-color: transparent;
  animation: girar .7s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ------------------------------------------------ Selos (badges) */
.selo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: var(--raio-pilula);
  font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.3;
  white-space: nowrap;
  border: 1px solid transparent;
}
.selo .icone { width: 13px; height: 13px; }
.selo-laranja { background: var(--jota-laranja); color: var(--jota-noite); }
.selo-verde { background: var(--selo-verde-bg); color: var(--selo-verde-cor); border-color: var(--selo-verde-borda); }
.selo-ambar { background: var(--selo-ambar-bg); color: var(--selo-ambar-cor); border-color: var(--selo-ambar-borda); }
.selo-vermelho { background: var(--selo-vermelho-bg); color: var(--selo-vermelho-cor); border-color: var(--selo-vermelho-borda); }
.selo-neutro { background: var(--selo-neutro-bg); color: var(--selo-neutro-cor); border-color: var(--selo-neutro-borda); }
.selo-escuro { background: var(--jota-noite); color: var(--jota-creme); }

/* ------------------------------------------------ Formularios */
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--e-5); min-width: 0; }
.campo > label, .rotulo {
  font-size: 14px; font-weight: 700; color: var(--texto);
}
.campo .opcional { font-weight: 500; color: var(--texto-suave); }
.ajuda { font-size: 13px; color: var(--texto-suave); line-height: 1.45; }
.erro-campo { font-size: 13px; color: var(--jota-vermelho); font-weight: 600; }

.entrada, .campo input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .campo select, .campo textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1.5px solid var(--borda-campo);
  border-radius: var(--raio-sm);
  background: var(--fundo-campo);
  color: var(--texto);
  font-size: 16px; /* 16px evita zoom automatico no iOS */
  transition: border-color var(--rapido), box-shadow var(--rapido), background-color var(--rapido);
}
.campo textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
.campo select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%237a6a62' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
.entrada:hover, .campo input:hover, .campo select:hover, .campo textarea:hover { border-color: var(--borda-forte); }
.entrada:focus, .campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--jota-laranja); box-shadow: 0 0 0 4px rgba(240, 138, 36, .2);
}
.campo [aria-invalid="true"] { border-color: var(--jota-vermelho); }
.campo input::placeholder, .campo textarea::placeholder { color: var(--texto-fraco); }

.prefixo { position: relative; }
.prefixo > span {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-weight: 700; color: var(--texto-suave); pointer-events: none;
}
.prefixo input { padding-left: 46px !important; }

.linha-campos { display: grid; gap: 0 var(--e-4); grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .linha-campos.dois { grid-template-columns: 1fr 1fr; }
  .linha-campos.tres { grid-template-columns: repeat(3, 1fr); }
}

/* Interruptor (toggle) acessivel: checkbox real por baixo */
.interruptor {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  min-height: var(--toque); user-select: none;
}
.interruptor input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.interruptor .trilho {
  position: relative; flex: none; width: 48px; height: 28px; border-radius: 999px;
  background: var(--trilho); transition: background-color var(--medio) var(--curva);
}
.interruptor .trilho::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--medio) var(--curva);
}
.interruptor input:checked + .trilho { background: var(--jota-verde); }
.interruptor input:checked + .trilho::after { transform: translateX(20px); }
.interruptor input:focus-visible + .trilho { outline: 3px solid var(--jota-laranja); outline-offset: 2px; }
.interruptor .texto { font-weight: 600; line-height: 1.35; }
.interruptor .texto small { display: block; font-weight: 500; color: var(--texto-suave); font-size: 13px; }

/* Escolha segmentada (radios como botoes) */
.segmentos { display: flex; flex-wrap: wrap; gap: 8px; }
.segmentos label { position: relative; flex: 1 1 auto; }
.segmentos input { position: absolute; opacity: 0; inset: 0; }
.segmentos span {
  display: flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: var(--toque); padding: 10px 14px; border-radius: var(--raio-sm);
  border: 1.5px solid var(--borda-campo); background: var(--fundo-campo);
  font-weight: 650; font-size: 14.5px; cursor: pointer;
  transition: border-color var(--rapido), background-color var(--rapido), color var(--rapido);
}
.segmentos input:checked + span { border-color: var(--jota-laranja); background: rgba(240,138,36,.12); color: var(--texto); box-shadow: inset 0 0 0 1px var(--jota-laranja); }
.segmentos input:focus-visible + span { outline: 3px solid var(--jota-laranja); outline-offset: 2px; }

/* ------------------------------------------------ Avisos */
.aviso {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--raio);
  border: 1px solid var(--aviso-borda, var(--borda));
  background: var(--aviso-bg, var(--superficie));
  font-size: 14.5px; line-height: 1.5;
}
.aviso .icone { margin-top: 1px; color: var(--aviso-cor, currentColor); }
.aviso strong { font-weight: 750; }
.aviso + .aviso { margin-top: var(--e-3); }
.aviso-sucesso { --aviso-bg: var(--selo-verde-bg); --aviso-borda: var(--selo-verde-borda); --aviso-cor: var(--selo-verde-cor); }
.aviso-erro { --aviso-bg: var(--selo-vermelho-bg); --aviso-borda: var(--selo-vermelho-borda); --aviso-cor: var(--selo-vermelho-cor); }
.aviso-alerta { --aviso-bg: var(--selo-ambar-bg); --aviso-borda: var(--selo-ambar-borda); --aviso-cor: var(--selo-ambar-cor); }
.aviso-info { --aviso-bg: var(--superficie-2); --aviso-borda: var(--borda); --aviso-cor: var(--texto-suave); }

/* ------------------------------------------------ Toasts */
.toasts {
  position: fixed; z-index: 900; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); width: min(440px, calc(100% - 32px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: var(--raio);
  background: var(--jota-noite); color: #fff;
  box-shadow: 0 14px 40px rgba(27, 5, 7, .35);
  font-weight: 600; font-size: 14.5px;
  pointer-events: auto;
  animation: toast-entra var(--medio) var(--curva);
}
.toast .icone { color: var(--jota-laranja); }
.toast.sucesso .icone { color: var(--jota-verde-claro); }
.toast.erro { background: #7E1A13; }
.toast.erro .icone { color: #FFC9C2; }
.toast.saindo { opacity: 0; transform: translateY(8px); transition: all var(--medio); }
@keyframes toast-entra { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ------------------------------------------------ Dialogo nativo */
dialog.dialogo {
  border: 0; padding: 0; margin: auto;
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px);
  border-radius: var(--raio-xl);
  background: var(--superficie); color: var(--texto);
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  overflow: auto;
}
dialog.dialogo::backdrop { background: rgba(18, 3, 4, .66); backdrop-filter: blur(3px); }
dialog.dialogo[open] { animation: dialogo-entra var(--medio) var(--curva); }
@keyframes dialogo-entra { from { opacity: 0; transform: translateY(16px) scale(.98); } }
@media (max-width: 639px) {
  dialog.dialogo { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: var(--raio-xl) var(--raio-xl) 0 0; max-height: 92dvh; }
  @keyframes dialogo-entra { from { transform: translateY(40px); opacity: .4; } }
}
.dialogo-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px 14px; position: sticky; top: 0; background: inherit; z-index: 1;
  border-bottom: 1px solid var(--borda);
}
.dialogo-topo h2 { font-size: 18px; font-weight: 800; font-family: var(--fonte-texto); }
.dialogo-corpo { padding: 20px; }
.dialogo-rodape { display: flex; gap: 10px; justify-content: flex-end; padding: 0 20px 20px; flex-wrap: wrap; }

/* ------------------------------------------------ Utilitarios */
.mt-0 { margin-top: 0 !important; } .mt-2 { margin-top: var(--e-2); } .mt-3 { margin-top: var(--e-3); } .mt-4 { margin-top: var(--e-4); } .mt-6 { margin-top: var(--e-6); }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: var(--e-2); } .mb-4 { margin-bottom: var(--e-4); } .mb-6 { margin-bottom: var(--e-6); }
.flex { display: flex; } .entre { display: flex; justify-content: space-between; align-items: center; gap: var(--e-3); }
.gap-2 { gap: var(--e-2); } .gap-3 { gap: var(--e-3); } .quebra { flex-wrap: wrap; } .centro { align-items: center; }
.crescer { flex: 1 1 auto; min-width: 0; }
.texto-suave { color: var(--texto-suave); } .texto-fraco { color: var(--texto-fraco); }
.pequeno { font-size: 14px; } .menor { font-size: 13px; }
.forte { font-weight: 750; }
.numero { font-variant-numeric: tabular-nums; }
.truncar { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.direita { text-align: right; }
