/* ==========================================================================
   FORMULÁRIO DE QUALIFICAÇÃO & PAINEL ADMIN - ESTILO TYPEFORM / TALLY
   ========================================================================== */

:root {
  --bg-color: #050505;
  --card-bg: #121215;
  --input-bg: #1a1a1e;
  --input-border: #2e2e36;
  --input-border-hover: #454552;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent-color: #ffffff;
  --accent-text: #000000;
  --accent-glow: rgba(255, 255, 255, 0.15);
  --success-color: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.12);
  --danger-color: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --brand-blue: #3b82f6;
  --brand-purple: #8b5cf6;
  
  --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset básico */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Regras Estritas da Rota /admin */
html.is-admin-route #form-container,
html.is-admin-route #main-header,
html.is-admin-route #form-footer,
html.is-admin-route #progress-container,
body.admin-active-page #form-container,
body.admin-active-page #main-header,
body.admin-active-page #form-footer,
body.admin-active-page #progress-container {
  display: none !important;
}

html.is-admin-route #admin-standalone,
body.admin-active-page #admin-standalone {
  display: block !important;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 32px;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  z-index: 10;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--text-main);
}

.logo-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success-color);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--success-color);
}

/* Barra de Progresso */
.progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.06);
  z-index: 100;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #22c55e);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 0 2px 2px 0;
}

/* Container do Formulário */
.form-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px 80px 24px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* Cards das Etapas */
.step-card {
  display: none;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.step-card.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Elementos da Etapa */
.welcome-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.step-header-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.step-total {
  color: var(--text-dim);
  font-weight: 400;
}

.step-title, .welcome-title {
  font-family: var(--font-heading);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.welcome-title {
  font-size: 36px;
}

.step-question {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  margin-bottom: 10px;
}

.step-subtitle, .welcome-text {
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-weight: 400;
}

.welcome-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--text-main);
  padding: 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 36px;
  line-height: 1.5;
}

/* Inputs Personalizados */
.input-group {
  position: relative;
  width: 100%;
  margin-bottom: 28px;
}

.custom-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  font-size: 18px;
  font-family: var(--font-body);
  color: var(--text-main);
  outline: none;
  transition: var(--transition-fast);
}

.custom-input:focus {
  border-color: var(--text-main);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
  background: #1e1e23;
}

.custom-input::placeholder {
  color: var(--text-dim);
}

/* Instagram Input com Prefixo */
.instagram-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-fast);
}

.instagram-input-wrapper:focus-within {
  border-color: var(--text-main);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.insta-prefix {
  padding-left: 20px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dim);
  user-select: none;
}

.insta-input {
  border: none !important;
  box-shadow: none !important;
  padding-left: 6px !important;
  background: transparent !important;
}

/* Opções de Múltipla Escolha */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 24px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.option-btn:hover {
  background: #232329;
  border-color: var(--input-border-hover);
  transform: translateX(3px);
}

.option-btn.selected {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--text-main);
  box-shadow: 0 0 0 2px var(--text-main);
}

.option-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  flex-shrink: 0;
  transition: var(--transition-fast);
}

.option-btn.selected .option-badge {
  background: var(--accent-color);
  color: var(--accent-text);
  border-color: var(--accent-color);
}

.option-text {
  flex: 1;
  line-height: 1.4;
}

/* Botões e Ações */
.action-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent-color);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 28px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

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

.keyboard-hint {
  font-size: 13px;
  color: var(--text-dim);
}

.keyboard-hint strong {
  color: var(--text-muted);
  font-weight: 600;
}

/* Mensagens de Erro */
.error-msg {
  display: none;
  color: var(--danger-color);
  font-size: 14px;
  font-weight: 500;
  margin-top: -16px;
  margin-bottom: 20px;
}

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

/* Tela de Conclusão e WhatsApp */
.completion-box {
  text-align: center;
  padding: 20px 0;
}

