/* ============================================================
   UPTEC Elevadores — Formulário Conversacional de Captação de Lead
   form.css — depende de tokens.css para todos os valores visuais.
   Sem frameworks, sem build step, sem cores/fontes hardcoded.
   ============================================================ */

/* ── Wrapper externo ─────────────────────────────────────── */
#lead-form-root {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

/* ── Card principal ──────────────────────────────────────── */
.lf-card {
  background: var(--surface-up);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  max-width: 640px;
  margin: 0 auto;
  overflow: hidden;
}

/* ── Cabeçalho com barra de progresso ───────────────────── */
.lf-header {
  background: var(--brand-surface);
  border-bottom: 1px solid var(--brand-border);
  padding: var(--space-6) var(--space-8);
}

.lf-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
  gap: var(--space-4);
}

.lf-step-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--brand-mid);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}

.lf-step-fraction {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
}

/* Barra slim de progresso */
.lf-progress-bar-track {
  height: 3px;
  background: var(--brand-border);
  border-radius: var(--radius-bar);
  overflow: hidden;
}

.lf-progress-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: var(--radius-bar);
  transition: width var(--dur-base) var(--ease-out);
}

/* Reduzir animação para quem prefere */
@media (prefers-reduced-motion: reduce) {
  .lf-progress-bar-fill {
    transition: none;
  }
}

/* ── Área do passo (step body) ───────────────────────────── */
.lf-body {
  padding: var(--space-8);
  position: relative;
  /* Altura mínima para evitar salto durante transição */
  min-height: 240px;
}

/* Container de steps — overflow oculto durante a animação */
.lf-steps-wrap {
  position: relative;
}

/* Cada step individual */
.lf-step {
  /* Cada step ocupa largura total; só um visível por vez */
  width: 100%;
}

.lf-step[hidden] {
  display: none;
}

/* Animação de entrada / saída */
.lf-step--enter {
  animation: stepEnter var(--dur-base) var(--ease-out) both;
}

.lf-step--exit {
  animation: stepExit var(--dur-fast) var(--ease-in) both;
}

@keyframes stepEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stepExit {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .lf-step--enter,
  .lf-step--exit {
    animation: none;
  }
}

/* ── Pergunta / label do passo ───────────────────────────── */
.lf-question {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink-strong);
  line-height: 1.35;
  margin: 0 0 var(--space-6) 0;
}

/* Subtítulo opcional abaixo da pergunta */
.lf-question-sub {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--ink-dim);
  margin-top: var(--space-2);
}

/* ── Insight dinâmico (linha de ajuda contextual) ────────── */
.lf-insight {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--brand-surface);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  color: var(--brand-mid);
  line-height: 1.5;
  /* Começa invisível; JS adiciona .lf-insight--visible */
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    opacity var(--dur-base) var(--ease-out),
    max-height var(--dur-base) var(--ease-out),
    margin-bottom var(--dur-base) var(--ease-out);
  pointer-events: none;
}

.lf-insight--visible {
  opacity: 1;
  max-height: 120px;
  margin-bottom: var(--space-6);
  pointer-events: auto;
}

.lf-insight-icon {
  flex-shrink: 0;
  color: var(--brand);
  margin-top: 2px;
}

/* Insight de emergência — usa cor de urgência */
.lf-insight--emergency {
  background: oklch(96% 0.05 45);
  border-left-color: var(--emergency);
  color: oklch(38% 0.14 40);
}

.lf-insight--emergency .lf-insight-icon {
  color: var(--emergency);
}

@media (prefers-reduced-motion: reduce) {
  .lf-insight {
    transition: none;
  }
}

/* ── Botões de opção (card-style radio) ──────────────────── */
.lf-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lf-option-item {
  margin: 0;
}

/* O input fica acessível mas visualmente oculto */
.lf-option-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lf-option-label {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background: var(--surface-up);
  font-size: var(--text-base);
  color: var(--ink);
  line-height: 1.4;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
}

