/* ========================================
   EC Program Finder Quiz
   Panxo-inspired: warm backgrounds, thin rules,
   rounded corners, soft shadows, generous whitespace
   ======================================== */

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

:root {
  --color-bg: #FAF8F5;
  --color-surface: #FFFFFF;
  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-text-light: #9a9a9a;
  --color-primary: #204CE5;
  --color-primary-hover: #1a3db8;
  --color-border: #E8E5E0;
  --color-border-light: #F0EDE8;
  --color-accent-warm: #F5E6D3;
  --color-accent-peach: #FCEADE;
  --color-accent-amber: #FEF3E2;
  --color-gold: #C9A44A;
  --color-success: #2D8F5E;
  --color-error: #D94444;

  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
}

/* ========== Quiz Container ========== */

.quiz-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========== Screen Management ========== */

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.3s ease;
}

.screen.active {
  display: flex;
}

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

/* ========== Quiz Header / Logo ========== */

.quiz-header {
  padding: 8px 0 24px;
}

.ec-logo {
  text-align: center;
}

.logo-svg {
  height: 40px;
  width: auto;
  max-width: 220px;
}

/* ========== Progress Bar ========== */

.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--color-border-light);
  border-radius: 2px;
  overflow: hidden;
}

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

.progress-label {
  display: block;
  text-align: right;
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-top: 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ========== Lead Capture ========== */

.lead-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 0;
}

.quiz-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: 12px;
}

.quiz-subtitle {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 480px;
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

.form-group input {
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}

.form-group input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(32, 76, 229, 0.1);
}

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

.form-group .error-msg {
  font-size: 0.75rem;
  color: var(--color-error);
  margin-top: 2px;
  display: none;
}

.form-group .error-msg.visible {
  display: block;
}

/* ========== Buttons ========== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  text-decoration: none;
  margin-top: 8px;
}

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

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

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-text-light);
  cursor: pointer;
  transition: color 0.2s ease;
  margin-top: 24px;
  align-self: flex-start;
}

.btn-back::before {
  content: '\2190';
  font-size: 1rem;
}

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

/* ========== Questions ========== */

.question-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.question-text {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.875rem);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-text);
  margin-bottom: 8px;
}

.question-note {
  font-size: 0.875rem;
  color: var(--color-text-light);
  margin-bottom: 8px;
  line-height: 1.5;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.option-btn {
  width: 100%;
  padding: 16px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--color-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  line-height: 1.4;
}

.option-btn:hover {
  border-color: var(--color-primary);
  background: #F8F9FF;
  box-shadow: var(--shadow-sm);
}

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

.option-btn.selected {
  border-color: var(--color-primary);
  background: #EEF1FC;
  box-shadow: var(--shadow-sm);
}

/* ========== Results ========== */

.result-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0 20px;
}

.result-badge {
  display: inline-block;
  padding: 6px 16px;
  background: var(--color-accent-peach);
  color: var(--color-text-muted);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.result-program {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-text);
  margin-bottom: 12px;
}

.result-description {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 480px;
  margin-bottom: 32px;
}

.result-card {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: left;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.result-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text);
}

.result-card p {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* Stats row */
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  margin-bottom: 36px;
  padding: 20px 0;
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.3;
}

/* Result CTA */
.btn-result {
  padding: 16px 48px;
  font-size: 1.0625rem;
  border-radius: var(--radius-md);
}

.result-note {
  font-size: 0.8125rem;
  color: var(--color-text-light);
  margin-top: 12px;
  line-height: 1.5;
}

/* ========== Loading State ========== */

.btn-primary.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-primary.loading::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== Responsive ========== */

@media (max-width: 480px) {
  .quiz-container {
    padding: 16px 16px 32px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .result-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat {
    flex-direction: row;
    justify-content: space-between;
    padding: 8px 0;
  }

  .stat + .stat {
    border-top: 1px solid var(--color-border-light);
  }
}

/* ========== iframe body reset ========== */
body.in-iframe {
  background: transparent;
}
