/* ============================================================
   Central Premium Saúde – Quiz de Qualificação
   Design moderno, mobile-first, orientado a conversão
   ============================================================ */

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

:root {
  --primary: #00875A;
  --primary-dark: #006B47;
  --primary-light: rgba(0,135,90,0.08);
  --accent: #10B981;
  --danger: #EF4444;
  --text: #1E293B;
  --text-light: #64748B;
  --border: #E2E8F0;
  --card: #FFFFFF;
  --radius: 16px;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(160deg, #0F172A 0%, #1E3A5F 50%, #0F172A 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Wrapper ---- */
.quiz-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
}

/* ---- Header ---- */
.quiz-header { text-align: center; margin-bottom: 1.25rem; }
.quiz-logo {
  margin-bottom: 0.5rem;
}
.quiz-logo img {
  height: 80px;
  width: auto;
  object-fit: contain;
}
.quiz-header h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.15rem;
}
.quiz-header p {
  font-size: 0.9rem;
  color: #94A3B8;
}

/* ---- Card ---- */
.quiz-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 640px;
  padding: 2rem 1.5rem 1.5rem;
  position: relative;
  overflow: hidden;
}

/* ---- Progress ---- */
.quiz-progress { margin-bottom: 1.75rem; }

.progress-track {
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.step-dots {
  display: flex;
  justify-content: space-between;
}
.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.step-dot span {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  transition: all 0.3s;
}
.step-dot small {
  font-size: 0.7rem;
  color: #94A3B8;
  font-weight: 500;
  transition: color 0.3s;
}
.step-dot.active span {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,135,90,0.3);
}
.step-dot.active small { color: var(--primary); font-weight: 600; }
.step-dot.done span {
  background: var(--accent);
  color: #fff;
}
.step-dot.done small { color: var(--accent); }

/* ---- Steps ---- */
.quiz-step {
  display: none;
  animation: fadeSlideIn 0.35s ease forwards;
}
.quiz-step.active { display: block; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.step-head { margin-bottom: 1.25rem; }
.step-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}
.step-head p {
  font-size: 0.875rem;
  color: var(--text-light);
}

/* ---- Fields ---- */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.3rem;
}
.field .req { color: var(--danger); }

.field input,
.field select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #F8FAFC;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: auto;
}
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,135,90,0.12);
  background: #fff;
}
.field input.error,
.field select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.fields-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 480px) {
  .fields-row { grid-template-columns: 1fr 1fr; }
}

/* City loading */
.city-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ---- Faixas Etárias Grid ---- */
.faixas-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}
@media (min-width: 420px) { .faixas-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 560px) { .faixas-grid { grid-template-columns: repeat(5, 1fr); } }

.faixa-card {
  background: #F8FAFC;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.4rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.faixa-card:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,135,90,0.1);
}
.faixa-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.faixa-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  padding: 0.2rem 0;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.faixa-input::-webkit-outer-spin-button,
.faixa-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.total-vidas-box {
  margin-top: 1rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary);
  padding: 0.75rem;
  background: var(--primary-light);
  border-radius: 10px;
}
.total-vidas-box strong {
  font-size: 1.5rem;
  display: inline-block;
  min-width: 30px;
}

/* ---- Summary ---- */
.summary {
  display: grid;
  gap: 0.5rem;
}
.summary-section {
  margin-bottom: 0.75rem;
}
.summary-section h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--primary-light);
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid #F1F5F9;
}
.summary-row:last-child { border: none; }
.summary-label { color: var(--text-light); }
.summary-value { font-weight: 600; color: var(--text); text-align: right; }
.summary-value.highlight {
  color: var(--primary);
  font-size: 1.1rem;
}

/* ---- Navigation ---- */
.quiz-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  gap: 0.75rem;
}

.btn-quiz {
  padding: 0.8rem 1.75rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.btn-prev {
  background: transparent;
  color: var(--text-light);
  border: 1.5px solid var(--border);
}
.btn-prev:hover { border-color: #CBD5E1; color: var(--text); }

.btn-next {
  background: var(--primary);
  color: #fff;
  margin-left: auto;
}
.btn-next:hover { background: var(--primary-dark); }
.btn-next:active { transform: scale(0.97); }

.btn-submit {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 0.9rem 2rem;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  margin-left: auto;
  box-shadow: 0 4px 15px rgba(0,135,90,0.3);
}
.btn-submit:hover { box-shadow: 0 6px 20px rgba(0,135,90,0.4); transform: translateY(-1px); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Messages ---- */
.quiz-msg {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
  display: none;
}
.quiz-msg--error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}
.quiz-msg.show { display: block; }

/* ---- Success screen ---- */
.quiz-success {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 640px;
  padding: 3rem 2rem;
  text-align: center;
}
.success-check {
  width: 72px; height: 72px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  animation: popIn 0.4s ease;
}
@keyframes popIn {
  0%   { transform: scale(0); opacity: 0; }
  60%  { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.quiz-success h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.quiz-success p {
  color: var(--text-light);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* ---- Spinners ---- */
.spinner-sm {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-btn {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Possui Plano: Sim/Não premium buttons ---- */
.plano-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 440px;
  margin: 1.5rem auto 0;
}
.plano-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 2rem 1.25rem 1.75rem;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  overflow: hidden;
}
.plano-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,135,90,0.05), rgba(16,185,129,0.05));
  opacity: 0;
  transition: opacity 0.3s;
}
.plano-btn:hover::before { opacity: 1; }
.plano-btn:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,135,90,0.15);
}
.plano-btn.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(0,135,90,0.06), rgba(16,185,129,0.04));
  box-shadow: 0 0 0 3px rgba(0,135,90,0.18), 0 8px 30px rgba(0,135,90,0.12);
}
.plano-btn.selected::before { opacity: 1; }
.plano-icon {
  color: var(--primary);
  transition: transform 0.3s, color 0.3s;
}
.plano-btn:hover .plano-icon { transform: scale(1.1); }
.plano-btn.selected .plano-icon { color: var(--primary-dark); transform: scale(1.15); }
.plano-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.plano-sub {
  font-size: 0.78rem;
  color: var(--text-light);
  font-weight: 400;
}
.plano-selected-info {
  margin-top: 1.25rem;
  text-align: center;
}
.plano-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid rgba(0,135,90,0.2);
}

