/* =====================================================
   IB SEHS 2026 STUDY GUIDES - COMPLETE STYLESHEET
   ===================================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', Arial, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #004587 0%, #002a52 100%);
    color: #fff;
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

/* =====================================================
   STICKY TOPIC HEADER (Topic Pages Only)
   ===================================================== */

.sticky-topic-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(135deg, #004587 0%, #002a52 100%);
    border-bottom: 3px solid #fbba07;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.menu-btn {
    background: rgba(251, 186, 7, 0.2);
    color: #fbba07;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.menu-btn:hover {
    background: #fbba07;
    color: #004587;
    transform: scale(1.05);
}

.header-topic-title {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
    margin: 0 1rem;
}

/* Push container down ONLY when sticky header exists */
.sticky-topic-header~.container {
    margin-top: 60px;
}

/* =====================================================
   HEADER & NAVIGATION
   ===================================================== */

.site-header {
    text-align: center;
    margin-bottom: 2rem;
}

.site-header h1 {
    font-size: 2.5rem;
    color: #fbba07;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
}

/* Topic Navigation Bar */
.topic-nav {
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.back-link {
    color: #fbba07;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-link:hover {
    text-decoration: underline;
}

.topic-title-nav {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
}

/* =====================================================
   INDEX PAGE COMPONENTS
   ===================================================== */

.instructions {
    background: rgba(255, 255, 255, 0.1);
    border-left: 4px solid #fbba07;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    line-height: 1.8;
    font-weight: 300;
    font-size: 1.1rem;
}

.instructions strong {
    color: #fbba07;
    font-weight: 500;
}

.topic-section {
    margin-bottom: 3rem;
}

.topic-section h2 {
    color: #fbba07;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(251, 186, 7, 0.3);
}

.topic-grid {
    display: grid;
    gap: 2rem;
}

.topic-card {
    background: #fff;
    color: #004587;
    padding: 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.25rem;
}

.topic-card:last-child {
    margin-bottom: 0;
}

.topic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(251, 186, 7, 0.4);
}

.topic-number {
    background: #fbba07;
    color: #004587;
    font-size: 1.5rem;
    font-weight: 700;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topic-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
    color: #004587;
}

.topic-desc {
    font-size: 0.95rem;
    color: #666;
    font-weight: 400;
}

.site-footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* =====================================================
   TOPIC PAGE CONTENT WRAPPER
   ===================================================== */

.topic-content-wrapper {
    background: #fff;
    color: #333;
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    line-height: 1.7;
}

/* =====================================================
   TYPOGRAPHY
   ===================================================== */

.topic-content-wrapper h1 {
    color: #004587;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.topic-content-wrapper h2 {
    color: #004587;
    font-size: 1.8rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #fbba07;
}

.topic-content-wrapper h3 {
    color: #004587;
    font-size: 1.4rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
}

