/* ========================================
   MoldScope Quiz - Lunavia-inspired Clean/Clinical
   ======================================== */

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', -apple-system, sans-serif; color: #1a1a1a; background: #f0f2f5; line-height: 1.6; min-height: 100vh; }

/* === Container === */
.quiz-container { max-width: 600px; margin: 0 auto; padding: 0 20px; min-height: 100vh; display: flex; flex-direction: column; }

/* === Header === */
.quiz-header { display: flex; align-items: center; justify-content: center; padding: 20px 0; position: relative; }
.back-btn { position: absolute; left: 0; background: none; border: none; cursor: pointer; color: #1a1a1a; padding: 8px; border-radius: 8px; transition: background 0.2s; }
.back-btn:hover { background: rgba(0,0,0,0.05); }
.logo { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.4rem; letter-spacing: 2px; color: #1a2b4a; }

/* === Progress - segmented blocks === */
.progress-container { padding: 0 0 10px; }
.progress-segments { display: flex; gap: 4px; }
.segment { flex: 1; height: 4px; border-radius: 2px; background: #ddd; transition: background 0.3s; }
.segment.completed { background: #1a2b4a; }
.segment.active { background: #1a2b4a; opacity: 0.6; }

/* === Step === */
.step { padding: 30px 0; animation: fadeIn 0.3s ease; }
.step-question { font-size: 1.3rem; font-weight: 700; text-align: center; margin-bottom: 8px; line-height: 1.3; }
.step-subtitle { font-size: 0.9rem; color: #6b7280; text-align: center; margin-bottom: 30px; }

/* === Options === */
.options-list { display: flex; flex-direction: column; gap: 12px; max-width: 500px; margin: 0 auto; }
.option-item { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 16px 20px; cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: all 0.2s; }
.option-item:hover { border-color: #c5c7ca; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.option-item.selected { border-color: #1a2b4a; box-shadow: 0 0 0 2px rgba(26,43,74,0.15); }
.option-label { font-size: 0.95rem; font-weight: 500; flex: 1; }

/* === Radio (single-select) === */
.option-radio { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #d1d5db; flex-shrink: 0; margin-left: 12px; position: relative; transition: all 0.2s; }
.option-item.selected .option-radio { border-color: #1a2b4a; }
.option-item.selected .option-radio::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 10px; height: 10px; border-radius: 50%; background: #1a2b4a; }

/* === Checkbox (multi-select) === */
.option-checkbox { width: 22px; height: 22px; border-radius: 4px; border: 2px solid #d1d5db; flex-shrink: 0; margin-left: 12px; position: relative; transition: all 0.2s; }
.option-item.selected .option-checkbox { background: #1a2b4a; border-color: #1a2b4a; }
.option-item.selected .option-checkbox::after { content: ''; position: absolute; top: 3px; left: 6px; width: 6px; height: 10px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* === Continue button === */
.continue-btn { width: 100%; max-width: 400px; margin: 30px auto 0; padding: 16px 24px; background: #1a2b4a; color: white; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; letter-spacing: 1px; cursor: pointer; display: block; font-family: 'Inter', sans-serif; transition: all 0.2s; }
.continue-btn:hover { background: #0f1d36; }
.continue-btn:disabled { background: #9ca3af; cursor: not-allowed; }

/* === Email step === */
.email-step { max-width: 400px; margin: 0 auto; text-align: center; }
.email-step h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; line-height: 1.3; }
.email-step p { font-size: 0.95rem; color: #6b7280; margin-bottom: 24px; }
.email-input { width: 100%; padding: 14px 18px; border: 1px solid #d1d5db; border-radius: 10px; font-size: 1rem; margin-bottom: 12px; font-family: 'Inter', sans-serif; transition: border-color 0.2s; }
.email-input:focus { border-color: #1a2b4a; outline: none; }
.email-submit { width: 100%; padding: 16px 24px; background: #1a2b4a; color: white; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; letter-spacing: 1px; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; margin-top: 4px; }
.email-submit:hover { background: #0f1d36; }
.email-privacy { font-size: 0.8rem; color: #9ca3af; margin-top: 16px; }

/* === Results screen === */
.results-screen { text-align: center; padding: 20px 0; animation: fadeIn 0.3s ease; }
.risk-badge { display: inline-block; padding: 8px 24px; border-radius: 20px; font-size: 0.85rem; font-weight: 700; letter-spacing: 2px; margin-bottom: 20px; }
.risk-badge.low { background: #f0fdf4; color: #16a34a; }
.risk-badge.moderate { background: #fffbeb; color: #d97706; }
.risk-badge.high { background: #fef2f2; color: #dc2626; }
.risk-headline { font-size: 1.4rem; font-weight: 700; margin-bottom: 12px; line-height: 1.3; }
.risk-description { font-size: 0.95rem; line-height: 1.6; color: #6b7280; margin-bottom: 30px; }

/* Risk Meters */
.risk-meters { background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: left; }
.risk-meter { margin-bottom: 18px; }
.risk-meter:last-child { margin-bottom: 0; }
.risk-meter-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.risk-meter-label { font-size: 0.85rem; font-weight: 600; color: #374151; }
.risk-meter-value { font-size: 0.85rem; font-weight: 700; }
.risk-meter-track { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.risk-meter-fill { height: 100%; border-radius: 4px; transition: width 1.2s ease-out; }

/* === Risk factors === */
.risk-factors { text-align: left; background: #fff; border-radius: 12px; padding: 24px; margin-bottom: 30px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.risk-factors h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.risk-factor-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; line-height: 1.5; display: flex; gap: 10px; align-items: start; }
.risk-factor-item:last-child { border-bottom: none; }
.risk-factor-icon { flex-shrink: 0; font-size: 1.1rem; }

/* === Product card === */
.product-card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); text-align: center; margin-bottom: 20px; }
.product-name { font-size: 1.2rem; font-weight: 700; margin-bottom: 4px; }
.product-price { font-size: 1.5rem; font-weight: 700; color: #1a2b4a; margin: 10px 0; }
.product-features { list-style: none; text-align: left; margin: 20px 0; padding: 0; }
.product-features li { padding: 8px 0; font-size: 0.9rem; display: flex; gap: 8px; align-items: center; }
.product-features li::before { content: '\2713'; color: #16a34a; font-weight: 700; }
.cta-primary { width: 100%; padding: 18px 24px; background: #1a2b4a; color: white; border: none; border-radius: 10px; font-size: 1.1rem; font-weight: 600; letter-spacing: 1px; cursor: pointer; font-family: 'Inter', sans-serif; transition: all 0.2s; text-decoration: none; display: block; text-align: center; }
.cta-primary:hover { background: #0f1d36; }
.cta-subtext { font-size: 0.8rem; color: #6b7280; margin-top: 8px; }

/* === Welcome step === */
.welcome-step { text-align: center; padding: 40px 0; max-width: 440px; margin: 0 auto; }
.welcome-headline { font-size: 1.6rem; font-weight: 700; color: #1a2b4a; line-height: 1.3; margin-bottom: 16px; }
.welcome-description { font-size: 0.95rem; color: #6b7280; line-height: 1.6; margin-bottom: 12px; }
.welcome-features { display: flex; flex-direction: column; gap: 10px; margin: 28px 0 32px; text-align: left; max-width: 260px; margin-left: auto; margin-right: auto; }
.welcome-feature { font-size: 0.9rem; font-weight: 500; color: #374151; display: flex; align-items: center; gap: 10px; }
.welcome-feature-icon { color: #16a34a; font-weight: 700; font-size: 1rem; }

/* === Animation === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }

/* === Analysis Loading Screen === */
.analysis-screen { text-align: center; padding: 60px 0 40px; }
.analysis-icon { margin-bottom: 24px; }
.analysis-spinner { animation: spin 3s linear infinite; transform-origin: center; }
@keyframes spin { 100% { transform: rotate(360deg); } }
.analysis-title { font-size: 1.3rem; font-weight: 700; color: #1a2b4a; margin-bottom: 32px; }
.analysis-steps { max-width: 400px; margin: 0 auto 32px; text-align: left; }
.analysis-step { padding: 10px 0; font-size: 0.9rem; color: #9ca3af; transition: all 0.3s ease; display: flex; gap: 10px; align-items: center; }
.analysis-step.active { color: #1a2b4a; font-weight: 500; }
.analysis-step.done { color: #16a34a; }
.analysis-check { width: 18px; font-weight: 700; flex-shrink: 0; text-align: center; }
.analysis-step.done .analysis-check { color: #16a34a; }
.analysis-progress-track { max-width: 400px; margin: 0 auto; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.analysis-progress-fill { height: 100%; background: #1a2b4a; border-radius: 3px; width: 0%; transition: width 0.6s ease; }

/* === Admin / Analytics Panel === */
.analytics-panel { position: fixed; top: 0; right: -420px; width: 400px; height: 100vh; background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,0.15); z-index: 1000; overflow-y: auto; padding: 20px; transition: right 0.3s ease; }
.analytics-panel.open { right: 0; }
.analytics-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.analytics-panel-header h3 { font-size: 1.1rem; font-weight: 700; color: #1a2b4a; }
.analytics-close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #6b7280; padding: 4px 8px; }
.analytics-summary { display: flex; gap: 12px; margin-bottom: 20px; }
.stat-card { flex: 1; background: #f0f2f5; border-radius: 8px; padding: 12px; text-align: center; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: #1a2b4a; }
.stat-label { font-size: 0.7rem; color: #6b7280; margin-top: 4px; }
.funnel-chart { margin-bottom: 20px; }
.funnel-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.8rem; }
.funnel-label { width: 90px; flex-shrink: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-bar-container { flex: 1; height: 20px; background: #f0f2f5; border-radius: 4px; overflow: hidden; }
.funnel-bar { height: 100%; background: #1a2b4a; border-radius: 4px; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; min-width: 24px; }
.funnel-bar-value { color: #fff; font-size: 0.7rem; font-weight: 600; }
.funnel-dropoff { width: 45px; text-align: right; font-weight: 500; }
.funnel-dropoff.high { color: #dc2626; }
.funnel-time { width: 35px; text-align: right; color: #6b7280; }
.analytics-actions { display: flex; gap: 8px; }
.analytics-btn { flex: 1; padding: 8px 12px; background: #1a2b4a; color: #fff; border: none; border-radius: 6px; font-size: 0.8rem; font-weight: 500; cursor: pointer; font-family: 'Inter', sans-serif; }
.analytics-btn:hover { background: #0f1d36; }
.analytics-btn.danger { background: #dc2626; }
.analytics-btn.danger:hover { background: #b91c1c; }
.analytics-empty { text-align: center; padding: 40px 0; color: #6b7280; }

/* === Utility === */
.hidden { display: none !important; }

/* === Responsive === */
@media (max-width: 600px) {
    .step-question { font-size: 1.1rem; }
    .quiz-container { padding: 0 16px; }
    .option-item { padding: 14px 16px; }
}
