/* ========================================
   GLOBAL RESET & BASE STYLES
   ======================================== */

/* Universal Reset: Removes default browser margins and padding */
/* box-sizing: border-box ensures padding is included in element width */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========================================
   CSS VARIABLES (CUSTOM PROPERTIES)
   ======================================== */
/* These variables allow easy theme switching */
/* :root selector makes variables globally available */
/* Light Mode (Default Theme) */
:root {
    --primary-color: #2c3e50;          /* Main dark blue-gray for headers/sidebar */
    --secondary-color: #3498db;        /* Bright blue for buttons and accents */
    --accent-color: #e74c3c;          /* Red for warnings/important items */
    --success-color: #27ae60;         /* Green for success states */
    --background-color: #f8f9fa;      /* Light gray page background */
    --card-background: #ffffff;       /* White for content cards */
    --text-color: #333;               /* Dark gray for main text */
    --text-light: #666;               /* Medium gray for secondary text */
    --border-color: #e0e0e0;         /* Light gray for borders */
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);         /* Subtle shadow for cards */
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.15);  /* Stronger shadow on hover */
}

/* ========================================
   DARK MODE THEME
   ======================================== */
/* Activated when body has 'dark-mode' class */
/* JavaScript adds this class when user clicks theme toggle */
body.dark-mode {
    --primary-color: #34495e;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --background-color: #1a1a1a;
    --card-background: #2d2d2d;
    --text-color: #e0e0e0;
    --text-light: #b0b0b0;
    --border-color: #404040;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.5);
}

/* ========================================
   READ MODE THEME
   ======================================== */
/* Activated when body has 'read-mode' class */
/* Warm, paper-like colors optimized for extended reading */
/* Reduces eye strain with sepia tones */
body.read-mode {
    --primary-color: #5c4a37;
    --secondary-color: #8b6914;
    --accent-color: #c46b2d;
    --success-color: #7a8b5f;
    --background-color: #f4f1e8;
    --card-background: #fffef7;
    --text-color: #3d3d3d;
    --text-light: #6b6b6b;
    --border-color: #d4c5b0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 5px 20px rgba(0, 0, 0, 0.12);
}

/* ========================================
   BODY BASE STYLES
   ======================================== */
/* Global typography and layout foundation */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;  /* Clean, readable font stack */
    line-height: 1.6;                    /* Comfortable reading line spacing */
    color: var(--text-color);            /* Uses CSS variable for theme-aware text */
    background-color: var(--background-color);  /* Theme-aware background */
    margin: 0;
    padding: 0;
    /* Smooth transition when theme changes */
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Read Mode - Special Paper-like Background */
/* Creates subtle horizontal lines like notebook paper */
body.read-mode {
    background-color: var(--background-color);
    background-image: 
        repeating-linear-gradient(
            0deg,                        /* Horizontal lines */
            transparent,
            transparent 2px,             /* 2px spacing */
            rgba(0, 0, 0, 0.02) 2px,    /* Very subtle line color */
            rgba(0, 0, 0, 0.02) 4px     /* 4px total pattern repeat */
        );
}

/* ========================================
   MAIN APPLICATION LAYOUT
   ======================================== */
/* Flexbox container that holds sidebar and main content side-by-side */
.app-layout {
    display: flex;           /* Flexbox for horizontal layout */
    min-height: 100vh;       /* Full viewport height minimum */
}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
/* Fixed position button in top-right corner */
/* Always visible regardless of page scroll */
.theme-toggle-container {
    position: fixed;    /* Fixed to viewport, not page */
    top: 15px;          /* 15px from top */
    right: 15px;        /* 15px from right */
    z-index: 1001;      /* Above most other elements */
}

