/* v3 — responsivo (web + navegador interno do WhatsApp), identidade Localiza */
:root {
  --green: #01602a;
  --green-dark: #004521;
  --green-deep: #003827;
  --green-mid: #00984a;
  --lime: #78de1f;
  --lime-soft: #f1fbe8;
  --text: #383838;
  --text-2: #4a4a4a;
  --muted: #6e6e6e;
  --line: #e6e6e6;
  --bg: #f2f2f2;
  --surface: #ffffff;
  --disabled-bg: #e6e6e6;
  --disabled-text: #9e9e9e;
  --font: "LocalizaDinDisplay_Regular", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --band: 0px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; }

/* ---------- Cabeçalho ---------- */
.site-header { background: var(--green); padding-top: env(safe-area-inset-top); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 8px 0 16px; }
.logo { display: block; height: 24px; width: auto; }
/* Voltar (cabeçalho, à direita) */
.header-actions { display: flex; align-items: center; }
.back-link {
  display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: none;
  color: var(--lime);
  cursor: pointer;
}
.back-link:hover, .back-link:active { background: rgba(255, 255, 255, .12); }
.back-link:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* Ajuda (rodapé) */
.footer-help {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 2px; border: 0; background: none;
  color: var(--green); font-size: inherit; font-weight: 600;
  cursor: pointer;
}
.footer-help svg { flex: none; fill: currentColor; }
.footer-help span { text-decoration: underline; text-underline-offset: 2px; }
.footer-help:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 2px; }

/* ---------- Layout base (celular) ---------- */
.layout { flex: 1; }

.intro {
  margin-top: -1px;
  padding: 4px 20px 46px;
  background: var(--green);
  border-radius: 0 0 16px 16px;
}
.eyebrow {
  margin: 0 0 4px;
  font-size: 13px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--lime);
}
.intro-title { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 600; color: #fff; }
.contract { margin: 6px 0 0; font-size: 14px; color: rgba(255, 255, 255, .8); }


/* Etapas: barra segmentada no topo (celular) */
.steps { position: relative; display: flex; gap: 6px; margin: -1px 0 0; padding: 14px 20px 14px; list-style: none; background: var(--green); }
.steps li { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); transition: background-color .2s; }
.steps li.done, .steps li.current { background: var(--lime); }
.steps .dot, .steps .label { display: none; }

