/* ============================================================
   ROYAL INOX — FORMULÁRIO MULTI-ETAPAS
   Design Premium | Preto, Branco, Dourado, Metálico
   Mobile First
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Paleta principal — preto / metálico */
  --primary:       #141414;
  --primary-dark:  #000000;
  --primary-mid:   #2A2A2A;
  --primary-light: #3D3D3D;

  /* Dourado (uso pontual, não excessivo) */
  --accent:        #B7975A;
  --accent-light:  #D9C48F;
  --accent-dark:   #8F7238;

  /* Neutros */
  --bg:            #0B0B0C;
  --white:         #FFFFFF;
  --cream:         #FAFAF9;
  --surface:       #F5F5F4;
  --border:        #E4E3E0;

  /* Tipografia */
  --text:          #141414;
  --text-light:    #4B4B4B;
  --text-muted:    #8C8C8C;

  /* Feedback */
  --success:       #22c55e;
  --error:         #ef4444;
  --whatsapp:      #25d366;

  /* Raios */
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  /* Sombras */
  --shadow-sm:     0 2px 8px rgba(0,0,0,.06);
  --shadow-md:     0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.14);
  --shadow-accent: 0 4px 24px rgba(183,151,90,.25);
  --shadow-primary:0 4px 24px rgba(0,0,0,.35);

  /* Fontes */
  --font-serif:    'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --transition:    .22s cubic-bezier(.4,0,.2,1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: var(--text);
  overflow-x: hidden;
}

/* ============================================================
   WRAPPER
   ============================================================ */
.form-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--white);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ============================================================
   BARRA DE PROGRESSO
   ============================================================ */
.progress-bar-container {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  padding: 12px 20px 8px;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}

.progress-bar-container.visible { display: flex; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--accent));
  border-radius: 100px;
  width: var(--progress, 0%);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

.progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 64px;
  text-align: right;
}

/* ============================================================
   SCREENS — SISTEMA DE TRANSIÇÃO
   ============================================================ */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  opacity: 0;
  transform: translateX(40px);
  animation: none;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
  animation: slideIn var(--transition) forwards;
}

.screen.exit {
  animation: slideOut var(--transition) forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-40px); }
}

.screen.slide-back.active {
  animation: slideInBack var(--transition) forwards;
}

@keyframes slideInBack {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   HEADER DAS PERGUNTAS
   ============================================================ */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 0;
}

.btn-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-back:hover { background: var(--surface); border-color: var(--accent); }
.btn-back:active { transform: scale(.93); }

.screen-step {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  letter-spacing: .05em;
}

/* ============================================================
   BODY DAS TELAS
   ============================================================ */
.screen-body {
  padding: 24px 20px 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen-body--center {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 32px 28px;
}

/* ============================================================
   TELA 0 — LANDING
   ============================================================ */
.landing-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Hero — foto do proprietário (quando presente) com overlay premium */
.landing-hero {
  position: relative;
  width: 100%;
  height: 340px;
  background: var(--primary-dark);
  flex-shrink: 0;
}

/* Camada que recorta a foto/fallback — separada do selo, que precisa
   "vazar" por baixo do hero sem ser cortado por este overflow. */
.landing-hero-media {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.landing-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 4%;
  display: block;
}

/* Placeholder elegante — exibido via onerror enquanto HERO_IMAGE não existir */
.landing-hero-fallback {
  display: none;
  position: absolute;
  inset: 0;
}

.landing-hero-fallback-pattern {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      135deg,
      rgba(255,255,255,.05) 0px,
      rgba(255,255,255,.05) 1px,
      transparent 1px,
      transparent 14px
    ),
    linear-gradient(160deg, #050505 0%, #1c1c1c 45%, #0a0a0a 100%);
}

/* Losango vazado — alusão discreta a estrutura/vidro arquitetônico */
.landing-hero-fallback-pattern::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(183,151,90,.35);
  transform: translate(-50%, -50%) rotate(45deg);
}

.landing-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent 52%,
    rgba(255,255,255,.4) 80%,
    rgba(255,255,255,1) 100%
  );
}

/* Selo do logo — sobrepõe a base do hero, funciona com ou sem foto */
.landing-hero-badge {
  position: absolute;
  left: 24px;
  bottom: -32px;
  z-index: 2;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--white);
  overflow: hidden;
}

.landing-hero-badge-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Conteúdo da landing */
.landing-content {
  padding: 48px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Headline principal */
.landing-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.25;
  letter-spacing: -.02em;
  margin-bottom: 10px;
}