.status-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  margin: 0 auto 28px auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--text-main);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.approved-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  color: var(--success-color);
  border: 1px solid rgba(34, 197, 94, 0.3);
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.whatsapp-instruction {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 32px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: #25D366;
  color: #000000;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 800;
  padding: 18px 36px;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: 0 8px 30px rgba(37, 211, 102, 0.3);
  transition: var(--transition-normal);
  letter-spacing: 0.3px;
  width: 100%;
  max-width: 440px;
}

.btn-whatsapp:hover {
  background-color: #20bd5a;
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(37, 211, 102, 0.45);
}

.redirect-countdown {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-dim);
}

#timer-sec {
  font-weight: 700;
  color: var(--text-main);
}

/* Footer Rodapé */
.form-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 10;
}

.powered-by {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
}

.footer-nav {
  display: flex;
  gap: 6px;
}

.btn-step-nav {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-step-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.btn-step-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ==========================================================================
   ÁREA DE ADMINISTRADOR DEDICADA (SLUG /ADMIN)
   ========================================================================== */

.admin-standalone-wrapper {
  width: 100%;
  max-width: 1100px;
  margin: 30px auto;
  padding: 0 20px;
}

.admin-modal-card {
  background: #121216;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.admin-modal-card.standalone-card {
  min-height: 620px;
}

.admin-modal-card.mini-card {
  max-width: 600px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-main);
}

.admin-title-box h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
}

.admin-subtitle {
  font-size: 12px;
  color: var(--text-dim);
}

.btn-exit-admin {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: var(--transition-fast);
}

.btn-exit-admin:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.admin-view {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

/* Login Admin */
.admin-login-box {
  max-width: 360px;
  margin: 40px auto;
  text-align: center;
}

.lock-icon {
  font-size: 40px;
  margin-bottom: 16px;
}

.admin-login-box h4 {
  font-size: 20px;
  margin-bottom: 8px;
}

.admin-login-box p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.admin-login-box form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Dashboard Tabs */
.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.admin-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.admin-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.admin-tab.active {
  background: var(--text-main);
  color: #000000;
  border-color: var(--text-main);
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* Barra de Filtros */
.admin-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.search-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-wrapper svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.search-wrapper input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 40px;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.search-wrapper input:focus {
  border-color: var(--text-main);
}

.admin-select {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.admin-export-btns {
  display: flex;
  gap: 10px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger-color);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-danger-outline:hover {
  background: var(--danger-bg);
}

/* Tabela de Leads */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.leads-table th {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 600;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.leads-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  white-space: nowrap;
}

.leads-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.utm-badge {
  display: inline-block;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.btn-view-lead {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.btn-view-lead:hover {
  background: rgba(255, 255, 255, 0.15);
}

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-dim);
  font-size: 15px;
}

/* Métricas Dashboard */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 20px;
}

.metric-label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
}

.metric-value.highlight {
  color: #60a5fa;
}

.section-subtitle {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-main);
}

.utm-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.utm-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--input-bg);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--input-border);
}

/* Configurações Form */
.settings-form {
  max-width: 600px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.form-group small {
  font-size: 12px;
  color: var(--text-dim);
}

.success-msg {
  margin-top: 14px;
  color: var(--success-color);
  font-size: 14px;
  font-weight: 600;
}

/* Detalhes do Lead Modal Body */
.lead-detail-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 14px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 10px;
}

.detail-label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-val {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

/* Modal Detalhes Lead */
.admin-modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-modal-backdrop.active {
  display: flex;
}

/* Responsividade */
@media (max-width: 640px) {
  .app-header {
    padding: 16px 20px;
  }
  
  .step-title, .welcome-title {
    font-size: 26px;
  }

  .step-question {
    font-size: 22px;
  }

  .form-container {
    padding: 10px 18px 90px 18px;
  }

  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .keyboard-hint {
    display: none;
  }

  .admin-standalone-wrapper {
    padding: 0 10px;
    margin: 15px auto;
  }

  .admin-view {
    padding: 16px;
  }

  .admin-tabs {
    flex-wrap: wrap;
  }
}
