/* ==========================================================================
   BM FIRMA DE ADVOGADOS
   Quiz de Qualificação Estilo Chat de WhatsApp — Multipropriedade
   Design System: Luxo Refinado (Preto Absoluto & Dourado)
   ========================================================================== */

/* 1. VARIÁVEIS DO SISTEMA */
:root {
  /* Cores Base */
  --bg-main: #0B0B0C;
  --bg-card: #121316;
  --bg-card-header: #18191E;
  --bg-card-hover: #1E1F25;
  --bg-card-selected: #24221A;
  --bg-input: #0E0F12;
  --bg-surface: #15161A;

  /* Cores Chat */
  --chat-bg: #0D0E12;
  --chat-bubble-attendant: #1E212B;
  --chat-bubble-user: #2E2514;
  --chat-bubble-user-border: rgba(201, 168, 76, 0.45);

  /* Paleta Dourada Refinada (BM Firma de Advogados) */
  --gold-primary: #C9A84C;
  --gold-light: #E5C978;
  --gold-dark: #96792D;
  --gold-glow: rgba(201, 168, 76, 0.22);
  --gold-glow-strong: rgba(201, 168, 76, 0.45);
  --gold-gradient: linear-gradient(135deg, #F3DF9A 0%, #C9A84C 50%, #96792D 100%);
  --gold-gradient-hover: linear-gradient(135deg, #FFF0B8 0%, #D8B75B 50%, #A88837 100%);

  /* Cores de Texto */
  --text-primary: #FFFFFF;
  --text-secondary: #D4D4D8;
  --text-muted: #8E8E98;
  --text-dark: #0B0B0C;
  --green-online: #25D366;

  /* Bordas e Divisórias */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(201, 168, 76, 0.35);
  --border-gold-active: #C9A84C;

  /* Tipografia */
  --font-heading: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Dimensões e Efeitos */
  --container-max-w: 680px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-card: 0 16px 40px -10px rgba(0, 0, 0, 0.85);
  --shadow-gold: 0 8px 25px -5px rgba(201, 168, 76, 0.3);
}

/* 2. RESET E BASE */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(201, 168, 76, 0.08) 0%, transparent 60%),
    radial-gradient(circle at 10% 80%, rgba(201, 168, 76, 0.04) 0%, transparent 40%);
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* 3. ESTRUTURA GLOBAL */
.quiz-wrapper {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--container-max-w);
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
}

/* 4. CABEÇALHO */
.header-brand {
  text-align: center;
  padding-bottom: 20px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.brand-logo-link {
  display: inline-block;
  transition: opacity var(--transition-fast);
}

.brand-logo-link:hover {
  opacity: 0.9;
}

.brand-logo {
  max-width: 230px;
  height: auto;
  object-fit: contain;
  display: block;
}

.time-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(201, 168, 76, 0.1);
  border: 1px solid rgba(201, 168, 76, 0.25);
  color: var(--gold-light);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.time-badge svg {
  width: 14px;
  height: 14px;
  color: var(--gold-primary);
  flex-shrink: 0;
}

/* 5. BARRA DE PROGRESSO */
.progress-container {
  margin-bottom: 20px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.progress-step-text strong {
  color: var(--gold-light);
  font-weight: 600;
}

.progress-percent-text {
  color: var(--gold-primary);
  font-weight: 600;
}

.progress-track {
  width: 100%;
  height: 5px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
  box-shadow: 0 0 10px var(--gold-glow);
}

/* 6. CONTAINER DO CHAT ESTILO WHATSAPP LUXO */
.chat-card-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Cabeçalho do Chat */
.chat-header-bar {
  background-color: var(--bg-card-header);
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-attendant-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar-wrapper {
  position: relative;
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  background-color: #000000;
  border-radius: 50%;
  padding: 2px;
}

.chat-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  background-color: #000000;
  border: 1.5px solid var(--gold-primary);
  display: block;
}

.online-indicator {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 13px;
  height: 13px;
  background-color: var(--green-online);
  border: 2px solid var(--bg-card-header);
  border-radius: 50%;
}

.chat-attendant-details {
  display: flex;
  flex-direction: column;
}

.attendant-name {
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.attendant-role {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-light);
  font-size: 0.75rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  background-color: var(--green-online);
  border-radius: 50%;
  display: inline-block;
}

.chat-step-badge {
  background-color: rgba(201, 168, 76, 0.12);
  color: var(--gold-light);
  border: 1px solid rgba(201, 168, 76, 0.25);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

/* Área de Mensagens */
.chat-messages-area {
  background-color: var(--chat-bg);
  background-image: 
    radial-gradient(circle at 80% 20%, rgba(201, 168, 76, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 20% 80%, rgba(201, 168, 76, 0.02) 0%, transparent 40%);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 280px;
  max-height: 480px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.chat-messages-area::-webkit-scrollbar {
  width: 6px;
}
.chat-messages-area::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
.chat-messages-area::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 76, 0.3);
  border-radius: 3px;
}

/* Balões de Mensagem */
.chat-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  animation: messageIn 0.3s ease-out forwards;
}

.chat-row.attendant {
  justify-content: flex-start;
}

.chat-row.user {
  justify-content: flex-end;
}

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

.mini-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: contain;
  background-color: #000000;
  border: 1px solid var(--gold-primary);
  flex-shrink: 0;
  margin-bottom: 2px;
  padding: 2px;
}

.message-bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9375rem;
  line-height: 1.5;
  position: relative;
}