.card {
  position: relative;
  margin: -30px 12px 0;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 56, 39, .10);
}
.content { padding: 24px 18px 8px; animation: enter .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.content.back { animation-name: enter-back; }
@keyframes enter-back { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.site-footer { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
.site-footer p { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); }
.site-footer svg { fill: var(--green-mid); }

/* ---------- Componentes do Flow ---------- */
.c-banner {
  position: relative;
  overflow: hidden;
  margin: -24px -18px 20px;
  border-radius: 8px 8px 0 0;
  background: var(--green);
}
.c-banner::before {
  content: ""; position: absolute; inset: -24px;
  background: var(--banner) center / cover no-repeat;
  filter: blur(20px) saturate(1.1);
}
.c-image { position: relative; display: block; width: 100%; height: auto; object-fit: contain; margin: 0; }

/* Banner de boas-vindas (recriado em HTML/SVG) */
.welcome {
  position: relative;
  overflow: hidden;
  margin: -24px -18px 20px;
  padding: 26px 20px 22px;
  border-radius: 8px 8px 0 0;
  background: var(--green);
  color: #fff;
  text-align: center;
}
.w-deco { position: absolute; pointer-events: none; }
.w-deco-tl { top: -46px; left: -46px; width: 96px; height: 96px; border-radius: 50%; background: var(--lime); }
.w-deco-tr { top: -30px; right: -30px; width: 84px; height: 84px; border-radius: 0 0 0 84px; background: var(--lime); opacity: .85; }
.w-deco-bl { bottom: -40px; left: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--lime); opacity: .85; }
.w-deco-br { bottom: -34px; right: -34px; width: 68px; height: 68px; border: 3px solid var(--lime); transform: rotate(45deg); }
.w-text, .w-steps { position: relative; }
.w-title { margin: 0; font-size: 26px; line-height: 1.12; font-weight: 700; }
.w-title span { display: block; color: var(--lime); }
.w-sub { margin: 8px 0 18px; font-size: 15px; font-weight: 600; }
.w-steps {
  display: flex; justify-content: space-between;
  max-width: 330px; margin: 0 auto; padding: 0;
  list-style: none;
}
.w-steps::before {
  content: ""; position: absolute; top: 22px; left: 16%; right: 16%;
  height: 4px; border-radius: 2px; background: var(--lime);
}
.w-steps li {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; line-height: 1.2;
}
.w-icon {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 50%; background: var(--lime); color: #fff;
  box-shadow: 0 0 0 4px var(--green);
}
.w-icon svg { width: 26px; height: 26px; fill: currentColor; }
.c-heading { margin: 0 0 14px; font-size: 22px; line-height: 1.25; font-weight: 700; color: var(--green); }
.c-subheading { margin: 16px 0 8px; font-size: 18px; line-height: 1.3; font-weight: 700; color: var(--green); }
.c-body { margin: 0 0 18px; font-size: 16px; line-height: 1.55; color: var(--text-2); overflow-wrap: anywhere; }
.c-body p { margin: 0 0 12px; white-space: pre-line; }
.c-body p:last-child { margin-bottom: 0; }
.c-body strong { font-weight: 700; color: var(--text); }
.c-body a { color: var(--green-mid); font-weight: 600; }

.c-code {
  margin: 0 0 16px; padding: 14px;
  border: 1px dashed var(--green-mid); border-radius: 6px;
  background: var(--lime-soft);
}
.c-code-text {
  display: block; margin: 0 0 12px;
  font-size: 15px; line-height: 1.5; color: var(--text);
  overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
a.c-code-text { color: var(--green-mid); font-weight: 600; user-select: text; -webkit-user-select: text; }
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 44px; padding: 0 16px;
  border: 1.5px solid var(--green); border-radius: 4px;
  background: var(--surface); color: var(--green);
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.copy-btn svg { fill: currentColor; flex: none; }
.copy-btn:hover { background: var(--lime-soft); }
.copy-btn.copied { background: var(--green); border-color: var(--green); color: #fff; }

.c-input { margin: 8px 0 16px; }
.c-input input {
  width: 100%; height: 52px; padding: 0 16px;
  font-family: inherit; font-size: 18px; letter-spacing: .1em;
  color: var(--text); background: var(--surface);
  border: 1px solid #bdbdbd; border-radius: 4px;
  outline: none;
}
.c-input input::placeholder { color: var(--muted); letter-spacing: 0; font-size: 16px; }
.c-input input:focus { border-color: var(--green); box-shadow: 0 0 0 2px rgba(120, 222, 31, .45); }

.c-radio { border: 0; margin: 8px 0 16px; padding: 0; display: grid; gap: 10px; }
.c-radio legend { padding: 0; margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--text); }
.c-radio label {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 6px;
  font-size: 16px; color: var(--text);
  cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.c-radio label:hover { border-color: #bdbdbd; }
.c-radio label span { flex: 1; }
.c-radio label:has(input:checked) { border-color: var(--green); background: var(--lime-soft); box-shadow: inset 3px 0 0 var(--lime); }
.c-radio input {
  appearance: none; -webkit-appearance: none;
  order: -1; flex: none;
  width: 20px; height: 20px; margin: 0;
  border: 2px solid #9e9e9e; border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer;
}
.c-radio input::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green); transform: scale(0); transition: transform .12s; }
.c-radio input:checked { border-color: var(--green); }
.c-radio input:checked::after { transform: scale(1); }
.c-radio input:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

/* ---------- Botão ---------- */
.cta {
  position: relative;
  width: 100%; height: 48px;
  border: 0; border-radius: 4px;
  background: var(--green); color: #fff;
  font-size: 17px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer;
}
.cta:hover:not(:disabled) { background: var(--green-dark); }
.cta:disabled { background: var(--disabled-bg); color: var(--disabled-text); cursor: default; }
.cta .spinner {
  display: none;
  position: absolute; inset: 0; margin: auto;
  width: 22px; height: 22px;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: var(--lime); border-radius: 50%;
  animation: spin .8s linear infinite;
}
.cta.loading { background: var(--green); }
.cta.loading .cta-label { visibility: hidden; }
.cta.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Encerrado ---------- */
.closed .actions { display: none; }
.closed-view { display: grid; justify-items: center; gap: 12px; padding: 32px 8px 28px; text-align: center; }
.closed-view svg { fill: var(--lime); }
.closed-view h2 { margin: 0; font-size: 24px; color: var(--green); }
.closed-view p { margin: 0; max-width: 340px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.closed-view .cta { margin-top: 8px; display: grid; place-items: center; max-width: 320px; text-decoration: none; }

/* ---------- Diálogo e aviso ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 56, 39, .5); }
.dialog {
  width: 100%; max-width: 480px;
  padding: 24px 18px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 4px solid var(--lime);
  border-radius: 16px 16px 0 0;
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.dialog h2 { margin: 0 0 12px; font-size: 20px; color: var(--green); }
.dialog p { margin: 0 0 12px; font-size: 16px; line-height: 1.5; color: var(--text-2); }
.dialog .cta { margin-top: 8px; }


/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  .intro { padding: 12px 32px 60px; text-align: center; border-radius: 0 0 16px 16px; }
  .intro-title { font-size: 28px; }
  .steps { padding: 24px calc(50% - 210px) 8px; }
  .card { max-width: 560px; margin: -40px auto 0; }
  .content { padding: 32px 32px 8px; }
  .actions { padding: 16px 32px 24px; }
  .c-banner { margin: -32px -32px 20px; }
  .welcome { margin: -32px -32px 22px; padding: 30px 32px 26px; }
  .c-image { max-height: 260px; }
}

/* ---------- Computador: coluna única centralizada, etapas no topo ---------- */
@media (min-width: 960px) {
  body { background: linear-gradient(var(--green) 0 250px, var(--bg) 250px); }
  .site-header { box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .08); }
  .header-inner { height: 56px; padding: 0 32px; }
  .logo { height: 26px; }

  .layout { max-width: 880px; padding: 24px 32px 32px; }

  /* Etapas: linha horizontal com marcadores e rótulos */
  .steps { display: flex; gap: 0; margin: 0 0 20px; padding: 0; background: none; }
  .steps li, .steps li.done, .steps li.current {
    flex: 1; height: auto; background: none; border-radius: 0;
    display: flex; align-items: center; gap: 10px;
  }
  .steps li:not(:last-child)::after {
    content: ""; flex: 1; height: 2px; margin: 0 14px 0 4px; min-width: 16px;
    background: rgba(255, 255, 255, .25);
  }
  .steps li.done:not(:last-child)::after { background: var(--lime); }
  .steps li:last-child { flex: none; }
  .steps .dot, .steps .label { display: inline-flex; }
  .steps .dot {
    width: 28px; height: 28px; flex: none;
    align-items: center; justify-content: center;
    border: 2px solid rgba(255, 255, 255, .35); border-radius: 50%;
    font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .7);
  }
  .steps .label { font-size: 15px; white-space: nowrap; color: rgba(255, 255, 255, .7); }
  .steps li.current .dot { border-color: var(--lime); background: var(--lime); color: var(--green-deep); }
  .steps li.current .label { color: #fff; font-weight: 600; }
  .steps li.done .dot { border-color: var(--lime); color: var(--lime); }
  .steps li.done .label { color: rgba(255, 255, 255, .9); }

  .intro {
    display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 16px;
    padding: 0 0 16px; text-align: left; background: none; border-radius: 0;
  }
  .eyebrow { flex-basis: 100%; font-size: 13px; margin-bottom: 2px; }
  .intro-title { font-size: 28px; line-height: 1.2; }
  .contract { margin: 0 0 0 auto; font-size: 15px; }

  .card { max-width: none; margin: 0; border-radius: 12px; box-shadow: 0 8px 32px rgba(0, 56, 39, .14); }
  .content { padding: 24px 32px 4px; }
  .c-banner { margin: -24px -32px 18px; border-radius: 12px 12px 0 0; }
  /* Banner na horizontal: texto à esquerda, passos à direita */
  .welcome {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center; column-gap: 32px;
    margin: -24px -32px 22px; padding: 28px 48px;
    border-radius: 12px 12px 0 0; text-align: left;
  }
  .w-title { font-size: 30px; }
  .w-sub { margin: 8px 0 0; }
  .w-steps { max-width: none; width: 100%; }
  .w-deco-br { bottom: -42px; right: -42px; width: 84px; height: 84px; border: 4px solid var(--lime); border-radius: 50%; transform: none; }
  .c-image { max-height: 170px; }
  .c-heading { font-size: 22px; margin-bottom: 14px; }
  .c-body { margin-bottom: 18px; }
  .c-input { margin: 4px 0 12px; }
  .copy-btn { width: auto; min-width: 220px; }

  /* Opções: lista; em grade quando são muitas (ex.: parcelas) */
  .c-radio { margin: 4px 0 12px; gap: 8px; }
  .c-radio legend { margin-bottom: 8px; }
  .c-radio label { min-height: 46px; padding: 10px 14px; }
  .c-radio:has(label:nth-of-type(5)) { grid-template-columns: repeat(2, 1fr); }
  .c-radio:has(label:nth-of-type(7)) { grid-template-columns: repeat(3, 1fr); }

  /* Botão com a mesma largura do conteúdo (alinhado ao campo e às opções) */
  .actions { position: static; padding: 6px 32px 24px; border-top: 0; }

  /* Tela com campo (Confirma CPF): botão na mesma linha do campo, à direita */
  .card { position: relative; }
  .card:has(.c-input) .content { padding-bottom: 24px; }
  .card:has(.c-input) .c-input { margin: 4px 256px 0 0; }
  .card:has(.c-input) .actions { position: absolute; right: 32px; bottom: 24px; width: 240px; padding: 0; }
  .card:has(.c-input) .cta { height: 52px; }

  .overlay { align-items: center; }
  .dialog { border-radius: 10px; padding: 28px 28px 24px; }
}

/* Notebooks com pouca altura */
@media (min-width: 960px) and (max-height: 760px) {
  .layout { padding-top: 18px; }
  .steps { margin-bottom: 16px; }
  .c-image { max-height: 140px; }
}

/* Acessibilidade e desempenho: sem animações para quem prefere movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Splash enquanto o circuito Blazor conecta (removido via CSS quando o layout renderiza) ---------- */
.boot { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; background: var(--bg); }
.boot-header { width: 100%; height: calc(56px + env(safe-area-inset-top)); background: var(--green); }
.boot-spinner { width: 28px; height: 28px; margin-top: 40vh; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: boot-spin .8s linear infinite; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
body:has(.site-header) .boot { display: none; }
@media (prefers-reduced-motion: reduce) { .boot-spinner { animation: none; } }
