/* [ASSUMPTION] Cores pendentes validação da identidade visual da Dra. Aline */
:root {
  /* Theme tokens — overridden per-quiz via quiz-ui.js */
  --cor-fundo:   #fdf4f5;
  --cor-borda:   #e8d5d8;
  --cor-card:    #ffffff;
  --cor-texto01: #1a1a2e;
  --cor-texto02: #6b6b8a;

  --color-primary:    #2d6a4f;
  --color-secondary:  #c77d8a;
  --color-bg:         var(--cor-fundo);
  --color-surface:    var(--cor-card);
  --color-text:       var(--cor-texto01);
  --color-text-muted: var(--cor-texto02);
  --color-border:     var(--cor-borda);
  --color-selected-bg:#e8f5ee;
  --radius:           12px;
  --radius-sm:        8px;
  --transition:       0.2s ease;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* ── Layout ─────────────────────────────────── */

#quiz-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 28px 20px 24px;
  background: var(--color-surface);
  border: 2px solid rgba(45, 106, 79, 0.28);
  box-shadow: 0 2px 24px rgba(45, 106, 79, 0.07);
}

/* ── Screens ─────────────────────────────────── */

.screen[hidden] { display: none !important; }

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

.screen { animation: fadeIn 0.25s ease; }

/* ── Welcome Screen ──────────────────────────── */

#screen-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding-top: 16px;
}

.welcome-icon {
  font-size: 3rem;
  line-height: 1;
}

.welcome-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.welcome-doctor {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  letter-spacing: 0.02em;
}

.welcome-desc {
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.6;
  max-width: 320px;
}

/* ── Buttons ─────────────────────────────────── */

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0 32px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  min-height: 56px;
  transition: opacity var(--transition), transform var(--transition);
  letter-spacing: 0.01em;
}

.btn-primary:hover  { opacity: 0.92; }
.btn-primary:active { transform: scale(0.98); }

[data-loading] {
  opacity: 0.6;
  pointer-events: none;
}

/* ── Quiz Screen ─────────────────────────────── */

#screen-quiz {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Progress */
.progress-header {
  margin-bottom: 28px;
}

.progress-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: 8px;
  font-weight: 500;
}

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

.progress-fill {
  background: var(--color-primary);
  height: 100%;
  border-radius: 99px;
  transition: width 0.35s ease;
}

/* Question */
.question-text {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  margin-bottom: 24px;
  color: var(--color-text);
}

/* Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-btn {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 15px 16px;
  font-family: inherit;
  font-size: 0.975rem;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
  min-height: 56px;
  width: 100%;
  line-height: 1.35;
  transition: border-color var(--transition), background var(--transition);
}

.option-btn:hover {
  border-color: var(--color-secondary);
  background: #fdf8f9;
}

.option-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-selected-bg);
  font-weight: 500;
}

/* Back button */
.btn-back {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 10px 12px;
  min-height: 44px;
  min-width: 44px;
  align-self: flex-start;
  transition: color var(--transition);
}

.btn-back:hover { color: var(--color-primary); }

/* ── Lead Form Screen ────────────────────────── */

#screen-form {
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}

.form-header {
  margin-bottom: 18px;
  text-align: center;
}

.form-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.form-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* Fields */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
}

