/* =========================================
   GLS EQUITY: LEARNING MODULE STYLES
   (Scoped specifically to learning.html)
   ========================================= */

/* --- Typography & Base --- */
.learning-module-content { font-size: 16px; line-height: 1.8; color: #334155; }
.learning-module-content h1 { text-align: left !important; margin-bottom: 15px; }
.learning-module-content h2 { border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; margin-top: 30px; }
.lead-text { font-size: 18px; font-weight: 600; color: #334155; margin-bottom: 25px; line-height: 1.5; }
.reading-width { max-width: 850px; margin: 0; }

/* --- Sidebar Curriculum Nav --- */
.nav-curriculum-list { list-style: none; padding: 0; margin: 0; }
.nav-curriculum-list li { margin-bottom: 8px; }
.nav-curriculum-list a { display: block; padding: 10px 15px; color: #475569; text-decoration: none; border-radius: 6px; font-weight: 600; transition: all 0.2s; border-left: 3px solid transparent; }
.nav-curriculum-list a:hover { background: #f1f5f9; color: #0f172a; }
.nav-curriculum-list a.active { background: #ecfdf5; color: #10b981; border-left-color: #10b981; }
.nav-curriculum-list a.completed::after { content: "✓"; float: right; color: #10b981; font-weight: bold; }

/* --- Content Blocks & Images --- */
.learning-img-wrapper { display: flex; gap: 25px; align-items: flex-start; margin: 30px 0; flex-wrap: wrap; }
.learning-img { max-width: 280px; width: 100%; border-radius: 8px; border: 1px solid #e2e8f0; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.learning-text-block { flex: 1; min-width: 280px; }
.term-def { margin-bottom: 15px; font-size: 16px; }
.term-def strong { font-size: 17px; color: #0f172a; }
.concept-blue-box { background-color: #eff6ff; border-left: 4px solid #3b82f6; padding: 15px 20px; border-radius: 0 8px 8px 0; color: #1e3a8a; }

/* --- CSS Technical Diagrams --- */
.css-diagram { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 25px; text-align: center; margin-bottom: 20px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); }
.math-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; font-size: 20px; font-weight: 800; color: #0f172a; }
.math-box { background: white; border: 2px solid #cbd5e1; padding: 15px 25px; border-radius: 8px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.math-box-sm { padding: 12px 20px; font-size: 16px; }
.math-box-sm span { display: block; font-size: 12px; font-weight: 600; color: #64748b; margin-top: 4px; }
.math-operator { color: #64748b; font-size: 24px; font-weight: bold; }
.math-highlight { border-color: #10b981; color: #10b981; background: #f0fdf4; }
.border-blue { border-color: #3b82f6; }
.border-pink { border-color: #ec4899; }

/* --- Accordions --- */
.lesson-accordion { margin-bottom: 15px; border: 1px solid #e2e8f0; border-radius: 8px; background-color: #ffffff; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.lesson-accordion summary { padding: 20px; font-size: 18px; font-weight: 700; color: #0f172a; cursor: pointer; display: flex; justify-content: space-between; align-items: center; user-select: none; margin: 0; border-radius: 8px; transition: background 0.2s; }
.lesson-accordion summary:hover { background-color: #f8fafc; }
.lesson-accordion summary::-webkit-details-marker { display: none; }
.lesson-accordion summary:after { content: '+'; font-size: 24px; color: #10b981; transition: transform 0.2s; font-weight: normal; }
.lesson-accordion[open] summary:after { transform: rotate(45deg); color: #ef4444; }
.lesson-accordion[open] summary { border-bottom: 1px solid #e2e8f0; border-radius: 8px 8px 0 0; }
.lesson-accordion-body { padding: 30px 20px; }

/* --- Premium Math Grids --- */
.premium-math-container { background: #f8fafc; border: 1px solid #cbd5e1; border-radius: 8px; padding: 25px; margin: 20px 0; }
.pm-row { display: flex; align-items: stretch; justify-content: space-between; gap: 15px; flex-wrap: wrap; }
.pm-box { flex: 1; min-width: 140px; background: white; border: 2px solid #e2e8f0; border-radius: 6px; padding: 15px; text-align: center; }
.pm-box.blue { border-color: #3b82f6; box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.1); }
.pm-box.pink { border-color: #ec4899; box-shadow: 0 4px 6px -1px rgba(236, 72, 153, 0.1); }
.pm-box.green { border-color: #10b981; background: #f0fdf4; box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.1); }
.pm-title { font-size: 14px; font-weight: 800; text-transform: uppercase; margin-bottom: 5px; color: #0f172a; }
.pm-val { font-size: 24px; font-weight: 800; color: #0f172a; }
.pm-desc { font-size: 12px; color: #64748b; margin-top: 5px; font-weight: 600; line-height: 1.3; }
.pm-operator { display: flex; align-items: center; font-size: 24px; font-weight: 800; color: #64748b; }

/* --- Scenario & Strategy Charts --- */
.csp-chart-grid { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 25px; margin-bottom: 25px; }
.csp-scenario { flex: 1; min-width: 220px; background: white; border: 1px solid #cbd5e1; border-radius: 8px; padding: 15px; display: flex; flex-direction: column; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.csp-graph-area { height: 130px; border-bottom: 2px solid #0f172a; border-left: 2px solid #0f172a; position: relative; margin-bottom: 10px; background: #f8fafc; overflow: hidden; }
.csp-strike-line { position: absolute; bottom: 40px; left: 0; width: 100%; border-top: 2px dashed #ef4444; }
.csp-strike-tag { position: absolute; bottom: 42px; left: 5px; font-size: 10px; color: #ef4444; font-weight: bold; background: rgba(255,255,255,0.9); padding: 2px 4px; border-radius: 3px; }
.csp-trend-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; box-sizing: border-box; z-index: 10; }
.csp-path { fill: none; stroke: #10b981; stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; }
.csp-dot { fill: #10b981; stroke: white; stroke-width: 2.5px; }
.csp-axis-labels { display: flex; justify-content: space-between; font-size: 11px; font-weight: bold; color: #64748b; text-transform: uppercase; margin-bottom: 10px; }

.four-options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; margin: 25px 0; }
.opt-card { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.opt-card h4 { margin-bottom: 8px; font-size: 16px; border-bottom: 2px solid #f1f5f9; padding-bottom: 8px; }

.leaps-comparison { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 25px; margin-bottom: 25px; }
.leaps-col { flex: 1; min-width: 250px; background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 25px; position: relative; }
.leaps-col.stock { border-top: 5px solid #64748b; }
.leaps-col.leaps { border-top: 5px solid #3b82f6; background: #f8fafc; box-shadow: 0 10px 15px -3px rgba(59,130,246,0.1); }
.leaps-math-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.leaps-math-row:last-child { border-bottom: none; font-size: 16px; font-weight: 800; padding-top: 15px; margin-top: 10px; border-top: 2px solid #e2e8f0; }

/* --- Options Strategy Components --- */
.strategy-card { background: #ffffff; border-radius: 12px; padding: 25px; margin-bottom: 30px; border: 1px solid #e2e8f0; box-shadow: 0 4px 10px rgba(0,0,0,0.03); }
.strat-meta { font-size: 15px; color: #475569; margin-bottom: 20px; line-height: 1.6; }
.text-2xl { font-size: 22px; margin: 0 0 8px 0; font-weight: 700; }

/* Chart Height & Backgrounds */
.strat-chart { position: relative; height: 220px; width: 100%; margin-bottom: 20px; background: #ffffff; border-radius: 8px; border: 1px solid #e2e8f0; overflow: hidden; font-family: sans-serif; }
.chart-bg-win { position: absolute; top: 0; left: 0; right: 0; height: 110px; background: rgba(34, 197, 94, 0.08); }
.chart-bg-win-custom { position: absolute; top: 0; left: 0; right: 0; height: 100px; background: rgba(34, 197, 94, 0.08); }
.chart-bg-loss { position: absolute; top: 110px; left: 0; right: 0; bottom: 30px; background: rgba(239, 68, 68, 0.05); }
.chart-bg-loss-custom { position: absolute; top: 100px; left: 0; right: 0; bottom: 25px; background: rgba(239, 68, 68, 0.05); }

/* Row 1: Top Legend & Labels */
.chart-y-label { position: absolute; top: 8px; left: 8px; font-size: 11px; color: #475569; font-weight: bold; }
.chart-legend { position: absolute; top: 8px; right: 10px; font-size: 11px; font-weight: bold; display: flex; align-items: center; }
.legend-line { width: 16px; height: 3px; margin-right: 6px; border-radius: 2px; }

/* Row 2: Strike & BE Labels (Overrides the JS inline style) */
.strat-chart > span.axis-label { top: 28px !important; }

/* Floating Labels & Zero Line */
.chart-pos-label { position: absolute; top: 30%; left: 8px; font-size: 10px; color: #059669; font-weight: 800; opacity: 0.6; }
.chart-neg-label { position: absolute; top: 75%; left: 8px; font-size: 10px; color: #dc2626; font-weight: 800; opacity: 0.6; }
.chart-zero-line { position: absolute; top: 110px; left: 0; right: 0; border-top: 1px dashed #64748b; }
.chart-zero-line-custom { position: absolute; top: 100px; left: 0; right: 0; border-top: 1px dashed #64748b; }
.chart-zero-label { position:absolute; top: 93px; left:8px; font-size:11px; color:#0f172a; font-weight:bold; }
.chart-zero-label-custom { position:absolute; top: 85px; left:8px; font-size:10px; color:#0f172a; font-weight:bold; }

/* Row 3: Vertical Markers (Shifted down to clear Row 2 labels) */
.marker-strike, .marker-be-win, .marker-be-loss { position: absolute; top: 48px !important; bottom: 30px; border-left-width: 2px; }
.marker-strike { border-left-style: dotted; border-left-color: #94a3b8; }
.marker-be-win { border-left-style: dashed; border-left-color: #059669; }
.marker-be-loss { border-left-style: dashed; border-left-color: #dc2626; }

/* SVG Layer */
.chart-svg-layer { width: 100%; height: calc(100% - 50px); position: absolute; top: 20px; left: 0; }
.chart-svg-layer-custom { width: 100%; height: calc(100% - 45px); position: absolute; top: 20px; left: 0; }

/* Bottom Axis */
.chart-x-axis { position: absolute; bottom: 0; left: 0; right: 0; height: 30px; background: #f8fafc; border-top: 1px solid #e2e8f0; display: flex; align-items: center; font-size: 11px; font-weight:bold; }
.chart-x-axis-custom { position: absolute; bottom: 0; left: 0; right: 0; height: 25px; background: #f8fafc; border-top: 1px solid #e2e8f0; display: flex; align-items: center; font-size: 10px; font-weight:bold; }
.axis-label { position: absolute; transform: translateX(-50%); }
.axis-label-right { position: absolute; right: 10px; color: #64748b; }
.axis-label-left { position: absolute; left: 10%; color: #64748b; }

.strat-setup { font-size: 15px; color: #334155; line-height: 1.7; }

.scenario-box { padding: 15px; margin-top: 15px; border-radius: 0 6px 6px 0; }
.scenario-win { background: #f0fdf4; border-left: 4px solid #22c55e; }
.scenario-loss { background: #fef2f2; border-left: 4px solid #ef4444; }
.scenario-neutral { background: #eff6ff; border-left: 4px solid #3b82f6; }

.scenario-title-win { color: #166534; font-size: 16px; font-weight: bold; }
.scenario-title-loss { color: #991b1b; font-size: 16px; font-weight: bold; }
.scenario-title-neutral { color: #1d4ed8; font-size: 16px; font-weight: bold; }

.math-breakdown { font-family: monospace; font-size: 14px; margin: 10px 0 0 0; padding: 10px; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 6px; line-height: 1.5; }

/* Wheel Flow SVG */
.wheel-flow-container { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 25px 15px; margin: 20px 0; overflow-x: auto; }
.wheel-svg-wrapper { width: 100%; min-width: 550px; max-width: 700px; margin: 0 auto; display: block; font-family: sans-serif; }

/* --- Quiz System --- */
.quiz-container { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 30px; margin-top: 40px; max-width: 850px; margin-left: 0; margin-right: auto; box-sizing: border-box; }
.quiz-question { font-weight: 700; color: #0f172a; margin-bottom: 15px; font-size: 18px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option { display: flex; align-items: center; padding: 12px 15px; background: white; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; transition: all 0.2s; margin: 0; }
.quiz-option:hover { border-color: #10b981; background: #f0fdf4; }
.quiz-option input { margin-right: 15px; accent-color: #10b981; width: 18px; height: 18px; cursor: pointer; }
.missed-question-card { background: #ffffff; border: 1px solid #fecaca; border-left: 4px solid #ef4444; padding: 15px 20px; margin-bottom: 15px; border-radius: 6px; }
.missed-q-text { font-weight: 700; color: #0f172a; margin-bottom: 8px; font-size: 14px; }
.missed-ans-wrong { color: #ef4444; text-decoration: line-through; font-size: 13px; margin-bottom: 4px; }
.missed-ans-right { color: #10b981; font-weight: bold; font-size: 13px; }

/* =========================================
   MOBILE RESPONSIVENESS (SCOPED TO LEARNING)
   ========================================= */
@media (max-width: 768px) {
    /* 1. ELIMINATE THE "BOX INSIDE A BOX" EFFECT */
    .lesson-accordion {
        margin-left: -15px !important;
        margin-right: -15px !important;
        border-left: none !important;
        border-right: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border-bottom: 2px solid #f1f5f9 !important;
    }
    
    .lesson-accordion summary {
        padding: 15px !important;
        border-bottom: none !important;
    }
    
    .lesson-accordion-body { 
        padding: 5px 15px 25px 15px !important; 
    }

    .strategy-card, .premium-math-container, .css-diagram, .quiz-container { 
        margin-left: -15px !important; 
        margin-right: -15px !important; 
        border-radius: 0 !important; 
        border-left: none !important; 
        border-right: none !important; 
        padding: 25px 15px !important; 
        border-bottom: 2px solid #e2e8f0 !important;
    }

    .math-breakdown {
        padding: 12px 15px;
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .scenario-box {
        padding: 15px 15px;
        margin-left: -15px;
        margin-right: -15px;
        border-radius: 0;
    }

    /* 2. THE SVG CHART OVERLAP FIX */
    .chart-x-axis span, .chart-x-axis-custom span, .strat-chart > span.axis-label {
        font-size: 9px !important;
        letter-spacing: -0.5px;
    }
    
    /* Forces the "(BE)" text to wrap underneath the price to save horizontal space */
    .axis-label b, .axis-label-left b, .axis-label-right b {
        display: inline-block;
        max-width: 32px; 
        white-space: normal;
        text-align: center;
        line-height: 1.1;
    }

    /* Hide non-essential background labels to free up pixels */
    .axis-label-right { display: none !important; } 
    
    .chart-legend, .chart-y-label { font-size: 9px !important; }
    .chart-pos-label, .chart-neg-label, .chart-zero-label, .chart-zero-label-custom {
        font-size: 8px !important;
    }

    /* 3. FLATTEN GRIDS TO SINGLE COLUMN */
    .four-options-grid { grid-template-columns: 1fr !important; gap: 10px; }
    .csp-chart-grid { flex-direction: column; gap: 20px !important; }
    .leaps-comparison { flex-direction: column; gap: 15px; }
    .pm-row { flex-direction: column; gap: 10px; }
    
    .learning-img-wrapper { flex-direction: column; gap: 15px; }
    .learning-img { max-width: 100% !important; }
}