/* ============================================
   Ototon Hearing Test Quiz Funnel
   Mobile-first, medical-trust design
   ============================================ */

:root {
  --color-primary: #1a73e8;
  --color-primary-hover: #1557b0;
  --color-primary-light: #e8f0fe;
  --color-success: #0d9f6e;
  --color-success-light: #def7ec;
  --color-danger: #e02424;
  --color-danger-light: #fde8e8;
  --color-text: #1f2937;
  --color-text-secondary: #6b7280;
  --color-bg: #f8fafc;
  --color-white: #ffffff;
  --color-border: #e5e7eb;
  --color-card: #ffffff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --transition: 0.25s ease;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1c1c;
  background: #f9f9f9;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* App container — same width as proba funnel */
#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: transparent;
}

/* Welcome Screen - city select */
select.custom-select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23594042' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 44px;
}

.welcome-city-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: none !important;
  border: none;
  border-bottom: 2px solid rgba(154, 4, 47, 0.2);
  border-radius: 0;
  outline: none;
}
.welcome-city-select:focus {
  border-bottom-color: #9a042f;
  box-shadow: none;
  outline: none;
}

/* Progress Bar (hidden — proba uses stepper only) */
.progress-bar {
  display: none;
}

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

/* Hide top progress bar on secondary quiz and final result (stepper handles progress) */
body:has(#screen-secondary-quiz.active) .progress-bar,
body:has(#screen-final-result.active) .progress-bar {
  display: none;
}

/* Screens */
.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: screenFadeIn 0.35s ease-out;
}

.screen.active.screen-instant {
  animation: none;
}

.screen.fade-out {
  display: flex;
  flex-direction: column;
  animation: screenFadeOut 0.2s ease-in forwards;
}

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

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

/* Question transition inside a quiz container */
.question-enter {
  animation: questionEnter 0.3s ease-out;
}

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

.screen-content {
  flex: 1;
  padding: 24px 20px 32px;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
}

/* Logo */
.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.5px;
  margin-bottom: 20px;
}

/* Typography */
.headline {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text);
  margin-bottom: 16px;
}

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

/* Badges */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
}

/* Info Box (Welcome screen) */
.info-box {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
  flex: 1;
}

.info-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--color-text);
}

.info-box p {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
  line-height: 1.6;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.info-box strong {
  color: var(--color-text);
}

/* How It Works (Intro screen) */
.how-it-works {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
  flex: 1;
}

.how-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.how-step strong {
  color: var(--color-text);
  display: block;
  margin-bottom: 2px;
}

.how-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.important-note {
  background: #fffbeb;
  border-color: #fcd34d;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.3);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(26, 115, 232, 0.3);
}

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

/* Quiz Styles */
.quiz-header {
  margin-bottom: 20px;
}

.quiz-step {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-question {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 20px;
  color: var(--color-text);
}

.quiz-intro-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}

/* Answer Buttons */
.answer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-btn {
  display: block;
  width: 100%;
  padding: 16px 18px;
  background: var(--color-white);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.answer-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.answer-btn:active,
.answer-btn.selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-white);
  transform: scale(0.98);
}

/* Dropdown Styles */
.dropdown-group {
  margin-bottom: 16px;
}

.dropdown-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
  display: block;
}

.dropdown-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-white);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
  transition: border-color var(--transition);
}

.dropdown-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.dropdown-select.selected {
  border-color: var(--color-primary);
}

.dropdown-continue {
  margin-top: 20px;
}

/* Lead Form */
.lead-form {
  flex: 1;
  display: flex;
  flex-direction: column;
}

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

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

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-white);
  transition: border-color var(--transition);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

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

.form-error {
  color: var(--color-danger);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 12px;
  min-height: 0;
}

.lead-form .btn {
  margin-top: auto;
}

/* Result Screen */
.result-content {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 60px;
}

.result-icon {
  font-size: 64px;
  margin-bottom: 24px;
}

.result-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 16px;
}

.result-approved .result-title {
  color: var(--color-success);
}

.result-rejected .result-title {
  color: var(--color-text);
}

.result-subtitle {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.result-approved {
  background: var(--color-success-light);
  border-radius: var(--radius);
  padding: 32px 24px;
}

.result-rejected {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 32px 24px;
}

/* Subheadline */
.subheadline {
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Headphones options spacing */
.headphones-options {
  margin-top: 8px;
}

/* ── Slider-style Likert Scale ── */
.slider-question-text {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 28px;
  color: var(--color-text);
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.slider-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.slider-option input[type="radio"] {
  display: none;
}

.slider-dot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--color-border);
  background: var(--color-white);
  transition: all var(--transition);
  position: relative;
}

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

.slider-option input[type="radio"]:checked + .slider-dot {
  border-color: var(--color-primary);
  background: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.15);
}

.slider-option input[type="radio"]:checked + .slider-dot::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-white);
}