.chat-row.attendant .message-bubble {
  background-color: var(--chat-bubble-attendant);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom-left-radius: 4px;
}

.chat-row.user .message-bubble {
  background-color: var(--chat-bubble-user);
  color: #FFF;
  border: 1px solid var(--chat-bubble-user-border);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.message-time {
  display: block;
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 4px;
}

.chat-row.user .message-time {
  color: rgba(229, 201, 120, 0.75);
}

/* Digitando / Typing Indicator */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background-color: var(--chat-bubble-attendant);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background-color: var(--gold-primary);
  border-radius: 50%;
  animation: typingPulse 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingPulse {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Área de Interação e Opções de Respostas */
.chat-interaction-area {
  background-color: var(--bg-card);
  border-top: 1px solid rgba(201, 168, 76, 0.2);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.interaction-prompt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.chat-options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-opt-btn {
  background-color: var(--bg-card-header);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.chat-opt-btn:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px var(--gold-glow);
}

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

.chat-opt-btn .opt-arrow {
  color: var(--gold-primary);
  font-size: 1.125rem;
  transition: transform var(--transition-fast);
}

.chat-opt-btn:hover .opt-arrow {
  transform: translateX(4px);
}

/* 7. TELAS DE RESULTADO E ANÁLISE */
.quiz-analyzing-screen,
.quiz-final-screen,
.quiz-disqualified-screen {
  padding: 36px 24px;
}

.analyzing-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 10px;
}

.spinner-gold {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(201, 168, 76, 0.2);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 24px;
}

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

.analyzing-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.analyzing-status {
  color: var(--gold-light);
  font-size: 0.9375rem;
  font-weight: 500;
}

.result-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.result-badge {
  display: inline-block;
  background-color: rgba(201, 168, 76, 0.12);
  border: 1px solid rgba(201, 168, 76, 0.3);
  color: var(--gold-light);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
}

.result-badge.info {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
}

.result-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.result-icon-circle.success {
  background: var(--gold-gradient);
  color: var(--text-dark);
  box-shadow: 0 0 25px var(--gold-glow-strong);
}

.result-icon-circle.info {
  background-color: #1E212B;
  color: var(--gold-primary);
  border: 1px solid var(--border-gold);
}

.result-icon-circle svg {
  width: 32px;
  height: 32px;
}

.result-title {
  font-family: var(--font-heading);
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.35;
}

.result-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 24px;
  max-width: 520px;
  line-height: 1.6;
}

/* Resumo do Caso */
.case-summary {
  width: 100%;
  background-color: var(--bg-surface);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 24px;
  text-align: left;
}

.case-summary-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold-light);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.case-summary-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.case-summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.875rem;
}

.case-summary-label {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.case-summary-value {
  color: var(--text-primary);
  font-weight: 500;
}

/* Botão de WhatsApp */
.cta-container {
  width: 100%;
}

/* Botão WhatsApp Final com Gradiente Verde Escuro para Claro Sofisticado (Sem Estourar) */
#btnWhatsappSubmit {
  background: linear-gradient(135deg, #0d5f49 0%, #17835c 50%, #209968 100%) !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 18px rgba(16, 122, 85, 0.4) !important;
  border: 1px solid rgba(255, 255, 255, 0.18) !important;
}

#btnWhatsappSubmit svg {
  color: #FFFFFF !important;
  fill: #FFFFFF !important;
}

