/* ============================================
   PHNX Onboarding Questionnaire — Mythic Terminal
   Hades 2 Multi-Color Treatment
   ============================================ */

/* --- Container --- */
.onboarding-container {
  padding: 16px;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.onboarding-header {
  margin-bottom: 20px;
}

.onboarding-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #FF6B2B;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* --- Multi-Color Progress Bar --- */
.onboarding-progress-bar {
  height: 6px;
  background: #242429;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.onboarding-progress-fill {
  height: 100%;
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease, background 0.4s ease;
  /* Multi-color gradient — segments colored by section */
  background: linear-gradient(90deg,
    #FF6B2B 0%, #FF6B2B 20%,    /* Section 1: flame */
    #22C55E 20%, #22C55E 40%,   /* Section 2: green */
    #3B82F6 40%, #3B82F6 60%,   /* Section 3: blue */
    #A855F7 60%, #A855F7 80%,   /* Section 4: purple */
    #FFB347 80%, #FFB347 100%   /* Section 5: gold */
  );
  background-size: calc(100% / var(--progress-pct, 1) * 100) 100%;
}

.onboarding-progress-text {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: #A1A1AA;
}

#onboardingProgressPct {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

/* --- Phoenix Evolution --- */
.onboarding-evolution {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 12px;
  font-size: 16px;
}

.evo-connector {
  color: #242429;
  font-size: 10px;
  letter-spacing: -2px;
  transition: color 0.3s ease;
}

.evo-stage {
  opacity: 0.3;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.evo-stage.evo-active {
  opacity: 1;
  transform: scale(1.2);
}

.evo-stage.evo-passed {
  opacity: 0.7;
}

.evo-connector.evo-lit {
  color: #FF6B2B;
}

/* --- Section Insight Card --- */
.onboarding-insight {
  background: #1A1A1F;
  border: 1px solid rgba(255, 107, 43, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: insightSlideIn 0.3s ease;
}

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

.onboarding-insight-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.onboarding-insight-text {
  font-size: 13px;
  color: #A1A1AA;
  line-height: 1.5;
}

.onboarding-insight-text strong {
  color: #F5F5F7;
}

/* Section-colored insight borders */
.onboarding-insight.insight-section1 { border-left: 3px solid #FF6B2B; }
.onboarding-insight.insight-section2 { border-left: 3px solid #22C55E; }
.onboarding-insight.insight-section3 { border-left: 3px solid #3B82F6; }
.onboarding-insight.insight-section4 { border-left: 3px solid #A855F7; }
.onboarding-insight.insight-section5 { border-left: 3px solid #FFB347; }

/* --- Step Content --- */
.onboarding-step {
  flex: 1;
  animation: stepFadeIn 0.25s ease;
}

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

.step-question {
  font-size: 16px;
  font-weight: 500;
  color: #F5F5F7;
  margin-bottom: 4px;
  line-height: 1.4;
}

.step-subtitle {
  font-size: 13px;
  color: #6B7280;
  margin-bottom: 16px;
}

/* --- Input Fields --- */
.step-input-group {
  margin-bottom: 12px;
}

.step-input-label {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: #A1A1AA;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: block;
}

.step-input {
  width: 100%;
  background: #2A2A30;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #F5F5F7;
  font-size: 15px;
  padding: 12px 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.step-input:focus {
  border-color: #FF6B2B;
}

.step-input::placeholder {
  color: #6B7280;
}

.step-input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.step-input-row.cols-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

/* Colored labels for macro inputs */
.step-input-label.label-cal { color: #FF6B2B; }
.step-input-label.label-protein { color: #22C55E; }
.step-input-label.label-carbs { color: #FBBF24; }
.step-input-label.label-fat { color: #A855F7; }

/* --- Button Grid (single/multi select) --- */
.step-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.step-btn-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.step-btn-grid.cols-1 {
  grid-template-columns: 1fr;
}

.step-btn {
  background: #1A1A1F;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  color: #F5F5F7;
  font-size: 14px;
  padding: 12px 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  font-family: 'DM Sans', sans-serif;
  line-height: 1.3;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

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

/* Single-select: selected state */
.step-btn.selected {
  border-color: #FF6B2B;
  background: rgba(255, 107, 43, 0.12);
  color: #FF6B2B;
}

/* Multi-select: checked state */
.step-btn.checked {
  border-color: #22C55E;
  background: rgba(34, 197, 94, 0.10);
  color: #22C55E;
}

/* Section-colored selection states */
.step-btn.selected.section-2 {
  border-color: #22C55E;
  background: rgba(34, 197, 94, 0.10);
  color: #22C55E;
}

.step-btn.selected.section-3 {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.10);
  color: #3B82F6;
}

.step-btn.selected.section-4 {
  border-color: #A855F7;
  background: rgba(168, 85, 247, 0.10);
  color: #A855F7;
}

.step-btn.selected.section-5 {
  border-color: #FFB347;
  background: rgba(255, 179, 71, 0.10);
  color: #FFB347;
}

/* Skip button variant */
.step-btn.btn-skip {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: #6B7280;
  font-size: 13px;
}

/* --- Training Days (7-day row) --- */
.step-days-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.step-day-btn {
  background: #1A1A1F;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #A1A1AA;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  padding: 10px 0;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.step-day-btn.checked {
  border-color: #3B82F6;
  background: rgba(59, 130, 246, 0.12);
  color: #3B82F6;
}

.step-day-btn:active {
  transform: scale(0.95);
}

/* --- Time Select --- */
.step-time-input {
  width: 100%;
  background: #2A2A30;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #F5F5F7;
  font-size: 15px;
  padding: 12px 14px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.step-time-input:focus {
  border-color: #A855F7;
}

/* --- Navigation --- */
.onboarding-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 8px;
  margin-top: auto;
}

.onboarding-nav-back {
  background: none;
  border: none;
  color: #A1A1AA;
  font-size: 14px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.2s;
  font-family: 'DM Sans', sans-serif;
}

.onboarding-nav-back:active {
  color: #F5F5F7;
}

.onboarding-nav-next {
  min-width: 120px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
}

.onboarding-nav-next:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Section-colored next button */
.onboarding-nav-next.section-1 { background: #FF6B2B; }
.onboarding-nav-next.section-2 { background: #22C55E; }
.onboarding-nav-next.section-3 { background: #3B82F6; }
.onboarding-nav-next.section-4 { background: #A855F7; }
.onboarding-nav-next.section-5 { background: #FFB347; color: #0D0D0F; }

/* --- Save & Exit --- */
.onboarding-save-exit {
  text-align: center;
  padding-bottom: 24px;
}

.onboarding-save-exit .btn-ghost {
  font-size: 13px;
  color: #6B7280;
}

/* --- Validation Error --- */
.step-error {
  color: #EF4444;
  font-size: 12px;
  margin-top: 4px;
  display: none;
}

.step-error.visible {
  display: block;
}

/* --- Completion Screen --- */
.onboarding-complete {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #0D0D0F;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: completeReveal 0.6s ease;
}

@keyframes completeReveal {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.onboarding-complete-badge {
  font-size: 64px;
  margin-bottom: 12px;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.onboarding-complete-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #FF6B2B;
  margin-bottom: 8px;
}

.onboarding-complete-type {
  font-size: 18px;
  color: #F5F5F7;
  margin-bottom: 24px;
  font-weight: 500;
}

/* --- Macro Cards (Completion) --- */
.onboarding-complete-macros {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  margin-bottom: 20px;
}

.complete-macro-card {
  background: #1A1A1F;
  border-radius: 12px;
  padding: 14px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.complete-macro-card.macro-cal {
  border-color: rgba(255, 107, 43, 0.3);
  background: radial-gradient(ellipse at top, rgba(255, 107, 43, 0.08), #1A1A1F 70%);
}

.complete-macro-card.macro-protein {
  border-color: rgba(34, 197, 94, 0.3);
  background: radial-gradient(ellipse at top, rgba(34, 197, 94, 0.08), #1A1A1F 70%);
}

.complete-macro-card.macro-carbs {
  border-color: rgba(251, 191, 36, 0.3);
  background: radial-gradient(ellipse at top, rgba(251, 191, 36, 0.08), #1A1A1F 70%);
}

.complete-macro-card.macro-fat {
  border-color: rgba(168, 85, 247, 0.3);
  background: radial-gradient(ellipse at top, rgba(168, 85, 247, 0.08), #1A1A1F 70%);
}

.complete-macro-value {
  font-size: 28px;
  font-weight: 600;
  color: #F5F5F7;
  margin-bottom: 2px;
}

.macro-cal .complete-macro-value { color: #FF6B2B; }
.macro-protein .complete-macro-value { color: #22C55E; }
.macro-carbs .complete-macro-value { color: #FBBF24; }
.macro-fat .complete-macro-value { color: #A855F7; }

.complete-macro-label {
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 2px;
  color: #6B7280;
}

/* --- Stats Row (Completion) --- */
.onboarding-complete-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.complete-stat {
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  color: #6B7280;
}

.complete-stat strong {
  color: #A1A1AA;
}

/* --- Messages (Completion) --- */
.onboarding-complete-message {
  font-size: 14px;
  color: #A1A1AA;
  margin-bottom: 8px;
}

.onboarding-complete-redirect {
  font-size: 12px;
  color: #6B7280;
  font-family: 'JetBrains Mono', monospace;
}

/* --- Section heading dividers --- */
.step-section-heading {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.step-section-heading.section-1 { color: #FF6B2B; border-color: rgba(255, 107, 43, 0.2); }
.step-section-heading.section-2 { color: #22C55E; border-color: rgba(34, 197, 94, 0.2); }
.step-section-heading.section-3 { color: #3B82F6; border-color: rgba(59, 130, 246, 0.2); }
.step-section-heading.section-4 { color: #A855F7; border-color: rgba(168, 85, 247, 0.2); }
.step-section-heading.section-5 { color: #FFB347; border-color: rgba(255, 179, 71, 0.2); }

/* --- Loading spinner for submit --- */
.onboarding-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.onboarding-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #242429;
  border-top-color: #FF6B2B;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

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

.onboarding-loading-text {
  font-size: 14px;
  color: #A1A1AA;
}

/* --- Responsive --- */
@media (max-width: 360px) {
  .step-btn-grid { gap: 6px; }
  .step-btn { font-size: 13px; padding: 10px 10px; }
  .step-days-row { gap: 4px; }
  .step-day-btn { font-size: 11px; padding: 8px 0; }
  .onboarding-complete-macros { gap: 8px; }
  .complete-macro-value { font-size: 24px; }
}