.topic-content-wrapper h4 {
    color: #004587;
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.topic-content-wrapper p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.topic-content-wrapper strong {
    color: #004587;
    font-weight: 600;
}

/* =====================================================
   LISTS
   ===================================================== */

.topic-content-wrapper ul,
.topic-content-wrapper ol {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
}

.topic-content-wrapper li {
    margin-bottom: 0.75rem;
    line-height: 1.7;
}

/* =====================================================
   TABLES
   ===================================================== */

.topic-content-wrapper table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.topic-content-wrapper th,
.data-table th {
    background: linear-gradient(135deg, #004587 0%, #003366 100%);
    color: #fff;
    padding: 1.25rem;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
}

.topic-content-wrapper td,
.data-table td {
    padding: 1.25rem;
    border-bottom: 1px solid #dee2e6;
}

.topic-content-wrapper tbody tr:hover,
.data-table tbody tr:hover {
    background: #f8f9fa;
}

.topic-content-wrapper tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
    background: #f9f9f9;
}

/* =====================================================
   ENHANCED TOPIC PAGE COMPONENTS
   ===================================================== */

.section-badge {
    display: inline-block;
    background: linear-gradient(135deg, #fbba07 0%, #e0a800 100%);
    color: #004587;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.key-term-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #004587;
    padding: 1rem 1.5rem;
    margin: 1.25rem 0;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.key-term-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 69, 135, 0.2);
}

.term-title {
    color: #004587;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
}

.term-definition {
    color: #555;
    line-height: 1.6;
}

.subsection-header {
    background: linear-gradient(135deg, #004587 0%, #003366 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    margin: 2.5rem 0 1.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* =====================================================
   MCQ STYLING
   ===================================================== */

.mcq-container {
    background: #fff;
    border: 3px solid #004587;
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
    box-shadow: 0 4px 12px rgba(0, 69, 135, 0.15);
}

.mcq-number {
    background: #004587;
    color: #fbba07;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 1rem;
}

.mcq-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: #222;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.mcq-options {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.mcq-options li {
    background: #f8f9fa;
    padding: 1rem 1.25rem;
    margin: 0.75rem 0;
    border-radius: 8px;
    border-left: 4px solid #dee2e6;
    transition: all 0.2s;
    cursor: pointer;
}

.mcq-options li:hover {
    background: #e9ecef;
    border-left-color: #004587;
    transform: translateX(5px);
}

.mcq-answer-box {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 5px solid #28a745;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.mcq-answer-label {
    color: #155724;
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
    display: block;
}

.mcq-explanation {
    color: #155724;
    line-height: 1.7;
}

.mcq-explanation strong {
    color: #0d4318;
}

/* =====================================================
   TIP & NOTE BOXES
   ===================================================== */

.tip-box {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-left: 5px solid #fbba07;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(251, 186, 7, 0.2);
    color: #333;
}

.note-box {
    background: linear-gradient(135deg, #e6f3ff 0%, #cce5ff 100%);
    border-left: 5px solid #004587;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 69, 135, 0.2);
    color: #333;
}

/* =====================================================
   MECHANISM STEPS
   ===================================================== */

.mechanism-steps {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    padding: 2rem;
    border-radius: 12px;
    margin: 2.5rem 0;
}

.mechanism-steps ol {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mechanism-steps ol li {
    counter-increment: step-counter;
    position: relative;
    padding-left: 3.5rem;
    margin: 2rem 0;
}

.mechanism-steps ol li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: -5px;
    background: #004587;
    color: #fbba07;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.mechanism-steps ul {
    list-style: disc;
    margin-left: 1.5rem;
}

/* =====================================================
   REAL-WORLD EXAMPLES
   ===================================================== */

.real-world-example {
    background: linear-gradient(135deg, #fff5f5 0%, #ffe6e6 100%);
    border-left: 5px solid #dc3545;
    padding: 1.5rem;
    margin: 2.5rem 0;
    border-radius: 8px;
    color: #333;
}

/* =====================================================
   FORMULA & CALCULATIONS
   ===================================================== */

.formula-box {
    background: #f0f0f0;
    border: 2px solid #004587;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    margin: 2.5rem 0;
    text-align: center;
    font-weight: 600;
}

.working-steps {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
}

.working-steps h4 {
    color: #004587;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.working-steps ol {
    margin-left: 0;
    padding-left: 1.5rem;
}

.working-steps ul {
    list-style: none;
    padding-left: 0;
    margin-left: 0;
}

.working-steps li {
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
}

/* =====================================================
   BADGES & LABELS
   ===================================================== */

.hl-badge {
    background: #ff6b6b;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* =====================================================
   CHECKLIST
   ===================================================== */

.checklist {
    list-style: none;
    padding: 0;
}

.checklist li {
    padding: 1rem 0.75rem 1rem 3rem;
    position: relative;
    border-bottom: 1px solid #dee2e6;
}

.checklist li::before {
    content: "☐";
    position: absolute;
    left: 0.75rem;
    font-size: 1.5rem;
    color: #004587;
}

/* ============================================
   ERROR CARDS (Common Errors Section)
   ============================================ */

.error-card {
    background: #ffe6e6;
    border-left: 4px solid #cc0000;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.error-card .error-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: #cc0000;
    margin-bottom: 0.5rem;
}

.error-card .error-explanation {
    color: #333;
    line-height: 1.6;
}

/* ============================================
   LINKING CARDS (Linking Questions Section)
   ============================================ */

.linking-card {
    background: #e6f3ff;
    border-left: 4px solid #004587;
    padding: 1.25rem;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.linking-card .linking-question {
    font-weight: 600;
    font-size: 1.05rem;
    color: #004587;
    margin-bottom: 0.75rem;
}

.linking-card .linking-answer {
    color: #333;
    line-height: 1.7;
}

/* ============================================
   PAPER 1B: DATA-BASED QUESTIONS (DBQ)
   ============================================ */

.dbq-container {
    background: #ffffff;
    border: 3px solid #28a745;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
}

.dbq-number {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.dbq-intro {
    background: #f8f9fa;
    padding: 1.25rem;
    border-left: 4px solid #28a745;
    margin: 1.5rem 0;
    font-size: 0.98rem;
    line-height: 1.7;
    color: #2c3e50;
}

.dbq-part {
    margin: 1.5rem 0 1rem 0;
    font-weight: 500;
    color: #2c3e50;
}

.dbq-part-label {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    margin-right: 0.75rem;
    font-size: 0.9rem;
}

.dbq-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dbq-data-table thead {
    background: #28a745;
    color: white;
}

.dbq-data-table th,
.dbq-data-table td {
    padding: 0.9rem;
    text-align: left;
    border: 1px solid #dee2e6;
}

.dbq-data-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.dbq-data-table tbody tr:hover {
    background: #e9f7ef;
}

/* ============================================
   PAPER 2: EXTENDED RESPONSE QUESTIONS
   ============================================ */

.paper2-container {
    background: #ffffff;
    border: 3px solid #28a745;
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.2);
    position: relative;
}

.paper2-number {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    margin-right: 1rem;
}

.marks-badge {
    display: inline-block;
    background: #fbba07;
    color: #1a1a1a;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

/* ============================================
   MODEL ANSWERS (Used in both DBQ and Paper 2)
   ============================================ */

.model-answer {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7ff 100%);
    border: 2px solid #004587;
    border-radius: 10px;
    padding: 1.75rem;
    margin: 1.5rem 0;
}

.model-answer-label {
    display: inline-block;
    background: #004587;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.model-answer-content {
    color: #1a1a1a;
    line-height: 1.8;
    font-size: 0.98rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease-in-out;
}

.model-answer-content.revealed {
    max-height: 2000px;
    opacity: 1;
    margin-top: 1rem;
}

.model-answer-content strong {
    color: #004587;
    font-weight: 600;
}

/* ============================================
   REVEAL ANSWER BUTTON (DBQ & Paper 2)
   ============================================ */

.reveal-answer-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    margin: 1rem 0;
    background: linear-gradient(135deg, #004587 0%, #002a52 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 69, 135, 0.2);
}

.reveal-answer-btn:hover {
    background: linear-gradient(135deg, #003870 0%, #001f3f 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 69, 135, 0.3);
}

.reveal-answer-btn:active {
    transform: translateY(0);
}

.reveal-answer-btn .icon {
    display: inline-block;
    transition: transform 0.3s ease;
    margin-right: 0.5rem;
}

.reveal-answer-btn.revealed .icon {
    transform: rotate(180deg);
}

/* =====================================================
   HORIZONTAL RULE
   ===================================================== */

hr {
    border: none;
    border-top: 2px solid #ddd;
    margin: 2rem 0;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */

@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }

    .sticky-topic-header {
        padding: 0.5rem 1rem;
        height: auto;
    }

    .sticky-topic-header~.container {
        margin-top: 70px;
    }

    .header-topic-title {
        font-size: 0.9rem;
    }

    .site-header h1 {
        font-size: 2rem;
    }

    .topic-content-wrapper {
        padding: 2rem 1.5rem;
    }

    .topic-content-wrapper h1 {
        font-size: 1.8rem;
    }

    .topic-content-wrapper h2 {
        font-size: 1.5rem;
    }

    .topic-number {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .topic-content-wrapper table,
    .data-table {
        font-size: 0.9rem;
    }

    .mcq-container,
    .dbq-container,
    .paper2-container {
        padding: 1.25rem;
        margin: 1.5rem 0;
    }

    .dbq-number,
    .paper2-number {
        display: block;
        margin-bottom: 0.75rem;
        text-align: center;
    }

    .marks-badge {
        display: block;
        margin-top: 0.5rem;
        text-align: center;
    }

    .model-answer {
        padding: 1.25rem;
    }

    .dbq-data-table {
        font-size: 0.85rem;
    }

    .dbq-data-table th,
    .dbq-data-table td {
        padding: 0.6rem;
    }

    .mechanism-steps ol li {
        padding-left: 3rem;
    }
}

@media (max-width: 480px) {
    .topic-card {
        flex-direction: column;
        text-align: center;
    }

    .topic-nav {
        flex-direction: column;
        text-align: center;
    }

    .topic-content-wrapper {
        padding: 1.5rem 1rem;
    }

    .sticky-topic-header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
}

/* =====================================================
   IMAGE COMPONENTS
   ===================================================== */

.study-image {
    margin: 2.5rem auto;
    padding: 0;
    max-width: 100%;
    text-align: center;
}

.study-image img {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 69, 135, 0.2);
    border: 3px solid #004587;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.study-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 69, 135, 0.3);
}

.study-image figcaption {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #555;
    font-style: italic;
    line-height: 1.6;
}

/* Image row (for side-by-side images) */
.image-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2.5rem 0;
}

.image-row .study-image {
    margin: 0;
}

/* Smaller images (add class="small-image" to figure) */
.study-image.small-image img {
    max-width: 400px;
}

/* Large images (add class="large-image" to figure) */
.study-image.large-image img {
    max-width: 100%;
}

/* Image within boxes (tip-box, note-box, etc.) */
.tip-box .study-image img,
.note-box .study-image img,
.real-world-example .study-image img {
    border-color: rgba(0, 69, 135, 0.3);
    max-width: 500px;
}

/* =====================================================
   RESPONSIVE IMAGE ADJUSTMENTS
   ===================================================== */

@media (max-width: 768px) {
    .study-image img {
        border-width: 2px;
    }

    .image-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .study-image figcaption {
        font-size: 0.85rem;
    }
}

/* =====================================================
   ADDITIONS FOR EXAM STRATEGY PAGE
   ===================================================== */

/* Priority Labels for Prediction Tables */
.priority-high {
    color: #d32f2f;
    font-weight: 700;
    background: rgba(211, 47, 47, 0.08);
    /* Light red bg */
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    display: inline-block;
}

.priority-med {
    color: #e65100;
    /* Darker orange for better contrast */
    font-weight: 700;
    background: rgba(255, 152, 0, 0.1);
    /* Light orange bg */
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    display: inline-block;
}

.priority-skill {
    color: #0277bd;
    font-weight: 700;
    background: rgba(3, 169, 244, 0.1);
    /* Light blue bg */
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    display: inline-block;
}

/* Responsive Tables (Scroll horizontally on mobile) */
@media (max-width: 768px) {
    .topic-content-wrapper {
        overflow-x: hidden;
        /* Prevent page sway */
    }

    .data-table,
    .dbq-data-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        /* Enable horizontal scroll */
        white-space: nowrap;
        /* Prevent awkward wrapping */
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll on iOS */
    }

    /* Allow text to wrap in the "Insider Tip" column specifically */
    .data-table td:last-child {
        white-space: normal;
        min-width: 200px;
    }
}

/* =====================================================
   PRINT STYLES (For students printing guides)
   ===================================================== */
@media print {

    .sticky-topic-header,
    .topic-nav,
    .reveal-answer-btn {
        display: none !important;
    }

    .topic-content-wrapper {
        box-shadow: none;
        padding: 0;
        margin: 0;
    }

    body {
        background: #fff;
        color: #000;
        padding: 0;
    }

    /* Force expand answers when printing */
    .model-answer-content {
        max-height: none !important;
        opacity: 1 !important;
        display: block !important;
    }
}


/* =====================================================
   FLASHCARD APP
   ===================================================== */
.flashcard-section {
    margin: 3rem 0;
    text-align: center;
}

.flashcard-container {
    perspective: 1000px;
    width: 100%;
    max-width: 600px;
    height: 350px;
    margin: 0 auto 2rem;
    cursor: pointer;
}

.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-inner {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    line-height: 1.6;
    user-select: none;
}

.flashcard-front {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #004587;
    border: 2px solid #e9ecef;
    font-weight: 600;
}

.flashcard-back {
    background: linear-gradient(135deg, #004587 0%, #003366 100%);
    color: #fff;
    transform: rotateY(180deg);
    font-weight: 400;
}

.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.control-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.control-btn:active {
    transform: translateY(0);
}

.btn-not-yet {
    background: #fff;
    color: #dc3545;
    border: 2px solid #dc3545;
}

.btn-not-yet:hover {
    background: #dc3545;
    color: white;
}

.btn-got-it {
    background: #28a745;
    color: white;
    border: 2px solid #28a745;
}

.btn-got-it:hover {
    background: #218838;
    border-color: #218838;
}

.flashcard-progress {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}


/* =====================================================
   ACCORDION SECTIONS
   ===================================================== */
.topic-accordion-card {
    background: #fff;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.topic-accordion-card:hover {
    box-shadow: 0 8px 12px rgba(0, 69, 135, 0.15);
}

.accordion-header {
    background: linear-gradient(135deg, #004587 0%, #003366 100%);
    padding: 1.25rem 2rem;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.2s ease;
    border-left: 5px solid #fbba07;
}

.accordion-header:hover {
    background: linear-gradient(135deg, #0056a3 0%, #004080 100%);
}

/* Gradient Steps for Topic Accordions (Dark to Light Blue) */
/* Base: #004587 */

div.topic-accordion-card:nth-of-type(1)>.accordion-header {
    background: linear-gradient(135deg, #004587 0%, #003366 100%);
}

div.topic-accordion-card:nth-of-type(2)>.accordion-header {
    background: linear-gradient(135deg, #084c8f 0%, #053b70 100%);
}

div.topic-accordion-card:nth-of-type(3)>.accordion-header {
    background: linear-gradient(135deg, #105497 0%, #0a427a 100%);
}

div.topic-accordion-card:nth-of-type(4)>.accordion-header {
    background: linear-gradient(135deg, #185b9f 0%, #104a85 100%);
}

div.topic-accordion-card:nth-of-type(5)>.accordion-header {
    background: linear-gradient(135deg, #2063a7 0%, #15518f 100%);
}

div.topic-accordion-card:nth-of-type(6)>.accordion-header {
    background: linear-gradient(135deg, #296baf 0%, #1a5999 100%);
}

div.topic-accordion-card:nth-of-type(7)>.accordion-header {
    background: linear-gradient(135deg, #3172b7 0%, #2060a3 100%);
}

div.topic-accordion-card:nth-of-type(8)>.accordion-header {
    background: linear-gradient(135deg, #397abf 0%, #2568ad 100%);
}

div.topic-accordion-card:nth-of-type(9)>.accordion-header {
    background: linear-gradient(135deg, #4181c7 0%, #2a6fb8 100%);
}

div.topic-accordion-card:nth-of-type(10)>.accordion-header {
    background: linear-gradient(135deg, #4a89cf 0%, #3077c2 100%);
}

div.topic-accordion-card:nth-of-type(11)>.accordion-header {
    background: linear-gradient(135deg, #5290d7 0%, #357ecc 100%);
}

div.topic-accordion-card:nth-of-type(12)>.accordion-header {
    background: linear-gradient(135deg, #5a98df 0%, #3a86d6 100%);
}

div.topic-accordion-card:nth-of-type(13)>.accordion-header {
    background: linear-gradient(135deg, #629fe7 0%, #408de0 100%);
}

div.topic-accordion-card:nth-of-type(14)>.accordion-header {
    background: linear-gradient(135deg, #6ba7ef 0%, #4595ea 100%);
}

div.topic-accordion-card:nth-of-type(15)>.accordion-header {
    background: linear-gradient(135deg, #73aff7 0%, #4b9ce4 100%);
}


.accordion-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.accordion-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    filter: brightness(0) invert(1);
    /* Make sure icon is white */
    opacity: 0.8;
}

.topic-accordion-card.active>.accordion-header .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0, 1, 0, 1);
    background: #fff;
}

.topic-accordion-card.active>.accordion-content {
    max-height: 20000px;
    /* Arbitrary large height to allow expansion */
    transition: max-height 0.5s ease-in-out;
}

.accordion-body {
    padding: 2rem;
    border-top: 1px solid #e9ecef;
}

/* Ensure existing content looks good inside accordion */
.accordion-body h2 {
    margin-top: 0;
    /* Remove top margin for the first heading inside */
    border-bottom: none;
    /* Remove duplicate border if header has it */
}

/* Hide the section badges inside the accordion since the header acts as badge */
.accordion-body .section-badge {
    display: none;
}

/* Nested Accordions (for Practice Questions etc) */
.sub-accordion-card {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.sub-accordion-card .accordion-header {
    background: #004587;
    /* Dark blue for contrast */
    color: #ffffff;
    /* White text as requested */
    padding: 1rem 1.5rem;
    border-left: 4px solid #fbba07;
    /* Match main accent */
    font-size: 0.95em;
    font-weight: 500;
}

.sub-accordion-card .accordion-header:hover {
    background: #003366;
    /* Slightly darker on hover */
}

.sub-accordion-card .accordion-icon {
    color: #ffffff;
    filter: none;
    opacity: 0.9;
    transition: transform 0.3s ease;
}

.sub-accordion-card.active>.accordion-header .accordion-icon {
    transform: rotate(180deg);
}

.sub-accordion-card.active>.accordion-content {
    max-height: 3000px;
    /* Allow expansion */
    transition: max-height 0.5s ease-in-out;
}

.sub-accordion-card .accordion-body {
    padding: 1.5rem;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* =====================================================
   SEARCH BAR & AUTOCOMPLETE
   ===================================================== */

/* Search container - flexible positioning */
.search-container {
    position: relative;
    width: 100%;
    max-width: 500px;
}

/* Search container on index page */
.index-search-container {
    margin: 2rem auto;
    max-width: 600px;
}

/* Search container in sticky header (topic pages) */
.header-search-container {
    flex: 0 0 auto;
    max-width: 350px;
    margin-left: auto;
}

/* Search input field */
.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid rgba(251, 186, 7, 0.3);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-input:focus {
    outline: none;
    border-color: #fbba07;
    box-shadow: 0 4px 12px rgba(251, 186, 7, 0.3);
    background: #fff;
}

.search-input::placeholder {
    color: #999;
    font-weight: 300;
}

/* Search icon */
.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: #666;
    pointer-events: none;
}

/* Autocomplete dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #fbba07;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1001;
    display: none;
}

/* Search result item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid #fbba07;
    padding-left: calc(1rem - 4px);
}

.search-result-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.search-result-title {
    flex: 1;
    font-weight: 500;
    color: #004587;
    font-size: 0.95rem;
}

.search-result-unit {
    background: linear-gradient(135deg, #004587 0%, #003366 100%);
    color: #fbba07;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* No results message */
.search-no-results {
    padding: 1.5rem 1rem;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Highlight effect for scrolled-to elements */
.search-highlight {
    animation: highlightPulse 2s ease-in-out;
    scroll-margin-top: 80px;
    /* Account for sticky header */
}

@keyframes highlightPulse {
    0% {
        background-color: rgba(251, 186, 7, 0.3);
    }

    50% {
        background-color: rgba(251, 186, 7, 0.5);
    }

    100% {
        background-color: transparent;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header-search-container {
        max-width: 250px;
    }

    .search-input {
        font-size: 0.9rem;
        padding: 0.625rem 0.875rem 0.625rem 2.25rem;
    }

    .search-icon {
        font-size: 1rem;
    }

    .search-result-title {
        font-size: 0.875rem;
    }

    .search-result-unit {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
}

@media (max-width: 480px) {

    /* On very small screens, make search full width on sticky header */
    .sticky-topic-header {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem 1rem;
    }

    .header-search-container {
        max-width: 100%;
        width: 100%;
        margin-top: 0.5rem;
        order: 3;
    }

    .index-search-container {
        max-width: 100%;
    }
}