.lf-option-label:hover {
  border-color: var(--brand-border);
  background: var(--brand-surface);
}

/* Estado selecionado */
.lf-option-input:checked + .lf-option-label {
  border-color: var(--brand);
  background: var(--brand-surface);
  color: var(--brand);
  font-weight: 600;
  box-shadow: 0 0 0 3px oklch(32% 0.12 250 / 0.10);
}

/* Foco teclado */
.lf-option-input:focus-visible + .lf-option-label {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

/* Marcador de seleção circular */
.lf-option-marker {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: var(--surface-up);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.lf-option-input:checked + .lf-option-label .lf-option-marker {
  border-color: var(--brand);
  background: var(--brand);
}

.lf-option-marker::after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}

.lf-option-input:checked + .lf-option-label .lf-option-marker::after {
  opacity: 1;
}

.lf-option-text {
  flex: 1;
}

/* ── Checkbox multi-selecao (marcas do equipamento) ──────── */
.lf-checkboxes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.lf-checkbox-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.lf-checkbox-item:hover {
  border-color: var(--brand-border);
  background: var(--brand-surface);
}

.lf-checkbox-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.lf-checkbox-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong);
  background: var(--surface-up);
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

.lf-checkbox-input:checked + .lf-checkbox-box {
  border-color: var(--brand);
  background: var(--brand);
}

.lf-checkbox-input:focus-visible + .lf-checkbox-box {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

.lf-checkbox-tick {
  display: none;
}

.lf-checkbox-input:checked + .lf-checkbox-box .lf-checkbox-tick {
  display: block;
}

.lf-checkbox-label-text {
  font-size: var(--text-base);
  color: var(--ink);
  line-height: 1.4;
}

/* ── Campos de texto, select e textarea ──────────────────── */
.lf-field {
  margin-bottom: var(--space-5);
}

.lf-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.lf-label-optional {
  font-weight: 400;
  color: var(--muted);
  font-size: var(--text-xs);
  margin-left: var(--space-2);
}

.lf-input,
.lf-select,
.lf-textarea {
  display: block;
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface-up);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  line-height: 1.5;
  box-sizing: border-box;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}

.lf-input:focus,
.lf-select:focus,
.lf-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px oklch(32% 0.12 250 / 0.12);
}

.lf-input::placeholder,
.lf-textarea::placeholder {
  color: var(--muted);
}

.lf-select {
  /* Seta customizada */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2346526a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-10);
  cursor: pointer;
}

.lf-textarea {
  resize: vertical;
  min-height: 96px;
}

/* Estado de erro em campos */
.lf-input--error,
.lf-select--error,
.lf-textarea--error {
  border-color: var(--error);
}

.lf-input--error:focus,
.lf-select--error:focus,
.lf-textarea--error:focus {
  box-shadow: 0 0 0 3px oklch(52% 0.18 25 / 0.12);
}

/* Mensagem de erro inline */
.lf-error-msg {
  display: none;
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: var(--space-1);
}

.lf-error-msg--visible {
  display: block;
}

/* ── Dois campos lado a lado (quantidade + paradas) ──────── */
.lf-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 480px) {
  .lf-field-row {
    grid-template-columns: 1fr;
  }
}

/* ── Banner de emergência (aparece na step 3) ────────────── */
.lf-emergency-banner {
  display: none;
  background: oklch(64% 0.19 45 / 0.08);
  border: 1.5px solid var(--emergency);
  border-radius: var(--radius-md);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-6);
}

.lf-emergency-banner--visible {
  display: block;
}

.lf-emergency-banner-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: oklch(38% 0.14 40);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.lf-emergency-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.lf-btn-emergency-wa {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--emergency);
  color: white;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.lf-btn-emergency-wa:hover {
  background: var(--emergency-hover);
}

.lf-emergency-phone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: oklch(38% 0.14 40);
  font-weight: 600;
  text-decoration: none;
}

.lf-emergency-phone:hover {
  text-decoration: underline;
}

