/* ═══════════════════════════════════════════════════════
   POPUP DE CADASTRO (home, visitante)
   Desktop: cartão central em 2 colunas (marca + formulário)
   Mobile: folha que sobe da base, rolável
   ═══════════════════════════════════════════════════════ */

html.sp-lock,
html.sp-lock body { overflow: hidden; }

.sp-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 22, 30, 0);
  backdrop-filter: blur(0);
  -webkit-backdrop-filter: blur(0);
  transition: background 0.26s ease, backdrop-filter 0.26s ease;
}
.sp-overlay[hidden] { display: none; }
.sp-overlay.is-open {
  background: rgba(20, 22, 30, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sp-dialog {
  position: relative;
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-template-rows: minmax(0, 1fr); /* deixa o formulário rolar em vez de crescer */
  width: min(860px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  background: #fff;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(20, 22, 30, 0.3);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.26s ease, transform 0.26s cubic-bezier(.2,.8,.2,1);
  font-family: var(--font-sans);
}
.sp-overlay.is-open .sp-dialog { opacity: 1; transform: none; }

.sp-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--gray-mid, #f3f1ec);
  color: var(--ink, #1a1a18);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.sp-close:hover { background: var(--gray-light, #e8e6e1); transform: rotate(90deg); }

/* ── Lado da marca ── */
.sp-hero {
  position: relative;
  padding: 36px 30px;
  color: #fff;
  background:
    radial-gradient(circle at 110% -10%, rgba(255,255,255,0.22) 0, transparent 55%),
    radial-gradient(circle at -20% 110%, rgba(36,58,110,0.55) 0, transparent 60%),
    linear-gradient(160deg, #f0a45a 0%, #e07f2e 45%, #c96b22 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sp-hero::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 28px solid rgba(255,255,255,0.12);
}
.sp-hero-logo {
  width: 132px;
  height: auto;
  background: #fff;
  padding: 8px 12px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.sp-hero-title {
  margin: 28px 0 8px;
  font-size: 1.6rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.sp-hero-sub {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  opacity: 0.92;
}
.sp-perks {
  list-style: none;
  margin: 26px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.sp-perks li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 700;
}
.sp-perk-ico {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255,255,255,0.2);
}

/* ── Formulário ── */
.sp-body {
  padding: 34px 34px 24px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sp-title {
  margin: 0 40px 4px 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink, #1a1a18);
}
.sp-sub {
  margin: 0 0 20px;
  font-size: 0.88rem;
  color: var(--text-muted, #6f6f68);
}

.sp-form { display: grid; gap: 14px; }
.sp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sp-field[hidden] { display: none; }
.sp-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink, #1a1a18);
}
.sp-opt { font-weight: 500; color: var(--text-muted, #6f6f68); }
.sp-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid #e3e1db;
  border-radius: 12px;
  background: #fbfaf8;
  font: inherit;
  font-size: 16px; /* evita zoom automático no iOS */
  color: var(--ink, #1a1a18);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}
.sp-field input::placeholder { color: #a9a8a2; }
.sp-field input:focus {
  outline: none;
  border-color: var(--orange, #e07f2e);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(224, 127, 46, 0.15);
}
.sp-error {
  margin: 5px 0 0;
  font-size: 0.76rem;
  font-weight: 600;
  color: #c0392b;
}

.sp-consent .field { margin: 0 !important; }
.sp-consent .field[hidden] { display: none; }
.sp-consent label { font-size: 0.82rem !important; color: #4a4a45; }
.sp-consent a { color: var(--navy, #243a6e); }
.sp-consent input[type="checkbox"] { accent-color: var(--orange, #e07f2e); width: 16px !important; height: 16px; }

.sp-submit {
  margin-top: 4px;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: 999px;
  background: var(--orange, #e07f2e);
  color: #fff;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(224, 127, 46, 0.35);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.sp-submit:hover { background: var(--orange-dark, #c96b22); transform: translateY(-1px); }
.sp-submit:disabled { opacity: 0.75; cursor: progress; transform: none; }

.sp-foot {
  margin: 16px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted, #6f6f68);
}
.sp-foot a { color: var(--orange, #e07f2e); font-weight: 800; text-decoration: none; }
.sp-later {
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--text-muted, #6f6f68);
  text-decoration: underline;
  cursor: pointer;
}

/* ── Tablet: esconde a coluna da marca, mostra uma faixa no topo ── */
@media (max-width: 820px) {
  .sp-dialog { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); width: min(520px, 100%); }
  .sp-hero { padding: 22px 60px 22px 24px; flex-direction: row; align-items: center; gap: 14px; flex-wrap: wrap; }
  .sp-hero::after { width: 140px; height: 140px; right: -50px; bottom: -70px; border-width: 22px; }
  .sp-hero-logo { width: 96px; padding: 6px 10px; border-radius: 12px; }
  .sp-hero-title { margin: 0; font-size: 1.15rem; flex: 1; }
  .sp-hero-sub,
  .sp-perks { display: none; }
  .sp-close { background: rgba(255,255,255,0.9); }
}

/* ── Mobile: folha que sobe da base ── */
@media (max-width: 720px) {
  .sp-overlay { align-items: flex-end; padding: 0; }
  .sp-dialog {
    width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    transform: translateY(100%);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sp-overlay.is-open .sp-dialog { transform: none; }
  .sp-hero { padding: 18px 56px 18px 20px; }
  .sp-hero-title { font-size: 1.05rem; }
  .sp-body { padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); }
  .sp-title { font-size: 1.2rem; margin-right: 0; }
  .sp-sub { margin-bottom: 16px; }
  .sp-close { top: 12px; right: 12px; width: 34px; height: 34px; }
}

@media (max-width: 359px) {
  .sp-row { grid-template-columns: 1fr; }
}

/* ── Monitores baixos (notebook, janela reduzida): tudo mais compacto ── */
@media (min-width: 721px) and (max-height: 760px) {
  .sp-overlay { padding: 16px; }
  .sp-dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
  .sp-hero { padding: 26px 26px; }
  .sp-hero-title { margin-top: 20px; font-size: 1.4rem; }
  .sp-perks { margin-top: 18px; gap: 10px; }
  .sp-body { padding: 24px 30px 18px; }
  .sp-sub { margin-bottom: 14px; }
  .sp-form { gap: 10px; }
  .sp-field label { margin-bottom: 4px; }
  .sp-field input { height: 42px; }
  .sp-submit { height: 48px; }
  .sp-foot { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-overlay, .sp-dialog { transition: none; }
}