.field-optional {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.field-input {
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  height: 48px;
  width: 100%;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.field-input::placeholder { color: var(--color-text-muted); }

.field-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Consent checkbox */
.field-group--consent {
  margin-bottom: 10px;
}

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.consent-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.consent-text {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* Error message */
.form-error {
  background: #fdecea;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: #c0392b;
  margin-bottom: 10px;
  line-height: 1.4;
}

.form-error[hidden] { display: none; }

/* ── CFM Footer ──────────────────────────────── */

#disclaimer-cfm {
  text-align: center;
  padding: 14px 20px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  line-height: 1.5;
}

/* ── Resultado Page ──────────────────────────── */

#result-container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--color-surface);
  border: 2px solid rgba(45, 106, 79, 0.28);
  box-shadow: 0 2px 24px rgba(45, 106, 79, 0.07);
}

/* Doctor card */
.doctor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.doctor-photo-placeholder {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.doctor-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.doctor-specialty {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Gauge */
.gauge-wrapper {
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding-bottom: 8px;
}


.gauge-svg {
  width: 100%;
  height: auto;
  aspect-ratio: 200 / 110;
  display: block;
  overflow: visible;
}

/* Categoria */
.result-category {
  text-align: center;
}

.cat-label {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.2;
}

.cat-desc {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.6;
}

/* Pontos de atenção */
.attention-section {
  background: #fff8f0;
  border: 1px solid #fde8c8;
  border-radius: var(--radius);
  padding: 14px 16px;
}

.attention-section[hidden] { display: none; }

.attention-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.attention-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.attention-list li {
  font-size: 0.85rem;
  color: var(--color-text);
  line-height: 1.45;
}

/* WhatsApp CTA */
.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #25D366;
  color: #fff;
  border-radius: var(--radius);
  padding: 0 20px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 56px;
  text-align: center;
  transition: opacity var(--transition);
  line-height: 1.3;
}

.btn-whatsapp:hover { opacity: 0.92; }

/* Refazer quiz */
.btn-reset {
  display: block;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  padding: 8px;
  min-height: 44px;
  line-height: 44px;
  transition: color var(--transition);
}

.btn-reset:hover { color: var(--color-primary); }

/* ── Painel Admin ────────────────────────────── */

#panel-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.panel-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}

.panel-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Panel buttons */
.btn-panel-primary {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  height: 36px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}
.btn-panel-primary:hover { opacity: 0.88; }

.btn-panel-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  height: 36px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), opacity var(--transition);
  white-space: nowrap;
}
.btn-panel-secondary:hover    { border-color: var(--color-primary); }
.btn-panel-secondary:disabled { opacity: 0.5; cursor: default; }

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-verde    .stat-value { color: #2d6a4f; }
.stat-ambar    .stat-value { color: #d97706; }
.stat-vermelho .stat-value { color: #dc2626; }
.stat-pending  .stat-value { color: var(--color-text-muted); }

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 36px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition);
}
.filter-select:focus { outline: none; border-color: var(--color-primary); }

/* Panel status */
.panel-status {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  padding: 20px 0;
}
.panel-status--error {
  background: #fdecea;
  border: 1px solid #f5c6c6;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #c0392b;
  text-align: left;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.leads-table th {
  background: #f8f4f5;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.leads-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leads-table tr:last-child td { border-bottom: none; }
.leads-table tbody tr:hover    { background: #fdf8f9; }

/* Category badges */
.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}
.cat-verde    { background: #d1fae5; color: #065f46; }
.cat-ambar    { background: #fef3c7; color: #92400e; }
.cat-vermelho { background: #fee2e2; color: #991b1b; }

/* Table action buttons */
.btn-contact, .btn-delete {
  background: none;
  border: 1.5px solid;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition);
  white-space: nowrap;
}
.btn-contact          { border-color: var(--color-primary); color: var(--color-primary); }
.btn-contact:hover    { background: var(--color-selected-bg); }
.btn-contact:disabled { opacity: 0.5; cursor: default; }
.btn-delete           { border-color: #dc2626; color: #dc2626; }
.btn-delete:hover     { background: #fee2e2; }
.btn-delete:disabled  { opacity: 0.5; cursor: default; }

.tag-contacted {
  display: inline-block;
  font-size: 0.75rem;
  color: #065f46;
  font-weight: 500;
}

.text-muted { color: var(--color-text-muted); }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.page-info {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ── Login Admin ─────────────────────────────── */

#login-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ── Responsive (> 480px) ────────────────────── */

@media (min-width: 480px) {
  #quiz-container {
    padding: 40px 32px 32px;
    margin: 20px auto;
    border-radius: var(--radius);
  }
  #result-container {
    padding: 40px 32px 24px;
    margin: 20px auto;
    border-radius: var(--radius);
  }
  .welcome-title  { font-size: 1.85rem; }
  .question-text  { font-size: 1.25rem; }
}

/* ── Welcome logo ────────────────────────────── */

.welcome-logo {
  max-width: 220px;
  max-height: 140px;
  object-fit: contain;
}

/* ── Progress bar com percentual ─────────────── */

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-pct {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* ── Option button — com letra ───────────────── */

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.option-btn.selected .option-letter {
  background: var(--color-primary);
  color: #fff;
}

.option-text {
  flex: 1;
  text-align: left;
}

/* ── Scale question ──────────────────────────── */

.scale-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}

.scale-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.scale-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  flex-shrink: 0;
}

.scale-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-selected-bg);
}

.scale-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  padding: 0 4px;
}

/* ── Multi-select question ───────────────────── */

.multi-option {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  font-size: 0.975rem;
  color: var(--color-text);
  min-height: 52px;
  line-height: 1.35;
}

.multi-option:hover { border-color: var(--color-primary); }

.multi-option input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.multi-option:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-selected-bg);
}

/* ── Multi continue button ───────────────────── */

#multi-continue-wrapper[hidden] { display: none; }
#multi-continue-wrapper { margin-top: 8px; margin-bottom: 4px; }

/* ── Loading screen (overlay fullscreen) ─────── */

#screen-loading {
  position: fixed;
  inset: 0;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  z-index: 100;
  animation: none;
}

#screen-loading[hidden] { display: none; }

.loading-content {
  width: 100%;
  max-width: 320px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.loading-bar-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 99px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: 99px;
  width: 0%;
}

.loading-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
}

/* ── Doctor photo (img) ──────────────────────── */

.doctor-photo {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
}