.slider-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: center;
  line-height: 1.3;
  min-height: 28px;
  display: flex;
  align-items: center;
}

.slider-option input[type="radio"]:checked ~ .slider-label {
  color: var(--color-primary);
  font-weight: 600;
}

/* Slider connector line */
.slider-track {
  position: relative;
  margin-bottom: 24px;
}

.slider-track::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  height: 3px;
  background: var(--color-border);
  z-index: 0;
  border-radius: 2px;
}

.slider-next-btn {
  margin-top: 16px;
}

/* ── Final Result Screens ── */
.final-result-card {
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: left;
}

.final-result-card.approved {
  background: var(--color-success-light);
  border: 1px solid var(--color-success);
}

.final-result-card.not-approved {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.final-result-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 8px;
}

.final-result-card.approved .final-result-title {
  color: var(--color-success);
}

.final-result-status {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  line-height: 1.4;
}

.final-result-card.approved .final-result-status {
  color: var(--color-success);
}

.final-result-card.not-approved .final-result-status {
  color: var(--color-primary);
}

.final-result-text {
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin-bottom: 16px;
}

.final-result-text:last-child {
  margin-bottom: 0;
}

.final-result-text strong {
  color: var(--color-text);
}

.final-result-bullets {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.final-result-bullets li {
  padding: 4px 0;
  font-size: 14px;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.final-result-bullets li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  margin-right: 10px;
  vertical-align: middle;
}

.final-result-warning {
  margin-top: 16px;
  padding: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
}

/* Accessibility: focus visible */
.btn:focus-visible,
.answer-btn:focus-visible,
.dropdown-select:focus-visible,
input:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Responsive: slightly larger screens */
@media (min-width: 480px) {
  .screen-content {
    padding: 32px 28px 40px;
  }

  .headline {
    font-size: 24px;
  }

  .quiz-question {
    font-size: 22px;
  }
}

/* Welcome screen layout */
#screen-welcome.active .welcome-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

#screen-welcome.active .welcome-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.welcome-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 0.75rem;
}

.welcome-headline {
  font-size: 30px;
  font-weight: 800;
}

.welcome-subtitle {
  font-size: 16px;
  line-height: 1.5;
}

@media (max-width: 480px) {
  #screen-welcome .welcome-stepper-wrap {
    padding-top: 0.375rem !important;
    padding-bottom: 0.5rem !important;
  }

  #screen-welcome .welcome-stepper-logo {
    margin-top: 0.125rem !important;
    margin-bottom: 1rem !important;
    height: 24px !important;
  }

  #screen-welcome .welcome-stepper-icons [style*="width:44px"] {
    width: 36px !important;
    height: 36px !important;
  }

  #screen-welcome .welcome-stepper-icons [style*="font-size:22px"] {
    font-size: 18px !important;
  }

  #screen-welcome .welcome-stepper-icons .font-bold.uppercase {
    margin-top: 0.25rem !important;
    font-size: 10px !important;
  }

  #screen-welcome .welcome-main {
    padding-top: 0.5rem !important;
  }

  .welcome-hero {
    padding-top: 0.5rem !important;
    padding-bottom: 0.875rem !important;
  }

  .welcome-headline {
    font-size: 22px !important;
    line-height: 1.25 !important;
    margin-bottom: 0.75rem !important;
  }

  .welcome-subtitle {
    font-size: 14px !important;
    line-height: 1.45 !important;
  }

  .welcome-city-card {
    padding: 0.75rem !important;
    margin-bottom: 0.625rem !important;
  }

  .welcome-spots-card {
    padding: 0.875rem !important;
    margin-bottom: 0.625rem !important;
  }

  .welcome-spots-card .mb-4 {
    margin-bottom: 0.5rem !important;
  }

  .welcome-spots-stat-row {
    margin-bottom: 0.5rem !important;
    gap: 0.5rem !important;
  }

  .welcome-spots-number {
    font-size: 44px !important;
  }

  .welcome-spots-card .text-xl {
    font-size: 0.875rem !important;
  }

  .welcome-cta-wrap {
    margin-top: 0.25rem !important;
    margin-bottom: 0.5rem !important;
  }

  .welcome-cta-btn {
    padding: 14px !important;
    font-size: 1rem !important;
  }
}

@media (max-width: 380px) {
  .welcome-spots-number {
    font-size: 38px !important;
  }
}

/* Mobile: small screens */
@media (max-width: 380px) {
  .screen-content {
    padding: 16px 14px 24px;
  }

  .ototon-logo {
    height: 26px !important;
  }

  .slider-dot {
    width: 34px;
    height: 34px;
  }

  .slider-label {
    font-size: 10px;
  }
}

/* Safe area insets for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
  .screen.active {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .progress-bar {
    top: env(safe-area-inset-top);
  }
}

/* Desktop — flat layout like proba (no card container) */
@media (min-width: 600px) {
  body {
    background: #f9f9f9;
  }
}
