/* ============================================================
   Gastro Quiz — Clínica Integrativa Nah Saúde e Bem Estar
   Paleta: NAH Camargo (#630871 roxo, #041a49 azul marinho)
   Fonte: Montserrat
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:        #630871;
  --primary-light:  #8b2fa8;
  --primary-dark:   #4a0655;
  --secondary:      #041a49;
  --bg:             #fff6ff;
  --bg-card:        #ffffff;
  --text:           #041a49;
  --text-muted:     #6b5c7a;
  --border:         #e8d5f0;
  --success:        #16a34a;
  --warning:        #d97706;
  --danger:         #dc2626;
  --orange:         #ea580c;
  --radius:         12px;
  --shadow:         0 4px 24px rgba(99,8,113,0.10);
  --shadow-lg:      0 8px 40px rgba(99,8,113,0.16);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- HEADER ---- */
.site-header {
  background: #ffffff;
  border-bottom: 2px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(99,8,113,0.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header img {
  height: 64px;
  width: auto;
  object-fit: contain;
}

/* ---- LAYOUT ---- */
.quiz-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 16px 100px;
}

/* ---- PROGRESS ---- */
.progress-bar-wrap {
  margin-bottom: 24px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.23,1,0.32,1);
}

/* ---- CARD ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 28px 24px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.3;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ---- SCIENTIFIC BADGE ---- */
.sci-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99,8,113,0.07);
  border: 1px solid rgba(99,8,113,0.2);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
}

.sci-badge::before { content: '🔬'; font-size: 13px; }

/* ---- OPTIONS GRID ---- */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.option-item {
  position: relative;
}

.option-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.18s ease;
  background: #fff;
  text-align: center;
  min-height: 80px;
  justify-content: center;
}

.option-label:hover {
  border-color: var(--primary-light);
  background: rgba(99,8,113,0.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99,8,113,0.12);
}

.option-item input[type="radio"]:checked + .option-label {
  border-color: var(--primary);
  background: rgba(99,8,113,0.07);
  box-shadow: 0 0 0 3px rgba(99,8,113,0.15);
}

.option-item:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  max-width: 50%;
  margin: 0 auto;
  width: 100%;
}

.option-icon {
  font-size: 28px;
  line-height: 1;
}

.option-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.option-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Bristol SVG */
.bristol-svg {
  width: 48px;
  height: 32px;
}

/* ---- IMC BUTTON ---- */
.imc-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1.5px dashed var(--primary);
  border-radius: 99px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  cursor: pointer;
  margin: 16px auto 0;
  font-family: inherit;
  transition: all 0.18s ease;
}

.imc-btn:hover {
  background: rgba(99,8,113,0.06);
  transform: translateY(-1px);
}

/* ---- MODAL ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4,26,73,0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.23,1,0.32,1);
}

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

.modal h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  margin-top: -4px;
}

/* ---- FORM ---- */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.18s;
  outline: none;
}

.form-input:focus { border-color: var(--primary); }

.form-input.error { border-color: var(--danger); }

.form-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.form-error.show { display: block; }

/* IMC table */
.imc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.imc-table th, .imc-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.imc-table th { font-weight: 700; color: var(--text-muted); font-size: 11px; text-transform: uppercase; }
.imc-table tr.active td { background: rgba(99,8,113,0.08); font-weight: 700; color: var(--primary); }

.imc-result {
  background: rgba(99,8,113,0.07);
  border: 1.5px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  text-align: center;
}

.imc-result .imc-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.imc-result .imc-class {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-top: 2px;
}

/* ---- FOOTER BAR ---- */
.footer-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 2px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 -4px 20px rgba(99,8,113,0.10);
  z-index: 50;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 32px;
  border-radius: 99px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  box-shadow: 0 4px 16px rgba(99,8,113,0.30);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 6px 24px rgba(99,8,113,0.40);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-outline:hover {
  background: rgba(99,8,113,0.06);
  transform: translateY(-1px);
}

.btn-whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: #fff;
  box-shadow: 0 4px 16px rgba(37,211,102,0.30);
  font-size: 16px;
  padding: 16px 36px;
}

.btn-whatsapp:hover {
  box-shadow: 0 6px 24px rgba(37,211,102,0.40);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}

/* ---- RESULT PAGE ---- */
.result-header {
  text-align: center;
  padding: 28px 24px 20px;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-radius: 99px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}

.result-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.result-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.result-section {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 14px;
}

.result-section h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.result-section p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.answer-item {
  background: rgba(99,8,113,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.answer-item .answer-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.answer-item .answer-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
}

.cta-section {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  color: #fff;
  margin-bottom: 14px;
}

.cta-section h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
}

.cta-section p {
  font-size: 14px;
  opacity: 0.9;
  margin-bottom: 20px;
  line-height: 1.6;
}

.sci-footer {
  background: rgba(99,8,113,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 8px;
}

.sci-footer strong { color: var(--primary); }

/* ---- ADMIN ---- */
.admin-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar input, .filter-bar select {
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

.table-wrap {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: auto;
  box-shadow: var(--shadow);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background: rgba(99,8,113,0.06);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:hover td { background: rgba(99,8,113,0.03); }

.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.risk-baixo      { background: #16a34a; }
.risk-medio      { background: #d97706; }
.risk-alto       { background: #ea580c; }
.risk-muito_alto { background: #dc2626; }

/* ---- DETAIL PAGE ---- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; }
  .answers-grid { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

/* ---- PRINT ---- */
@media print {
  .site-header, .footer-bar, .btn, .imc-btn, .filter-bar, .no-print { display: none !important; }
  body { background: #fff; }
  .card, .result-section { box-shadow: none; border: 1px solid #ddd; }
}

/* ---- ALERTS ---- */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #dc2626; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #16a34a; }

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  text-align: center;
}

.login-card img { height: 80px; margin-bottom: 20px; }
.login-card h2 { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.login-card p { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
