/* ==========================================================================
   Checkout IDX — pay.idxcompany.com.br

   Mesma linguagem visual do site comercial (admin_idxcompany/site). Os tokens
   abaixo são a cópia à mão de `site/src/styles/global.css`, porque aqui é
   Django puro: sem Tailwind, sem build de CSS. **Mexeu numa cor, num raio ou
   numa curva de um lado, mexa no outro** — o visitante atravessa os dois
   domínios no mesmo clique (idxcompany.com.br/planos → pay./assinar), e a
   troca de identidade no meio de um formulário de cartão lê como golpe.

   Urbanist é self-hosted pelo mesmo motivo do site: o preconnect do Google
   Fonts custa uma viagem de rede no caminho crítico, e aqui o caminho crítico
   é o formulário de pagamento.
   ========================================================================== */

@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/urbanist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Urbanist";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/urbanist-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* marca */
  --brand-500: #4e26de;
  --brand-600: #4420c4;
  --brand-700: #3a1cb0;

  /* neutros derivados do mesmo matiz do violeta (~258) */
  --n-0: #ffffff;
  --n-50: #f5f3fb;
  --n-100: #ece9f6;
  --n-200: #dcd8ec;
  --n-300: #bfb9d6;
  --n-500: #6b6390;
  --n-600: #4e4770;
  --n-900: #141124;

  /* papéis semânticos */
  --surface: var(--n-0);
  --surface-2: var(--n-50);
  --surface-3: var(--n-100);
  --text: var(--n-900);
  --text-2: var(--n-600);
  --text-3: var(--n-500);
  --line: var(--n-200);
  --line-strong: var(--n-300);

  --accent: var(--brand-500);
  --accent-hover: var(--brand-600);
  --accent-press: var(--brand-700);
  --accent-soft: #efebfd;
  --accent-line: #d8cdf8;
  --on-accent: #ffffff;

  --positive: #167c42;
  --warning: #9a6a00;
  --danger: #b02020;

  --elev-float: 0 12px 32px -8px rgb(20 17 36 / 0.18), 0 2px 8px -2px rgb(20 17 36 / 0.1);

  /* raio: superfície 16, controle 12, chip pill */
  --r-surface: 16px;
  --r-control: 12px;

  /* curvas fortes. As nativas do CSS não têm punch suficiente. */
  --e-out: cubic-bezier(0.23, 1, 0.32, 1);

  --header-h: 4rem;
}

@media (min-width: 768px) {
  :root { --header-h: 4.5rem; }
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: "Urbanist", ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-synthesis-weight: none;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* número de preço não pode dançar de largura ao trocar o ciclo */
.tabular, td, th { font-variant-numeric: tabular-nums; }

h1, h2, h3 { text-wrap: balance; margin: 0; }
p { text-wrap: pretty; }

::selection { background-color: var(--accent-soft); color: var(--text); }

:root {
  accent-color: var(--accent);
  caret-color: var(--accent);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 150ms var(--e-out);
}
a:hover { color: var(--accent-hover); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
:focus:not(:focus-visible) { outline: none; }

/* ==========================================================================
   Casca: header, conteúdo, rodapé
   ========================================================================== */

.wrap { max-width: 75rem; margin: 0 auto; width: 100%; padding: 0 1.25rem; }
@media (min-width: 768px) { .wrap { padding: 0 2rem; } }

.topo {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
@supports not (backdrop-filter: blur(1px)) { .topo { background: var(--surface); } }

.topo .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: var(--header-h);
}

.marca { display: inline-flex; align-items: center; transition: opacity 150ms var(--e-out); }
.marca:hover { opacity: 0.8; }
.marca svg { height: 1.75rem; width: auto; display: block; }
@media (min-width: 768px) { .marca svg { height: 2rem; } }

.seguro {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
}
.seguro svg { flex: 0 0 auto; }

main.wrap { padding-top: 3rem; padding-bottom: 4rem; }
@media (min-width: 768px) { main.wrap { padding-top: 4rem; padding-bottom: 6rem; } }

.rodape {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding: 2.5rem 0;
}
.rodape .wrap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-3);
}
.rodape a { color: var(--text-2); text-decoration: none; }
.rodape a:hover { color: var(--text); text-decoration: underline; }
.rodape .links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
@media (min-width: 768px) {
  .rodape .wrap { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ==========================================================================
   Tipografia de página
   ========================================================================== */

h1 {
  font-size: 2rem;
  line-height: 1.06;
  letter-spacing: -0.03em;
  font-weight: 800;
}
@media (min-width: 768px) { h1 { font-size: 2.75rem; } }

.sub {
  margin: 1.25rem 0 0;
  max-width: 56ch;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-2);
}

.nota { font-size: 0.8125rem; line-height: 1.6; color: var(--text-3); margin: 0; }

/* ==========================================================================
   Seletor de ciclo — espelha o SeletorDeCiclo de site/src/pages/Planos.tsx
   ========================================================================== */

.ciclo {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 2.25rem 0 0;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface-2);
}
.ciclo a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 180ms var(--e-out), border-color 180ms var(--e-out),
    color 180ms var(--e-out), transform 180ms var(--e-out);
}
.ciclo a:hover { color: var(--text); }
.ciclo a:active { transform: scale(0.97); }
.ciclo a.ativo {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--text);
}
.ciclo small { font-size: 0.75rem; font-weight: 700; color: var(--accent); }

