﻿/* ============================================
   COURSE – CoachMyFinance Learning Platform
   ============================================ */

/* ---------- Layout ---------- */
.course-nav { background: #1e1b4b; }
.course-nav .nav-container { display: flex; align-items: center; gap: 1rem; }
.course-nav-right { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.nav-xp { display: flex; align-items: center; gap: .35rem; background: rgba(255,255,255,.12); padding: .35rem .75rem; border-radius: 20px; color: #fbbf24; font-weight: 700; font-size: .85rem; }
.xp-icon { font-size: 1rem; }
.btn-sm { font-size: .8rem; padding: .4rem .85rem; border-radius: 8px; background: rgba(255,255,255,.15); color: #fff; text-decoration: none; transition: background .2s; }
.btn-sm:hover { background: rgba(255,255,255,.25); }

.course-main { padding-top: 80px; min-height: 100vh; background: #f8fafc; }
.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Course Header ---------- */
.course-header { background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #6366f1 100%); padding: 2.5rem 0 2rem; color: #fff; }
.course-hero { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; flex-wrap: wrap; }
.course-hero-text h1 { font-size: 2rem; font-weight: 800; margin: 0 0 .5rem; }
.course-hero-text p { opacity: .85; font-size: 1rem; max-width: 420px; margin: 0; }
.course-hero-stats { display: flex; gap: 1.5rem; }
.hero-stat { display: flex; flex-direction: column; align-items: center; gap: .15rem; background: rgba(255,255,255,.12); padding: .75rem 1.25rem; border-radius: 12px; }
.hero-stat-icon { font-size: 1.4rem; }
.hero-stat-val { font-size: 1.5rem; font-weight: 800; }
.hero-stat-label { font-size: .75rem; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }

/* ---------- Overall Progress Bar ---------- */
.overall-progress { margin-bottom: 1rem; }
.progress-info { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: .4rem; opacity: .9; }
.progress-bar-track { height: 10px; background: rgba(255,255,255,.2); border-radius: 5px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #34d399, #10b981); border-radius: 5px; transition: width .6s ease; width: 0; }

/* ---------- XP & Level ---------- */
.xp-level-bar { display: flex; align-items: center; gap: 1rem; }
.level-badge { display: flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.15); padding: .4rem .9rem; border-radius: 20px; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.level-icon { font-size: 1.1rem; }
.xp-bar-track { flex: 1; height: 8px; background: rgba(255,255,255,.15); border-radius: 4px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, #fbbf24, #f59e0b); border-radius: 4px; transition: width .6s ease; width: 0; }
.xp-text { font-size: .8rem; opacity: .8; white-space: nowrap; }

/* ---------- Modules Roadmap ---------- */
.modules-roadmap { padding: 2.5rem 0; display: flex; flex-direction: column; gap: 0; }

.module-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,.06); position: relative; }
.module-card + .module-card { margin-top: 1.5rem; }
.module-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
.module-card.color-green::before { background: #10b981; }
.module-card.color-indigo::before { background: #6366f1; }
.module-card.color-amber::before { background: #f59e0b; }
.module-card.color-rose::before { background: #f43f5e; }
.module-card.color-violet::before { background: #8b5cf6; }

.module-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; cursor: pointer; user-select: none; transition: background .2s; }
.module-header:hover { background: #f1f5f9; }
.module-header-left { display: flex; align-items: center; gap: 1rem; }
.module-icon { font-size: 1.6rem; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: #f1f5f9; flex-shrink: 0; }
.module-info h3 { margin: 0; font-size: 1.05rem; font-weight: 700; color: #1e293b; }
.module-info p { margin: .15rem 0 0; font-size: .8rem; color: #64748b; }
.module-header-right { display: flex; align-items: center; gap: 1rem; }

/* Module progress ring (SVG) */
.module-progress-ring { width: 42px; height: 42px; flex-shrink: 0; }
.module-progress-ring .ring-bg { fill: none; stroke: #e2e8f0; stroke-width: 4; }
.module-progress-ring .ring-fill { fill: none; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.module-progress-text { font-size: 11px; font-weight: 700; fill: #334155; }

.module-expand-icon { font-size: 1.2rem; color: #94a3b8; transition: transform .3s; }
.module-card.expanded .module-expand-icon { transform: rotate(180deg); }

/* Lessons list inside module */
.module-lessons { max-height: 0; overflow: hidden; transition: max-height .4s ease; }
.module-card.expanded .module-lessons { max-height: 600px; }
.lessons-list { padding: 0 1.5rem 1rem; }
.lesson-item { display: flex; align-items: center; gap: .85rem; padding: .75rem 1rem; border-radius: 10px; margin-bottom: .35rem; transition: background .2s, transform .15s; cursor: pointer; position: relative; }
.lesson-item:hover:not(.locked) { background: #f1f5f9; transform: translateX(4px); }
.lesson-item.locked { opacity: .45; cursor: not-allowed; }
.lesson-item.completed .lesson-status-icon { color: #10b981; }
.lesson-item.current .lesson-status-icon { color: #6366f1; }
.lesson-status-icon { font-size: 1.3rem; flex-shrink: 0; width: 28px; text-align: center; }
.lesson-item-info { flex: 1; }
.lesson-item-title { font-weight: 600; font-size: .92rem; color: #1e293b; }
.lesson-item-meta { font-size: .75rem; color: #94a3b8; margin-top: .1rem; }
.lesson-item-xp { font-size: .8rem; font-weight: 700; color: #f59e0b; white-space: nowrap; }

/* Connection lines between modules */
.module-connector { display: flex; justify-content: center; padding: .5rem 0; }
.module-connector .conn-line { width: 3px; height: 24px; background: linear-gradient(to bottom, #cbd5e1, #94a3b8); border-radius: 2px; }

/* ---------- Badges Section ---------- */
.badges-section { padding: 2rem 0 3rem; }
.badges-section h2 { text-align: center; margin-bottom: 1.5rem; font-size: 1.3rem; color: #1e293b; }
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; }
.badge-card { display: flex; flex-direction: column; align-items: center; gap: .4rem; padding: 1.25rem .75rem; background: #fff; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.05); text-align: center; transition: transform .2s, box-shadow .2s; }
.badge-card:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,.1); }
.badge-card.locked { opacity: .35; filter: grayscale(1); }
.badge-icon { font-size: 2.2rem; }
.badge-name { font-size: .8rem; font-weight: 600; color: #334155; }
.badge-desc { font-size: .7rem; color: #94a3b8; line-height: 1.3; }

/* ---------- Lesson View ---------- */
.lesson-top-bar { position: fixed; top: 64px; left: 0; right: 0; background: #fff; z-index: 100; display: flex; align-items: center; justify-content: space-between; padding: .6rem 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.back-btn { background: none; border: none; font-size: .9rem; color: #6366f1; cursor: pointer; font-weight: 600; padding: .4rem .6rem; border-radius: 8px; transition: background .2s; }
.back-btn:hover { background: #eef2ff; }
.lesson-progress-mini { display: flex; align-items: center; gap: .6rem; }
#lessonProgressLabel { font-size: .8rem; color: #64748b; font-weight: 500; }
.mini-prog-track { width: 120px; height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.mini-prog-fill { height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #818cf8); border-radius: 3px; transition: width .5s; }

.lesson-container { max-width: 720px; margin: 0 auto; padding: 3.5rem 1.25rem 4rem; }
.lesson-header { margin-bottom: 2rem; }
.lesson-module-tag { display: inline-block; background: #eef2ff; color: #6366f1; font-size: .75rem; font-weight: 700; padding: .3rem .75rem; border-radius: 6px; margin-bottom: .5rem; text-transform: uppercase; letter-spacing: .5px; }
.lesson-header h1 { font-size: 1.6rem; font-weight: 800; color: #1e293b; margin: 0 0 .5rem; }
.lesson-meta { display: flex; gap: 1.25rem; font-size: .85rem; color: #64748b; }
.lesson-xp-reward { color: #f59e0b; font-weight: 700; }

/* ---------- Lesson Content Blocks ---------- */
.lesson-content { color: #334155; line-height: 1.75; font-size: .95rem; }
.lesson-content h2 { font-size: 1.25rem; font-weight: 700; color: #1e293b; margin: 2rem 0 .75rem; padding-top: 1rem; border-top: 1px solid #e2e8f0; }
.lesson-content h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.lesson-content h3 { font-size: 1.05rem; font-weight: 600; color: #334155; margin: 1.5rem 0 .5rem; }
.lesson-content p { margin: .75rem 0; }

.lesson-block { background: #f8fafc; border-radius: 12px; padding: 1.25rem 1.5rem; margin: 1rem 0; border-left: 4px solid #6366f1; }
.lesson-highlight { padding: 1rem 1.25rem; border-radius: 10px; margin: 1rem 0; font-weight: 600; }
.lesson-highlight.good { background: #ecfdf5; color: #065f46; border-left: 4px solid #10b981; }
.lesson-highlight.bad { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }

.lesson-callout { background: linear-gradient(135deg, #eef2ff, #e0e7ff); border-radius: 12px; padding: 1.25rem 1.5rem; margin: 1.25rem 0; font-size: 1rem; font-weight: 600; text-align: center; color: #3730a3; }

/* Bars */
.lesson-bars { margin: 1rem 0; }
.lesson-bar-row { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; font-size: .85rem; }
.lesson-bar-row .bar-label { width: 120px; text-align: right; font-weight: 600; color: #475569; flex-shrink: 0; }
.lesson-bar-row .bar-track { flex: 1; height: 24px; background: #e2e8f0; border-radius: 6px; overflow: hidden; }
.lesson-bar-row .bar-fill { height: 100%; border-radius: 6px; display: flex; align-items: center; padding-left: .5rem; font-size: .75rem; font-weight: 700; color: #fff; }
.bar-fill.green { background: linear-gradient(90deg, #10b981, #34d399); }
.bar-fill.red { background: linear-gradient(90deg, #ef4444, #f87171); }
.bar-fill.blue { background: linear-gradient(90deg, #6366f1, #818cf8); }
.bar-fill.amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

/* Compare cards */
.lesson-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.compare-card { border-radius: 12px; padding: 1.25rem; }
.compare-card.good { background: #ecfdf5; border: 2px solid #a7f3d0; }
.compare-card.bad { background: #fef2f2; border: 2px solid #fecaca; }
.compare-card h4 { margin: 0 0 .5rem; font-size: .95rem; }
.compare-card p, .compare-card ul { margin: .25rem 0; font-size: .85rem; }
.compare-card ul { padding-left: 1.2rem; }

/* Steps */
.lesson-steps { margin: 1rem 0; counter-reset: step-counter; }
.lesson-step { display: flex; gap: 1rem; margin-bottom: 1rem; }
.step-n { width: 32px; height: 32px; background: #6366f1; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.lesson-step > div { flex: 1; }
.lesson-step strong { color: #1e293b; }

/* Checklist */
.lesson-checklist { margin: 1rem 0; }
.check-item { display: flex; align-items: flex-start; gap: .5rem; margin-bottom: .5rem; font-size: .9rem; }
.check-item::before { content: '✅'; flex-shrink: 0; }

/* Formula */
.lesson-formula { background: #f1f5f9; border-radius: 12px; padding: 1.25rem; margin: 1rem 0; text-align: center; }
.formula-main { font-size: 1.1rem; font-weight: 700; color: #1e293b; margin-bottom: .25rem; }
.formula-note { font-size: .8rem; color: #64748b; }

/* Example */
.lesson-example { background: #fffbeb; border-radius: 12px; padding: 1.25rem 1.5rem; margin: 1rem 0; border-left: 4px solid #f59e0b; }

/* Math rows */
.lesson-math { background: #f8fafc; border-radius: 10px; padding: 1rem 1.25rem; margin: 1rem 0; }
.math-row { display: flex; justify-content: space-between; padding: .35rem 0; font-size: .9rem; border-bottom: 1px solid #e2e8f0; }
.math-row:last-child { border-bottom: none; }
.math-row.total { font-weight: 700; color: #1e293b; border-top: 2px solid #334155; border-bottom: none; margin-top: .25rem; padding-top: .5rem; }

/* Two ways */
.lesson-two-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.way-card { border-radius: 12px; padding: 1.25rem; background: #f8fafc; border: 2px solid #e2e8f0; }
.way-card h4 { margin: 0 0 .5rem; font-size: .95rem; }

/* Grid 4 */
.lesson-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin: 1rem 0; }
.grid-item { background: #f8fafc; border-radius: 10px; padding: 1rem .75rem; text-align: center; }
.grid-icon { font-size: 1.5rem; margin-bottom: .25rem; display: block; }
.grid-item strong { font-size: .85rem; color: #1e293b; }
.grid-item span:last-child { font-size: .75rem; color: #64748b; display: block; margin-top: .15rem; }

/* Allocation table */
.lesson-alloc-table { margin: 1rem 0; border-radius: 10px; overflow: hidden; border: 1px solid #e2e8f0; }
.alloc-row { display: grid; grid-template-columns: 2fr 1fr 1fr; padding: .6rem 1rem; font-size: .85rem; border-bottom: 1px solid #e2e8f0; }
.alloc-row:last-child { border-bottom: none; }
.alloc-row:first-child { background: #f1f5f9; font-weight: 700; color: #334155; }
.alloc-row:nth-child(even):not(:first-child) { background: #f8fafc; }

/* Fee iceberg */
.lesson-fee-iceberg { margin: 1.5rem auto; max-width: 400px; text-align: center; }
.iceberg-top { background: linear-gradient(to bottom, #dbeafe, #bfdbfe); border-radius: 12px 12px 0 0; padding: 1.5rem; }
.iceberg-top h4 { margin: 0 0 .25rem; color: #1d4ed8; }
.iceberg-bottom { background: linear-gradient(to bottom, #1e3a5f, #0f172a); border-radius: 0 0 12px 12px; padding: 1.5rem; color: #94a3b8; }
.iceberg-bottom h4 { color: #f87171; margin: 0 0 .5rem; }
.iceberg-bottom ul { text-align: left; padding-left: 1.2rem; margin: 0; }
.iceberg-bottom li { margin-bottom: .25rem; font-size: .85rem; }

/* Broker list */
.lesson-broker-list { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.broker-card { background: #fff; border: 2px solid #e2e8f0; border-radius: 12px; padding: 1rem 1.25rem; }
.broker-card h4 { margin: 0 0 .25rem; font-size: .95rem; }
.broker-card p { margin: .15rem 0; font-size: .8rem; color: #64748b; }

/* ETF picks */
.lesson-etf-picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1rem 0; }
.etf-pick { background: #f8fafc; border-radius: 10px; padding: 1rem; text-align: center; }
.etf-ticker-lg { font-size: 1rem; font-weight: 800; color: #6366f1; display: block; margin-bottom: .25rem; }
.etf-pick span:last-child { font-size: .75rem; color: #64748b; }

/* Visual bond */
.lesson-visual-bond { margin: 1rem 0; display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; }
.bond-step { background: #eef2ff; border-radius: 10px; padding: .75rem 1rem; text-align: center; min-width: 100px; }
.bond-step strong { display: block; font-size: .85rem; color: #4338ca; }
.bond-step span { font-size: .75rem; color: #64748b; }
.bond-arrow { font-size: 1.5rem; color: #6366f1; }

/* Note */
.lesson-note { background: #f1f5f9; border-radius: 10px; padding: 1rem 1.25rem; margin: 1rem 0; font-size: .85rem; color: #475569; border-left: 4px solid #94a3b8; }

/* Mini bar set */
.mini-bar-set { display: flex; align-items: flex-end; gap: .5rem; justify-content: center; margin: 1rem 0; height: 120px; }
.m-bar { width: 50px; border-radius: 6px 6px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: .35rem; }
.m-bar span:first-child { font-size: .7rem; font-weight: 700; color: #fff; }
.m-bar span:last-child { font-size: .65rem; margin-top: .15rem; font-weight: 600; }

/* ---------- Quiz ---------- */
.lesson-quiz { margin-top: 2rem; padding-top: 2rem; border-top: 2px solid #e2e8f0; }
.lesson-quiz h2 { text-align: center; font-size: 1.2rem; margin-bottom: 1.5rem; color: #1e293b; }

.quiz-question-card { background: #fff; border: 2px solid #e2e8f0; border-radius: 14px; padding: 1.5rem; margin-bottom: 1.25rem; transition: border-color .3s; }
.quiz-question-card.correct { border-color: #10b981; background: #f0fdf4; }
.quiz-question-card.wrong { border-color: #ef4444; background: #fef2f2; }
.quiz-question-text { font-weight: 600; font-size: 1rem; color: #1e293b; margin-bottom: 1rem; }
.quiz-options { display: flex; flex-direction: column; gap: .5rem; }
.quiz-option { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border: 2px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all .2s; font-size: .9rem; }
.quiz-option:hover:not(.disabled) { border-color: #6366f1; background: #eef2ff; }
.quiz-option.selected { border-color: #6366f1; background: #eef2ff; }
.quiz-option.selected.correct-answer { border-color: #10b981; background: #ecfdf5; }
.quiz-option.selected.wrong-answer { border-color: #ef4444; background: #fef2f2; }
.quiz-option.disabled { cursor: not-allowed; opacity: .7; }
.quiz-option.show-correct { border-color: #10b981; background: #ecfdf5; }
.quiz-option-marker { width: 22px; height: 22px; border: 2px solid #cbd5e1; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: .75rem; transition: all .2s; }
.quiz-option.selected .quiz-option-marker { border-color: #6366f1; background: #6366f1; color: #fff; }
.quiz-option.selected.correct-answer .quiz-option-marker { border-color: #10b981; background: #10b981; }
.quiz-option.selected.wrong-answer .quiz-option-marker { border-color: #ef4444; background: #ef4444; }
.quiz-option.show-correct .quiz-option-marker { border-color: #10b981; background: #10b981; color: #fff; }

.quiz-feedback { text-align: center; margin-top: 1.5rem; }
.quiz-score { font-size: 1.1rem; font-weight: 700; padding: 1rem; border-radius: 12px; margin-bottom: 1rem; }
.quiz-score.pass { background: #ecfdf5; color: #065f46; }
.quiz-score.fail { background: #fef2f2; color: #991b1b; }

/* ---------- Lesson Complete ---------- */
.lesson-complete-section { text-align: center; padding: 2rem 0; }
.btn-lg { font-size: 1.05rem; padding: .85rem 2rem; }
.btn-primary { background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(99,102,241,.35); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Celebration Overlay ---------- */
.celebration-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.6); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.celebration-content { background: #fff; border-radius: 20px; padding: 2.5rem 3rem; text-align: center; max-width: 380px; animation: celebrationPop .5s ease; }
@keyframes celebrationPop { 0% { transform: scale(.5); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
.celebration-icon { font-size: 3.5rem; margin-bottom: .5rem; animation: celebBounce 1s ease infinite; }
@keyframes celebBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.celebration-content h2 { font-size: 1.4rem; margin: .5rem 0; color: #1e293b; }
#celebrationXP { font-size: 1.6rem; font-weight: 800; color: #f59e0b; margin: .25rem 0 1rem; }
.celebration-badges { display: flex; gap: .75rem; justify-content: center; margin-bottom: 1rem; }
.celebration-badge-item { display: flex; flex-direction: column; align-items: center; gap: .2rem; animation: badgePop .5s ease .3s both; }
@keyframes badgePop { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.celebration-badge-item .cb-icon { font-size: 2rem; }
.celebration-badge-item .cb-name { font-size: .7rem; font-weight: 600; color: #475569; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .course-hero { flex-direction: column; align-items: flex-start; }
  .course-hero-stats { width: 100%; justify-content: space-around; }
  .lesson-compare, .lesson-two-ways, .lesson-broker-list { grid-template-columns: 1fr; }
  .lesson-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .lesson-etf-picks { grid-template-columns: 1fr 1fr; }
  .badges-grid { grid-template-columns: repeat(3, 1fr); }
  .mini-prog-track { width: 80px; }
}
@media (max-width: 480px) {
  .course-hero-text h1 { font-size: 1.5rem; }
  .hero-stat { padding: .5rem .75rem; }
  .hero-stat-val { font-size: 1.2rem; }
  .lesson-container { padding: 3rem 1rem 3rem; }
  .lesson-header h1 { font-size: 1.3rem; }
  .lesson-grid-4 { grid-template-columns: 1fr 1fr; }
  .lesson-etf-picks { grid-template-columns: 1fr; }
  .badges-grid { grid-template-columns: repeat(2, 1fr); }
  .xp-level-bar { flex-wrap: wrap; }
}