.theme-toggle {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.theme-toggle:hover::before {
    width: 300%;
    height: 300%;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

.theme-toggle:active {
    transform: scale(0.95) rotate(0deg);
}

.theme-toggle i {
    position: relative;
    z-index: 1;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

.theme-toggle:hover i {
    transform: scale(1.2);
}

/* ========================================
   SIDEBAR TOGGLE BUTTON
   ======================================== */
/* Hamburger menu button (☰) in top-left corner */
/* Collapses/expands the sidebar */
.sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background: linear-gradient(135deg, #2980b9 0%, var(--secondary-color) 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

/* ========================================
   SIDEBAR NAVIGATION
   ======================================== */
/* Fixed left sidebar containing navigation menu */
/* Width: 250px expanded, 70px collapsed */
/* Smooth transition when collapsing/expanding */
.sidebar {
    width: 250px;
    background: linear-gradient(180deg, var(--primary-color) 0%, #34495e 100%);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: width 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

body.dark-mode .sidebar {
    background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
}

body.read-mode .sidebar {
    background: linear-gradient(180deg, #5c4a37 0%, #6b5642 100%);
}

.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .subtitle,
.sidebar.collapsed .nav-link span {
    opacity: 0;
    width: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 15px;
}

.sidebar.collapsed .nav-link i {
    margin: 0;
}

.sidebar:not(.collapsed) .sidebar-title,
.sidebar:not(.collapsed) .subtitle,
.sidebar:not(.collapsed) .nav-link span {
    opacity: 1;
    width: auto;
    transition: opacity 0.3s ease 0.1s, width 0.3s ease 0.1s;
}

.sidebar-header {
    padding: 25px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: padding 0.3s ease, background 0.3s ease;
}

body.dark-mode .sidebar-header {
    background: rgba(0, 0, 0, 0.4);
}

body.read-mode .sidebar-header {
    background: rgba(92, 74, 55, 0.3);
}

.sidebar.collapsed .sidebar-header {
    padding: 25px 15px;
}

.sidebar-header h1 {
    font-size: 1.5em;
    margin: 0 0 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.sidebar-title {
    transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar-header .subtitle {
    font-size: 0.9em;
    opacity: 0.9;
    margin: 0;
    font-weight: 300;
}

.sidebar-nav {
    padding: 10px 0;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.nav-link span {
    transition: opacity 0.2s ease, width 0.3s ease;
}

.nav-link i {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.nav-link span {
    flex: 1;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--secondary-color);
}

.nav-link.active {
    background-color: rgba(52, 152, 219, 0.2);
    color: white;
    border-left-color: var(--secondary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 20px 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Main Content Area - already handled above */

.content-section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-section h2 {
    font-size: 1.8em;
    margin-bottom: 20px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--secondary-color);
}

/* Intro Card */
.intro-card {
    background: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.intro-card h3 {
    color: var(--secondary-color);
    font-size: 1.5em;
    margin-bottom: 15px;
}

.intro-card p {
    font-size: 1.1em;
    color: var(--text-light);
    margin-bottom: 25px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #5dade2 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.stat-card i {
    font-size: 2.5em;
    margin-bottom: 15px;
}

.stat-card h4 {
    font-size: 1.3em;
    margin-bottom: 10px;
}

.stat-card p {
    font-size: 0.9em;
    opacity: 0.9;
}

/* Topic Grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.topic-card {
    background: var(--card-background);
    padding: 18px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease, background-color 0.3s ease;
    border-left: 4px solid var(--secondary-color);
}

.topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-left-color: var(--accent-color);
}

.topic-card h3 {
    color: var(--primary-color);
    font-size: 1.3em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topic-card ul {
    list-style: none;
    margin-bottom: 20px;
}

.topic-card ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-light);
}

.topic-card ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* Buttons */
.download-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.download-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, var(--secondary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
}

.download-all-btn {
    background: linear-gradient(135deg, var(--accent-color) 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: block;
    margin: 20px auto;
    box-shadow: var(--shadow);
}

.download-all-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, var(--accent-color) 100%);
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Tips Grid */
.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.tip-card {
    background: var(--card-background);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.tip-card.important {
    border: 2px solid var(--accent-color);
    background: linear-gradient(135deg, var(--background-color) 0%, var(--card-background) 100%);
}

body.dark-mode .tip-card.important {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, var(--card-background) 100%);
}

body.read-mode .tip-card.important {
    background: linear-gradient(135deg, rgba(196, 107, 45, 0.1) 0%, var(--card-background) 100%);
}

.tip-card h3 {
    color: var(--primary-color);
    font-size: 1.2em;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tip-card.important h3 {
    color: var(--accent-color);
}

.tip-card ul {
    list-style: none;
    margin-top: 15px;
}

.tip-card ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-light);
}

.tip-card ul li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
}

/* Footer */
footer {
    background: var(--primary-color);
    color: white;
    padding: 15px 30px;
    text-align: center;
    margin-top: 20px;
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

footer p {
    margin: 5px 0;
    font-size: 0.9em;
}

.disclaimer {
    font-size: 0.85em;
    opacity: 0.8;
    font-style: italic;
}

/* Section Explanations */
.section-explanation {
    background: linear-gradient(135deg, rgba(232, 244, 248, 0.5) 0%, rgba(240, 248, 255, 0.5) 100%);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--secondary-color);
    box-shadow: var(--shadow);
    transition: background 0.3s ease, background-color 0.3s ease;
    background-color: var(--card-background);
}

body.dark-mode .section-explanation {
    background: linear-gradient(135deg, rgba(45, 62, 78, 0.5) 0%, rgba(31, 41, 55, 0.5) 100%);
    background-color: var(--card-background);
}

body.read-mode .section-explanation {
    background: linear-gradient(135deg, rgba(240, 234, 214, 0.5) 0%, rgba(232, 223, 200, 0.5) 100%);
    background-color: var(--card-background);
}

.section-explanation h3 {
    color: var(--primary-color);
    font-size: 1.4em;
    margin-bottom: 15px;
}

.section-explanation p {
    color: var(--text-color);
    margin-bottom: 15px;
    font-size: 1.05em;
    line-height: 1.7;
}

.section-explanation ul {
    list-style: none;
    margin: 15px 0;
}

.section-explanation ul li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-color);
}

.section-explanation ul li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
}

/* Topic Explanations */
.topic-explanation {
    font-size: 0.95em;
    color: var(--text-light);
    margin-bottom: 12px;
    padding: 10px;
    background: var(--background-color);
    border-left: 3px solid var(--secondary-color);
    border-radius: 5px;
    line-height: 1.6;
    transition: background-color 0.3s ease;
}

.topic-explanation strong {
    color: var(--primary-color);
}

/* Button Groups */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.view-btn {
    background: linear-gradient(135deg, var(--success-color) 0%, #229954 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.view-btn:hover {
    background: linear-gradient(135deg, #229954 0%, var(--success-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
}

.download-btn {
    flex: 1;
}

/* Modal Styles */
/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
    transition: background-color 0.3s ease, backdrop-filter 0.3s ease;
}

/* Fullscreen mode - theme-adapted background */
.modal:has(.modal-content:not(.windowed-mode)) {
    background-color: var(--background-color);
    backdrop-filter: none;
}

.modal-content {
    background-color: var(--card-background);
    margin: 0;
    padding: 0;
    border-radius: 0;
    width: 100%;
    transition: background-color 0.3s ease;
    height: 100vh;
    max-width: 100%;
    max-height: 100vh;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    animation: slideDown 0.3s ease;
    transition: all 0.3s ease;
}

/* Windowed mode - smaller centered modal */
.modal-content.windowed-mode {
    width: 90%;
    max-width: 900px;
    height: 90vh;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content.windowed-mode .modal-header {
    border-radius: 10px 10px 0 0;
}

.modal-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-header {
    padding: 20px 30px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    line-height: 35px;
    text-align: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    background-color: var(--card-background);
    transition: background-color 0.3s ease;
}

.content-viewer {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.content-viewer pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    margin: 0;
}

.content-heading {
    color: var(--secondary-color);
    font-size: 1.3em;
    margin: 20px 0 10px 0;
    font-weight: bold;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 5px;
}

.content-subheading {
    color: var(--primary-color);
    font-size: 1.1em;
    margin: 15px 0 8px 0;
    font-weight: bold;
}

.content-list {
    list-style: none;
    padding-left: 0;
    margin: 10px 0;
}

.content-list li {
    padding: 6px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-color);
    line-height: 1.6;
}

.content-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

.content-text {
    margin: 10px 0;
    line-height: 1.7;
    color: var(--text-color);
}

.modal-footer {
    padding: 20px 30px;
    background: var(--background-color);
    border-top: 2px solid var(--border-color);
    border-radius: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-left {
    display: flex;
    align-items: center;
}

.footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fullscreen-toggle-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.fullscreen-toggle-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, var(--secondary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.fullscreen-toggle-btn i {
    font-size: 1.1em;
}

.modal-content.windowed-mode .modal-footer {
    border-radius: 0 0 10px 10px;
}

.close-btn-footer {
    background: var(--text-light);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.close-btn-footer:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .nav-link {
        padding: 15px 20px;
    }
    
    .topic-grid,
    .tips-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        max-height: 100vh;
    }
    
    .modal-content.windowed-mode {
        width: 95%;
        height: 85vh;
        margin: 7.5vh auto;
    }
    
    .modal-header,
    .modal-footer {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .fullscreen-toggle-btn {
        min-width: 100px;
        padding: 10px 15px;
        font-size: 0.9em;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-left,
    .footer-right {
        width: 100%;
        justify-content: center;
    }
    
    .footer-right {
        gap: 8px;
    }
    
    .fullscreen-toggle-btn,
    .close-btn-footer {
        flex: 1;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .close-btn-footer {
        width: 100%;
    }
}

/* Download Animation */
@keyframes downloadPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.downloading {
    animation: downloadPulse 0.5s ease;
}