/* ── Rodapé do formulário: botões de navegação ───────────── */
.lf-footer {
  padding: var(--space-6) var(--space-8);
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.lf-btn-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}

.lf-btn-back:hover {
  color: var(--ink);
  background: var(--surface-up);
}

.lf-btn-back:focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

/* Botão primario de avancar */
.lf-btn-next {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: white;
  background: var(--brand);
  border: none;
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-8);
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  box-shadow: var(--shadow);
}

.lf-btn-next:hover {
  background: var(--brand-mid);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.lf-btn-next:active {
  transform: translateY(0);
}

.lf-btn-next:focus-visible {
  outline: 2px solid var(--brand-bright);
  outline-offset: 2px;
}

.lf-btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Painel de Sucesso ───────────────────────────────────── */
.lf-success {
  display: none;
  text-align: center;
  padding: var(--space-12) var(--space-8);
}

.lf-success--visible {
  display: block;
}

.lf-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--success-bg);
  border: 1.5px solid oklch(52% 0.15 145 / 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-6);
}

.lf-success-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink-strong);
  margin-bottom: var(--space-3);
}

.lf-success-sub {
  font-size: var(--text-base);
  color: var(--ink-dim);
  max-width: 38ch;
  margin: 0 auto var(--space-8);
  line-height: 1.6;
}

.lf-success-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  display: inline-block;
  margin-bottom: var(--space-8);
}

.lf-success-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
}

.lf-success-link:hover {
  color: var(--brand-mid);
}

/* ── Região aria-live (anuncio de mudança de passo) ──────── */
.lf-aria-live {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── Responsivo mobile ───────────────────────────────────── */
@media (max-width: 600px) {
  .lf-body {
    padding: var(--space-6);
  }

  .lf-header {
    padding: var(--space-5) var(--space-6);
  }

  .lf-footer {
    padding: var(--space-5) var(--space-6);
  }

  .lf-btn-next {
    padding: var(--space-3) var(--space-6);
  }
}

/* ============================================================
   DARK MODAL THEME OVERRIDES
   Scoped to .quote-modal so the conversational form looks great
   on the dark, gold-accented landing. Engineered Midnight palette.
   ============================================================ */
.quote-modal {
  --df-gold: #d8b15a;
  --df-gold-soft: #e7cd92;
  --df-surface: #0d1428;
  --df-surface-2: #111a31;
  --df-line: rgba(255, 255, 255, 0.10);
  --df-line-strong: rgba(255, 255, 255, 0.16);
  --df-text: rgba(255, 255, 255, 0.74);
  --df-text-dim: rgba(255, 255, 255, 0.50);
}

/* Wrapper + card: dialog already supplies the shell, so the inner
   card goes transparent/borderless to sit flush inside the modal. */
.quote-modal #lead-form-root {
  background: transparent;
  color: var(--df-text);
}
.quote-modal .lf-card {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  max-width: none;
  margin: 0;
}

/* Header / progress */
.quote-modal .lf-header {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--df-line);
}
.quote-modal .lf-step-label { color: var(--df-gold); }
.quote-modal .lf-step-fraction { color: var(--df-text-dim); }
.quote-modal .lf-progress-bar-track { background: rgba(255, 255, 255, 0.10); }
.quote-modal .lf-progress-bar-fill {
  background: linear-gradient(90deg, var(--df-gold), var(--df-gold-soft));
  box-shadow: 0 0 10px rgba(216, 177, 90, 0.5);
}