/* Subheadline */
.landing-sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 18px;
  max-width: 340px;
}

/* ============================================================
   QUESTÕES
   ============================================================ */
.question-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 8px;
}

.question-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.3;
  margin-bottom: 24px;
  letter-spacing: -.01em;
}

.question-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -16px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ============================================================
   OPÇÕES — LISTA (coluna única)
   ============================================================ */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.option-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 17px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  width: 100%;
}

.option-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.option-card:hover {
  border-color: var(--accent);
  background: rgba(183,151,90,.08);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.option-card:active {
  opacity: .75;
}

/* Em dispositivos touch, desativa hover com transform para evitar
   conflito com detecção toque-vs-scroll do iOS Safari */
@media (hover: none) {
  .option-card:hover {
    transform: none;
    box-shadow: none;
  }
}

.option-card.selected {
  border-color: var(--primary-dark);
  background: linear-gradient(135deg, rgba(20,20,20,.06) 0%, rgba(183,151,90,.08) 100%);
  box-shadow: 0 0 0 3px rgba(20,20,20,.10), var(--shadow-sm);
}

.option-card.selected .option-label {
  color: var(--primary-dark);
  font-weight: 600;
}

/* Animação de seleção */
.option-card.selecting {
  animation: selectPulse .3s ease-out;
}

@keyframes selectPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(.96); }
  100% { transform: scale(1); }
}

/* ============================================================
   INPUTS
   ============================================================ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.text-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 16px;
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}

.text-input::placeholder { color: var(--text-muted); font-weight: 400; }

.text-input:focus {
  border-color: var(--accent);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(183,151,90,.18);
}

.text-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.input-error {
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
  display: none;
  align-items: center;
  gap: 4px;
}

.input-error.visible { display: flex; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn-primary {
  width: 100%;
  padding: 17px 24px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-mid) 100%);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: var(--shadow-primary);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(183,151,90,.25) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 28px rgba(0,0,0,.45); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* Spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Botão outline */
.btn-outline {
  padding: 14px 28px;
  background: transparent;
  color: var(--primary-dark);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .05em;
  border: 2px solid var(--primary-dark);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-outline:hover {
  background: var(--primary-dark);
  color: var(--white);
}

.btn-outline:active { transform: scale(.97); }

/* Botão WhatsApp */
.btn-whatsapp {
  width: 100%;
  max-width: 300px;
  padding: 17px 24px;
  background: var(--whatsapp);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .03em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(37,211,102,.35);
  -webkit-tap-highlight-color: transparent;
}

.btn-whatsapp:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-whatsapp:active { transform: scale(.97); }

/* Nota de privacidade */
.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
}

/* ============================================================
   TELA DE SUCESSO
   ============================================================ */
#successContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.success-animation { margin-bottom: 4px; }

.success-circle {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.checkmark {
  width: 80px;
  height: 80px;
}

.checkmark-circle {
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-miterlimit: 10;
  animation: stroke .6s cubic-bezier(.65,0,.45,1) forwards;
}

.checkmark-check {
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: stroke .3s cubic-bezier(.65,0,.45,1) .5s forwards;
}

@keyframes stroke { 100% { stroke-dashoffset: 0; } }

.success-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -.02em;
}

.success-text {
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.65;
  max-width: 290px;
}

.redirect-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.loader-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(.8); opacity: .4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.redirect-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   LANDING — AJUSTES FINAIS
   ============================================================ */
.landing-content .btn-primary {
  max-width: 100%;
}

/* ============================================================
   MENSAGEM DE ERRO NO ENVIO
   ============================================================ */
.submit-error {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(239,68,68,.08);
  border: 1.5px solid rgba(239,68,68,.30);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: #b91c1c;
  line-height: 1.55;
  text-align: center;
}

/* ============================================================
   UTILS
   ============================================================ */
.hidden { display: none !important; }
.mt-auto { margin-top: auto; }

/* ============================================================
   RESPONSIVO — Desktop
   ============================================================ */
@media (min-width: 480px) {
  body {
    align-items: center;
    padding: 32px 16px;
    background: var(--bg);
  }

  .form-wrapper {
    min-height: auto;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    overflow: hidden;
  }

  .landing-hero { height: 380px; }
  .landing-body { min-height: auto; }
}

@media (min-width: 768px) {
  .landing-title    { font-size: 28px; }
  .question-title   { font-size: 24px; }
  .success-title    { font-size: 30px; }
}