/* ---- Premium Modal: Operadora ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0);
  backdrop-filter: blur(0);
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 1rem;
}
.modal-overlay.open {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  opacity: 1;
  visibility: visible;
}
.modal-container {
  position: relative;
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255,255,255,0.05);
  transform: translateY(30px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}
.modal-overlay.open .modal-container {
  transform: translateY(0) scale(1);
}
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #F1F5F9;
  color: #64748B;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-family: inherit;
}
.modal-close:hover {
  background: #E2E8F0;
  color: var(--text);
  transform: rotate(90deg);
}
.modal-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid #F1F5F9;
}
.modal-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,135,90,0.25);
}
.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.modal-header p {
  font-size: 0.82rem;
  color: var(--text-light);
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto;
}
.modal-body {
  padding: 1.5rem 2rem;
}
.modal-footer {
  padding: 1rem 2rem 1.5rem;
  text-align: center;
  border-top: 1px solid #F1F5F9;
}
.btn-modal-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 2.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(0,135,90,0.3);
  min-width: 220px;
}
.btn-modal-confirm:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(0,135,90,0.4);
  transform: translateY(-2px);
}
.btn-modal-confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---- Operadora Cards Grid (inside modal) ---- */
.operadora-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
@media (min-width: 420px) { .operadora-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 580px) { .operadora-grid { grid-template-columns: repeat(4, 1fr); } }

.operadora-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.1rem 0.5rem 0.9rem;
  border: 2px solid #E8ECF1;
  border-radius: 14px;
  background: #FAFBFC;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  text-align: center;
  overflow: hidden;
}
.operadora-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,135,90,0.03), rgba(16,185,129,0.03));
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.operadora-card:hover {
  border-color: #A7D5C3;
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,135,90,0.1);
}
.operadora-card:hover::after { opacity: 1; }
.operadora-card.selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(0,135,90,0.04), rgba(16,185,129,0.02));
  box-shadow: 0 0 0 3px rgba(0,135,90,0.15), 0 6px 20px rgba(0,135,90,0.12);
}
.operadora-card.selected::after { opacity: 1; }
.operadora-logo {
  width: 68px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.operadora-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.operadora-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-transform: uppercase;
}
.operadora-card.selected .operadora-name { color: var(--primary-dark); }

.operadora-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.operadora-card.selected .operadora-check {
  opacity: 1;
  transform: scale(1);
}

/* ---- Outros card + input ---- */
.operadora-logo--outros {
  background: linear-gradient(135deg, var(--primary-light), rgba(16,185,129,0.08));
  color: var(--primary);
}
.operadora-card--outros.selected .operadora-logo--outros {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}
.outros-input-wrap {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: #F8FAFC;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  animation: fadeSlideIn 0.3s ease forwards;
}
.outros-input-wrap label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.4rem;
}
.outros-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.outros-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,135,90,0.12);
}

/* Success subtext */
.success-subtext {
  font-size: 0.85rem;
  color: #64748B;
}
.success-check--plano {
  background: linear-gradient(135deg, #3B82F6, #6366F1) !important;
}

/* ---- Mobile modal adjustments ---- */
@media (max-width: 480px) {
  .modal-container { border-radius: 16px 16px 0 0; max-height: 92vh; margin-top: auto; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-overlay.open .modal-container { transform: translateY(0) scale(1); }
  .modal-container { transform: translateY(100%) scale(1); }
  .modal-header { padding: 1.5rem 1.25rem 0.75rem; }
  .modal-body { padding: 1rem 1.25rem; }
  .modal-footer { padding: 0.75rem 1.25rem 1.25rem; }
  .modal-header h2 { font-size: 1.1rem; }
  .operadora-grid { gap: 0.6rem; }
  .operadora-card { padding: 0.85rem 0.4rem 0.7rem; }
  .operadora-logo { width: 56px; height: 42px; }
}

/* ---- Footer ---- */
.quiz-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.75rem;
  color: #475569;
}
