/* ==========================================
   MICRO-LESSON.CSS
   Shared stylesheet for all micro-lesson pages
   ========================================== */

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

/* ── Base ──────────────────────────────────── */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f7f8fa;
    color: #2c3e50;
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: #27ae60; text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }

/* ── Layout ────────────────────────────────── */
.micro-lesson {
    max-width: 820px;
    margin: 0 auto;
    padding: 2.5rem 2rem 4rem;
}

/* ── Header ────────────────────────────────── */
.header {
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 2.2em;
    color: #2c3e50;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 0.4rem;
}

.header .subtitle {
    color: #6b7280;
    font-size: 1.1em;
    line-height: 1.5;
}

/* ── Sections ──────────────────────────────── */
.section {
    margin-bottom: 2.5rem;
}

.section h2 {
    color: #27ae60;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #27ae60;
}

.section h3 {
    color: #2c3e50;
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

.section p {
    margin-bottom: 0.8rem;
}

/* ── Explanation Text ──────────────────────── */
.explanation {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* ==========================================
   CONTENT COMPONENTS
   ========================================== */

/* Definition — green left border */
.definition {
    background: #e8f5e9;
    border-left: 4px solid #27ae60;
    padding: 1.2rem 1.4rem;
    border-radius: 0 8px 8px 0;
    margin: 1.2rem 0;
    font-size: 1.05em;
    line-height: 1.8;
}

/* Example — blue left border */
.example {
    background-color: #eef6ff;
    padding: 1.2rem 1.4rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid #3498db;
}

.example-title {
    font-weight: 700;
    color: #3498db;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

/* Key Point — light blue left border */
.key-point {
    background-color: #eef6ff;
    padding: 1.2rem 1.4rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    border-left: 4px solid #2980b9;
    line-height: 1.8;
}

/* Tip Box — yellow/amber */
.tip-box {
    background: #fffbeb;
    border: 1px solid #f6e05e;
    border-left: 4px solid #ecc94b;
    padding: 1rem 1.4rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
    font-size: 0.95em;
    line-height: 1.7;
}

/* Formula Box */
.formula-box {
    background: #ecf0f1;
    border-left: 4px solid #27ae60;
    padding: 1.2rem 1.5rem;
    margin: 1.5rem 0;
    font-size: 1.2rem;
    text-align: center;
}

/* ── Inline Helpers ────────────────────────── */
.highlight {
    background: #fef3c7;
    padding: 0.1em 0.4em;
    border-radius: 4px;
    font-weight: 600;
}

.percent-symbol {
    font-size: 1.3em;
    font-weight: 700;
    color: #27ae60;
}

.math-display {
    text-align: center;
    margin: 1rem 0;
    font-size: 1.2rem;
}

/* ── Steps Box ─────────────────────────────── */
.steps-box {
    background: #fff;
    border: 2px solid #27ae60;
    border-radius: 8px;
    padding: 1.2rem;
    margin: 1.5rem 0;
}

.step {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.7;
}

.step::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #27ae60;
    font-weight: bold;
}

.step:last-child {
    margin-bottom: 0;
}

/* ── Example Grid ──────────────────────────── */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.2rem;
    margin: 1.5rem 0;
}

/* ── Summary Box ───────────────────────────── */
.summary-box {
    background: #eef6ff;
    border-left: 4px solid #3498db;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

.summary-box h3 {
    color: #3498db;
    margin-bottom: 1rem;
}

.summary-box ul {
    margin-left: 1.5rem;
}

.summary-box li {
    margin-bottom: 0.5rem;
}

/* ── Percent Cards ─────────────────────────── */
.common-percents {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.percent-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.2rem 0.8rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.percent-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.percent-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.8rem;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
}

.percent-circle.p25  { background: conic-gradient(#27ae60 25%, #e2e8f0 25%); color: #2c3e50; }
.percent-circle.p50  { background: conic-gradient(#38a169 50%, #e2e8f0 50%); }
.percent-circle.p75  { background: conic-gradient(#e67e22 75%, #e2e8f0 75%); }
.percent-circle.p100 { background: #27ae60; }

.percent-card .percent {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c3e50;
}

.percent-card .equivalents {
    font-size: 0.88em;
    color: #6b7280;
    margin-top: 0.2rem;
}

/* ── Conversion Arrow Rows ─────────────────── */
.conversion-tip {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.2rem;
}

.conversion-examples {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.conversion-example {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    background: #f7f8fa;
    border-radius: 8px;
}

.percent-value {
    font-weight: 700;
    font-size: 1.15em;
    color: #27ae60;
    min-width: 60px;
}

.arrow {
    color: #9ca3af;
    font-size: 1.2em;
}

.decimal-value {
    color: #2c3e50;
    font-weight: 500;
}

/* ── Reference Table ───────────────────────── */
.reference-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.reference-table th {
    background: #27ae60;
    color: #fff;
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
}

.reference-table td {
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.reference-table tr:last-child td {
    border-bottom: none;
}

.reference-table tr:nth-child(even) {
    background: #f7f8fa;
}

/* ==========================================
   QUIZ — Orange themed
   ========================================== */

.quiz-section {
    background-color: #fff3e0;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
    border: 2px solid #ff9800;
}

.quiz-section h2 {
    color: #f57c00;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ffcc80;
}

/* Question Container */
.question-container {
    background: #fff;
    border: 1px solid #ffe0b2;
    border-radius: 10px;
    padding: 1.4rem;
    margin-bottom: 1rem;
}

.question {
    font-weight: 600;
    font-size: 1.05em;
    margin-bottom: 0.8rem;
    color: #2c3e50;
    line-height: 1.6;
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.option {
    background-color: #fff;
    padding: 0.85rem 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
    font-size: 0.98em;
    user-select: none;
}

.option:hover {
    border-color: #ff9800;
    background-color: #fff8e1;
    transform: translateX(4px);
}

.option.selected {
    background-color: #fff3e0;
    border-color: #ff9800;
    font-weight: 600;
}

.option.correct {
    background-color: #c8e6c9;
    border-color: #27ae60;
    cursor: default;
}

.option.correct:hover {
    transform: none;
    background-color: #c8e6c9;
}

.option.incorrect {
    background-color: #ffcdd2;
    border-color: #e74c3c;
    cursor: default;
}

.option.incorrect:hover {
    transform: none;
    background-color: #ffcdd2;
}

/* Feedback */
.feedback {
    margin-top: 0.8rem;
    padding: 0.9rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.93em;
    line-height: 1.5;
    display: none;
}

.feedback.correct {
    background-color: #c8e6c9;
    color: #1b5e20;
    display: block;
}

.feedback.incorrect {
    background-color: #ffcdd2;
    color: #b71c1c;
    display: block;
}

/* Submit Button */
.submit-section {
    text-align: center;
    margin-top: 1.5rem;
}

.submit-btn {
    background: #ff9800;
    color: #fff;
    border: none;
    padding: 0.9rem 2.5rem;
    font-size: 1.05em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.submit-btn:hover:not(:disabled) {
    background: #f57c00;
    transform: translateY(-1px);
}

.submit-btn:disabled {
    background: #ffcc80;
    cursor: not-allowed;
}

/* Score Container — hidden until JS adds .show */
.score-container {
    text-align: center;
    padding: 2rem;
    background: #fff;
    border: 1px solid #ffe0b2;
    border-radius: 12px;
    margin-top: 1.5rem;
    display: none;
}

.score-container.show {
    display: block;
}

.score {
    font-size: 2.8em;
    font-weight: 700;
    color: #f57c00;
}

.score-message {
    font-size: 1.15em;
    color: #4a5568;
    margin-top: 0.5rem;
}

.reset-btn {
    background: #ff9800;
    color: #fff;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 1rem;
}

.reset-btn:hover {
    background: #f57c00;
}

/* ==========================================
   EMAIL GATE
   ========================================== */

.email-gate {
    display: none;
    text-align: center;
    padding: 2rem 1.5rem;
    margin-top: 2rem;
}

.email-gate.show {
    display: block;
}

.email-gate h3 {
    color: #27ae60;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.email-gate p {
    color: #4a5568;
    font-size: 1.05em;
    margin-bottom: 1.5rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.gate-form {
    display: flex;
    gap: 0.5rem;
    max-width: 460px;
    margin: 0 auto;
}

.gate-email-field {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95em;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.gate-email-field:focus {
    border-color: #27ae60;
}

.gate-submit-btn {
    padding: 0.8rem 1.5rem;
    background: #27ae60;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.gate-submit-btn:hover:not(:disabled) {
    background: #219a52;
}

.gate-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.gate-fine {
    color: #9ca3af;
    font-size: 0.82em;
    margin-top: 0.8rem;
}

/* ==========================================
   BONUS QUIZ (hidden until subscribed)
   ========================================== */

.bonus-quiz {
    display: none;
}

.bonus-quiz.unlocked {
    display: block;
}

/* ==========================================
   RELATED LESSONS
   ========================================== */

.related-lessons {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
}

.related-lessons h2 {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.related-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.related-link {
    color: #27ae60;
    font-weight: 500;
    text-decoration: none;
    font-size: 1.02em;
}

.related-link:hover {
    color: #219a52;
    text-decoration: underline;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .micro-lesson {
        padding: 1.5rem 1rem 3rem;
    }

    .header h1 {
        font-size: 1.7em;
    }

    .common-percents {
        grid-template-columns: repeat(2, 1fr);
    }

    .example-grid {
        grid-template-columns: 1fr;
    }

    .question-container {
        padding: 1rem;
    }

    .option {
        padding: 0.75rem 1rem;
    }

    .submit-btn {
        width: 100%;
    }

    .related-links {
        grid-template-columns: 1fr;
    }

    .gate-form {
        flex-direction: column;
    }

    .gate-submit-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .micro-lesson {
        padding: 1rem 0.8rem 2.5rem;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .definition,
    .example,
    .key-point,
    .tip-box {
        padding: 1rem;
    }

    .quiz-section {
        padding: 1rem;
    }
}