/* Question */
.quote-modal .lf-question { color: #fff; }
.quote-modal .lf-question-sub { color: var(--df-text-dim); }

/* Insight */
.quote-modal .lf-insight {
  background: rgba(216, 177, 90, 0.07);
  border-left-color: var(--df-gold);
  color: var(--df-gold-soft);
}
.quote-modal .lf-insight-icon { color: var(--df-gold); }
.quote-modal .lf-insight--emergency {
  background: rgba(249, 115, 22, 0.10);
  border-left-color: #f97316;
  color: #fdba74;
}
.quote-modal .lf-insight--emergency .lf-insight-icon { color: #fb923c; }

/* Radio option cards */
.quote-modal .lf-option-label {
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--df-line);
  color: var(--df-text);
}
.quote-modal .lf-option-label:hover {
  border-color: rgba(216, 177, 90, 0.45);
  background: rgba(216, 177, 90, 0.06);
}
.quote-modal .lf-option-input:checked + .lf-option-label {
  border-color: var(--df-gold);
  background: rgba(216, 177, 90, 0.10);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(216, 177, 90, 0.15);
}
.quote-modal .lf-option-marker {
  border-color: var(--df-line-strong);
  background: transparent;
}
.quote-modal .lf-option-input:checked + .lf-option-label .lf-option-marker {
  border-color: var(--df-gold);
  background: var(--df-gold);
}
.quote-modal .lf-option-marker::after { background: #1a1205; }
.quote-modal .lf-option-input:focus-visible + .lf-option-label {
  outline-color: var(--df-gold-soft);
}

/* Checkboxes */
.quote-modal .lf-checkbox-item {
  border-color: var(--df-line);
  background: rgba(255, 255, 255, 0.02);
}
.quote-modal .lf-checkbox-item:hover {
  border-color: rgba(216, 177, 90, 0.4);
  background: rgba(216, 177, 90, 0.05);
}
.quote-modal .lf-checkbox-box {
  border-color: var(--df-line-strong);
  background: transparent;
}
.quote-modal .lf-checkbox-input:checked + .lf-checkbox-box {
  border-color: var(--df-gold);
  background: var(--df-gold);
}
.quote-modal .lf-checkbox-input:checked + .lf-checkbox-box .lf-checkbox-tick { stroke: #1a1205; }
.quote-modal .lf-checkbox-label-text { color: var(--df-text); }
.quote-modal .lf-checkbox-input:focus-visible + .lf-checkbox-box { outline-color: var(--df-gold-soft); }

/* Inputs / selects / textarea */
.quote-modal .lf-label { color: rgba(255, 255, 255, 0.82); }
.quote-modal .lf-label-optional { color: var(--df-text-dim); }
.quote-modal .lf-input,
.quote-modal .lf-select,
.quote-modal .lf-textarea {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--df-line-strong);
  color: #fff;
}
.quote-modal .lf-input::placeholder,
.quote-modal .lf-textarea::placeholder { color: var(--df-text-dim); }
.quote-modal .lf-input:focus,
.quote-modal .lf-select:focus,
.quote-modal .lf-textarea:focus {
  border-color: var(--df-gold);
  box-shadow: 0 0 0 3px rgba(216, 177, 90, 0.15);
}
.quote-modal .lf-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23d8b15a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.quote-modal .lf-select option { background: #0d1428; color: #fff; }

/* Footer + nav buttons */
.quote-modal .lf-footer {
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid var(--df-line);
}
.quote-modal .lf-btn-back { color: var(--df-text-dim); }
.quote-modal .lf-btn-back:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.quote-modal .lf-btn-next {
  color: #1a1205;
  background: linear-gradient(180deg, var(--df-gold-soft), var(--df-gold));
  box-shadow: 0 10px 26px -12px rgba(216, 177, 90, 0.6);
}
.quote-modal .lf-btn-next:hover {
  filter: brightness(1.05);
  background: linear-gradient(180deg, var(--df-gold-soft), var(--df-gold));
  box-shadow: 0 14px 34px -12px rgba(216, 177, 90, 0.75);
}

/* Success panel */
.quote-modal .lf-success-icon {
  background: rgba(111, 207, 151, 0.10);
  border-color: rgba(111, 207, 151, 0.3);
}
.quote-modal .lf-success-title { color: #fff; }
.quote-modal .lf-success-sub { color: var(--df-text); }
.quote-modal .lf-success-id {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--df-line);
  color: var(--df-text-dim);
}
.quote-modal .lf-success-link { color: var(--df-gold); }
.quote-modal .lf-success-link:hover { color: var(--df-gold-soft); }