#btnWhatsappSubmit:hover {
  background: linear-gradient(135deg, #106f56 0%, #1a966a 50%, #25ab75 100%) !important;
  box-shadow: 0 6px 24px rgba(23, 150, 106, 0.55) !important;
  transform: translateY(-2px);
}

#btnWhatsappSubmit:active {
  transform: translateY(0);
}

.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--gold-gradient);
  color: var(--text-dark);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 24px;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 20px var(--gold-glow);
}

.btn-primary:hover {
  background: var(--gold-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--gold-glow-strong);
}

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

.legal-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 16px;
  line-height: 1.4;
}

.legal-notice svg {
  width: 14px;
  height: 14px;
  color: var(--gold-primary);
  flex-shrink: 0;
}

.btn-back {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-back:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
  color: #FFF;
}

/* 8. RODAPÉ INSTITUCIONAL */
.footer-global {
  flex-shrink: 0;
  background-color: #070708;
  border-top: 1px solid rgba(201, 168, 76, 0.15);
  padding: 36px 20px 24px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--container-max-w);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
}

.footer-info-grid {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.footer-info-grid strong {
  color: var(--gold-light);
}

.footer-contact-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.footer-contact-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-contact-item:hover {
  color: var(--gold-primary);
}

.footer-contact-item svg {
  width: 16px;
  height: 16px;
  color: var(--gold-primary);
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
  max-width: 580px;
}

.mega-ads-credit {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.mega-ads-credit a {
  display: inline-flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.mega-ads-credit a:hover {
  opacity: 1;
}

.mega-ads-credit img {
  height: 18px;
  width: auto;
}

/* 9. BOTÃO FLUTUANTE DO WHATSAPP COM DEGRADÊ VERDE SOFISTICADO */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #0d5f49 0%, #17835c 50%, #209968 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 2px 10px rgba(16, 122, 85, 0.4);
  z-index: 999;
  transition: all var(--transition-fast);
}

.whatsapp-float:hover {
  transform: scale(1.08);
  background: linear-gradient(135deg, #106f56 0%, #1a966a 50%, #25ab75 100%);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 4px 15px rgba(23, 150, 106, 0.55);
}

.whatsapp-float svg {
  width: 32px;
  height: 32px;
  fill: currentColor;
}

.whatsapp-float-tooltip {
  position: absolute;
  right: 68px;
  background-color: #17171A;
  color: #FFF;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.whatsapp-float:hover .whatsapp-float-tooltip {
  opacity: 1;
}

/* 10. RESPONSIVIDADE MOBILE FIRST */
@media (max-width: 600px) {
  .quiz-wrapper {
    padding: 16px 12px 36px;
  }

  .chat-card-container {
    border-radius: var(--radius-md);
  }

  .chat-header-bar {
    padding: 12px 14px;
  }

  .chat-avatar-wrapper {
    width: 42px;
    height: 42px;
  }

  .attendant-name {
    font-size: 0.875rem;
  }

  .attendant-role {
    font-size: 0.6875rem;
  }

  .chat-messages-area {
    padding: 16px 12px;
    min-height: 250px;
    max-height: 400px;
    gap: 12px;
  }

  .message-bubble {
    max-width: 88%;
    font-size: 0.875rem;
    padding: 10px 14px;
  }

  .mini-avatar {
    width: 28px;
    height: 28px;
  }

  .chat-interaction-area {
    padding: 14px 12px;
  }

  .chat-opt-btn {
    padding: 12px 14px;
    font-size: 0.875rem;
  }

  .result-title {
    font-size: 1.1875rem;
  }

  .result-subtitle {
    font-size: 0.875rem;
  }

  .btn-primary {
    font-size: 0.875rem;
    padding: 14px 16px;
  }

  .whatsapp-float {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }

  .whatsapp-float svg {
    width: 28px;
    height: 28px;
  }

  .whatsapp-float-tooltip {
    display: none;
  }
}
