/**
 * Estilos da Frente Isolada: Quiz & Atribuição — Creatore
 * Responsivo (otimizado para 390px mobile e desktop), acessível e de alto contraste.
 */

:root {
  --bg-primary: #0a0b10;
  --bg-card: #13151f;
  --bg-card-subtle: #1a1d2d;
  --text-main: #f0f2f5;
  --text-muted: #9aa3b5;
  --text-dim: #647087;
  --primary: #06b6d4;
  --primary-hover: #0891b2;
  --accent: #d946ef;
  --border: #232738;
  --border-focus: #38bdf8;
  --error: #f43f5e;
  --error-bg: rgba(244, 63, 94, 0.12);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease-in-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 1rem 3rem;
  overflow-x: hidden;
  max-width: 100vw;
}

.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

/* Header de navegação e identificação */
.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 1rem;
}

.header-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--primary);
  box-shadow: 0 0 8px var(--primary);
}

.brand-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 30%, var(--primary) 70%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Metadados de Atribuição (Banner Técnico) */
.attribution-panel {
  background: var(--bg-card-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.attribution-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.attr-tag {
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.75rem;
}

.attr-tag.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Card Principal do Quiz */
.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  margin-bottom: 2rem;
}

/* Barra de Progresso */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-card-subtle);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.progress-bar-fill {
  height: 100%;
  width: 25%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.3s ease;
}

.step-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Fieldset e Perguntas */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

legend {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.question-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Opções de Resposta */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.option-label {
  display: flex;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.option-label:hover {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.05);
}

.option-label input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--text-dim);
  border-radius: 50%;
  margin-right: 0.85rem;
  display: grid;
  place-content: center;
  transition: var(--transition);
  flex-shrink: 0;
}

.option-label input[type="radio"]::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: scale(0);
  transition: 0.15s transform ease-in-out;
  background-color: var(--primary);
}

.option-label input[type="radio"]:checked {
  border-color: var(--primary);
}

.option-label input[type="radio"]:checked::before {
  transform: scale(1);
}

.option-label:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: rgba(6, 182, 212, 0.08);
}

.option-text {
  font-size: 0.95rem;
  color: var(--text-main);
  font-weight: 500;
}

/* Mensagem de Erro de Validação */
.quiz-error {
  min-height: 1.25rem;
  font-size: 0.825rem;
  color: var(--error);
  font-weight: 500;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Ações e Navegação */
.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border-color: var(--text-dim);
}

.btn-secondary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #000;
  font-weight: 700;
  flex: 1;
  max-width: 220px;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.4);
}

/* Painel de Resultado do Quiz */
.quiz-result-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.result-badge {
  display: inline-block;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content;
}

.result-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.recommendation-box {
  background: var(--bg-card-subtle);
  border-left: 4px solid var(--primary);
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
  padding: 1rem 1.15rem;
  font-size: 0.95rem;
}

.recommendation-box h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.35rem;
}

.practice-box {
  background: rgba(217, 70, 239, 0.08);
  border-left: 4px solid var(--accent);
  border-radius: 4px var(--radius-sm) var(--radius-sm) 4px;
  padding: 1rem 1.15rem;
  font-size: 0.95rem;
}

.practice-box h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

/* Seção de Oferta e CTA P1 */
.offer-section {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}

.offer-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.offer-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.offer-price {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
}

.offer-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.cta-button {
  width: 100%;
  padding: 0.9rem 1.25rem;
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 18px rgba(6, 182, 212, 0.3);
}

.cta-button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Banner de Aviso: Checkout Real Pendente */
.checkout-notice-box {
  margin-top: 1rem;
  padding: 0.9rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: #fbbf24;
  line-height: 1.4;
}

.checkout-notice-box strong {
  display: block;
  margin-bottom: 0.25rem;
  color: #fef3c7;
}

/* Painel de Auditoria e Telemetria (Local) */
.telemetry-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  width: 100%;
}

.telemetry-card h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.telemetry-log {
  background: #000;
  border: 1px solid #1f2430;
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  max-height: 160px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  color: #38bdf8;
  white-space: pre-wrap;
  word-break: break-all;
}

.telemetry-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
}

/* Modais ou Caixas de Diálogo Acessíveis */
dialog {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  padding: 1.5rem;
  max-width: 440px;
  width: calc(100% - 2rem);
  margin: auto;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

/* Ajustes finos para Mobile (390px) */
@media (max-width: 440px) {
  body {
    padding: 1rem 0.75rem 2rem;
  }
  
  .brand-title {
    font-size: 1.45rem;
  }

  .quiz-card {
    padding: 1.15rem;
  }

  legend {
    font-size: 1.1rem;
  }

  .actions-row {
    flex-direction: column-reverse;
  }

  .btn-primary {
    max-width: 100%;
    width: 100%;
  }

  .btn-secondary {
    width: 100%;
  }
}