/* ==========================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-surface);
  padding: 1.5rem;
}
@media (min-width: 768px) { .card { padding: 1.75rem; } }

.grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin-top: 2.5rem;
  align-items: stretch;
}

.plano { display: flex; flex-direction: column; height: 100%; }
.plano.destaque { border-color: var(--accent); box-shadow: var(--elev-float); }

.plano-topo { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.plano h2 { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.015em; }

.selo {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--accent-soft);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.preco {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin: 1.5rem 0 0;
  font-variant-numeric: tabular-nums;
}
.preco .cifra { font-size: 0.875rem; font-weight: 500; color: var(--text-3); }
.preco .valor { font-size: 2.25rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.preco .periodo { font-size: 0.875rem; color: var(--text-3); }

.lista {
  list-style: none;
  padding: 1.5rem 0 0;
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-2);
}
.lista li b { color: var(--text); font-weight: 600; }
/* rótulo à esquerda, valor à direita — resumo do pedido e ficha da fatura */
.lista.pares li { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.lista.checks { border-top: 0; padding-top: 0; margin-top: 1.25rem; gap: 0.625rem; }
.lista.checks li { display: flex; align-items: flex-start; gap: 0.625rem; }
.lista.checks svg { flex: 0 0 auto; margin-top: 0.125rem; color: var(--accent); }

.plano .btn { margin-top: auto; }
.plano .lista:last-of-type { margin-bottom: 1.75rem; }

/* ==========================================================================
   Botões — mesmo contrato do Button do site (altura, raio, active:scale .97)
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--on-accent);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 150ms var(--e-out), background-color 150ms var(--e-out),
    border-color 150ms var(--e-out), color 150ms var(--e-out);
}
.btn:hover { background: var(--accent-hover); color: var(--on-accent); text-decoration: none; }
.btn:active { transform: scale(0.97); background: var(--accent-press); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.btn.bloco { width: 100%; }
.btn.grande { height: 3.25rem; padding: 0 1.5rem; font-size: 1rem; }

.btn.sec {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}
.btn.sec:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.btn.sec:active { background: var(--surface-3); }

.voltar {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
}
.voltar:hover { color: var(--text); }

/* ==========================================================================
   Adicionais
   ========================================================================== */

.extras { margin-top: 3.5rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.extras h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.75rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.chip b { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Formulário — label SEMPRE acima do campo, erro abaixo (regra do site)
   ========================================================================== */

.form-grade {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  margin-top: 2.5rem;
}
@media (max-width: 960px) { .form-grade { grid-template-columns: 1fr; } }

fieldset { border: 0; padding: 0; margin: 0 0 2rem; }
fieldset:last-of-type { margin-bottom: 1.5rem; }
legend {
  padding: 0;
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.linha { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.linha.tres { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 560px) { .linha, .linha.tres { grid-template-columns: 1fr; } }

label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}
.linha label { margin-bottom: 0; }
.linha + .linha, .linha + label, label + .linha { margin-top: 1rem; }

input, select {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 400;
  outline: none;
  transition: border-color 150ms var(--e-out), background-color 150ms var(--e-out);
}
input::placeholder { color: var(--text-3); }
input:hover, select:hover { border-color: var(--line-strong); }
input:focus-visible, select:focus-visible { border-color: var(--accent); }
input.invalido { border-color: var(--danger); }

/* Números (documento, telefone, CEP, cartão) em algarismos de mesma largura:
   com a máscara, os grupos param de dançar a cada dígito digitado. */
input[inputmode="numeric"], input[type="tel"] { font-variant-numeric: tabular-nums; }

/* Campo com botão dentro (ver senha). O espaço à direita é do botão; o
   alvo tem 36px, que é o mínimo confortável para o dedo. */
.campo-com-acao { position: relative; display: block; margin-top: 0.5rem; }
.campo-com-acao input { margin-top: 0; padding-right: 3rem; }
.ver-senha {
  position: absolute; right: 0.3125rem; top: 50%; transform: translateY(-50%);
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-3);
  cursor: pointer; padding: 0;
  transition: color 150ms var(--e-out), background-color 150ms var(--e-out);
}
.ver-senha:hover { color: var(--text); background: var(--n-100); }
.ver-senha:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--text); }
.ver-senha[aria-pressed="true"] { color: var(--accent); }
/* Qual olho aparece é decidido pelo aria-pressed, que já é o estado do botão.
   (`hidden` não serve aqui: é propriedade de elemento HTML, e o ícone é SVG.) */
.ver-senha .olho-off { display: none; }
.ver-senha[aria-pressed="true"] .olho { display: none; }
.ver-senha[aria-pressed="true"] .olho-off { display: block; }

.cobranca {
  margin-top: 1.75rem; padding: 1.25rem 1.5rem; border-radius: var(--r-surface);
  background: var(--surface-2); display: grid; gap: 0.875rem; justify-items: center;
}
.cobranca .nota { max-width: 44ch; }

.dica { margin: 0.375rem 0 0; font-size: 0.8125rem; line-height: 1.5; color: var(--text-3); }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.alerta {
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  border-radius: var(--r-control);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  color: var(--danger);
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}
.alerta.ok {
  border-color: color-mix(in srgb, var(--positive) 30%, transparent);
  background: color-mix(in srgb, var(--positive) 8%, var(--surface));
  color: var(--positive);
}

/* ==========================================================================
   Resumo do pedido
   ========================================================================== */

.resumo { background: var(--surface-2); }
@media (min-width: 961px) { .resumo { position: sticky; top: calc(var(--header-h) + 1.5rem); } }
.resumo h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.resumo .lista { margin-top: 1.25rem; padding-top: 1.25rem; }
.resumo .total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-weight: 700;
}
.resumo .total .valor { font-size: 1.25rem; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.resumo .nota { margin-top: 0.75rem; }
.resumo .rodape-resumo { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }

/* ==========================================================================
   Páginas de desfecho (obrigado, erro, fatura)
   ========================================================================== */

.centro { max-width: 34rem; margin: 0 auto; text-align: center; }
.centro h1 { font-size: 1.75rem; }
@media (min-width: 768px) { .centro h1 { font-size: 2.25rem; } }
.centro .sub { margin-left: auto; margin-right: auto; }
.centro .btn { margin-top: 2rem; }
.centro .lista { text-align: left; }

.icone {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}
.icone.ok { background: color-mix(in srgb, var(--positive) 12%, var(--surface)); color: var(--positive); }
.icone.erro { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }

.status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-2);
}
.status.paid {
  border-color: color-mix(in srgb, var(--positive) 25%, transparent);
  background: color-mix(in srgb, var(--positive) 10%, var(--surface));
  color: var(--positive);
}
.status.overdue, .status.canceled {
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}
.status.pending {
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: var(--warning);
}

/* ==========================================================================
   Movimento reduzido. Degrada para cor e opacidade, não para ausência.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  a, button, .btn, .ciclo a {
    transition-property: color, background-color, border-color, opacity !important;
    transition-duration: 150ms !important;
  }
  .btn:active, .ciclo a:active { transform: none; }
}
