@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Colors based on user's new CSS and combined with previous needs */
    --primary-green: #4CAF50; /* Main green for active states, buttons, etc. */
    --primary-green-light: #e8f5e9; /* Light green for hover backgrounds */
    --text-dark: #333333;
    --text-medium: #6b7280; /* For descriptions, subtle text */
    --text-light: #9CA3AF; /* Placeholder text */
    --bg-light: #f3f4f6; /* Light background for search, user profile */

    /* Glassmorphism specific values */
    --glass-bg-color: rgba(255,255,255,0.2);
    --glass-card-bg-color: rgba(255,255,255,0.6);
    --glass-card-hover-bg-color: rgba(76,175,80,0.08); /* New hover state for glass cards */
    --glass-border-color: rgba(255,255,255,0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --glass-card-shadow-hover: 0 8px 24px rgba(76,175,80,0.18);

    /* Level Tags (from Practice Hub) */
    --level-intermediate-bg: #FDC00A; /* Yellowish */
    --level-intermediate-text: #664E01; /* Darker text for contrast */
    --level-beginner-bg: #E8F9ED; /* Light Green */
    --level-beginner-text: #4CAF50; /* Green text */
    --level-advanced-bg: #FEF2F2; /* Light Red */
    --level-advanced-text: #DC3545; /* Red text */

    /* Dashboard Stat Card Colors (adjusted for new theme) */
    --stat-card-problems-bg: rgba(0, 123, 255, 0.1); /* Lighter blue */
    --stat-card-accuracy-bg: rgba(76, 175, 80, 0.1); /* Lighter green */
    --stat-card-streak-bg: rgba(253, 192, 10, 0.1); /* Lighter yellow */
    --stat-card-time-bg: rgba(127, 82, 255, 0.1); /* Lighter purple */
    --stat-card-problems-icon: #007BFF; /* Original blue */
    --stat-card-accuracy-icon: #4CAF50; /* Original green */
    --stat-card-streak-icon: #FDC00A; /* Original yellow */
    --stat-card-time-icon: #7F52FF; /* Original purple */

    /* Progress Bar (Daily Goal and Dashboard Learning Progress) */
    --progress-bar-fill-gradient: linear-gradient(90deg, #4CAF50 60%, #81c784 100%);
    --progress-bar-bg-color: #e0e7ff;
}

/* Base Styles */
html, body {
    height: 100%; /* Ensure html and body take full viewport height */
    margin: 0;
    padding: 0;
    overflow: hidden; /* Prevent body scroll, app-container will handle scroll */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #e0e7ff 0%, #f0fff4 100%); /* User's background */
    font-family: 'Poppins', sans-serif;
    color: var(--text-dark);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    font-size: 15px; /* Default font size */
}

/* Auth (Login/Signup) Page */
.auth-page .app-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-page .login-container {
    width: 100%;
    max-width: 460px;
    background: var(--glass-card-bg-color);
    border: 1px solid var(--glass-border-color);
    border-radius: 24px;
    box-shadow: var(--glass-shadow);
    padding: 28px 28px 24px 28px;
}
.auth-page .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.auth-page .logo-img {
    width: 40px;
    height: 40px;
}
.auth-page .logo-text h1 { font-size: 22px; line-height: 1; }
.auth-page .logo-text p { font-size: 12px; color: var(--text-medium); }

.auth-page form { margin-top: 8px; }
.auth-page form h2 { font-size: 22px; margin-bottom: 12px; }
.auth-page .input-group { margin-bottom: 12px; }
.auth-page .input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-medium);
    margin-bottom: 6px;
}
.auth-page .input-group input,
.auth-page .input-group select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--glass-border-color);
    background: rgba(255,255,255,0.7);
    outline: none;
    font-size: 15px;
    color: var(--text-dark);
}
.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-medium);
    padding: 4px;
    border-radius: 6px;
}
.password-toggle:hover { background: rgba(0,0,0,0.05); }
.password-toggle .material-icons { font-size: 20px; line-height: 1; }
.auth-page .input-group input:focus,
.auth-page .input-group select:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}
.auth-page .btn {
    width: 100%;
    padding: 12px 18px;
    background: var(--primary-green);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(76,175,80,0.25);
    transition: transform 0.1s ease, background-color 0.2s ease;
}
.auth-page .btn:hover { background-color: #388E3C; transform: translateY(-1px); }
.auth-page .btn:active { transform: translateY(0); }
.auth-page .toggle-form { margin-top: 10px; font-size: 14px; text-align: center; }
.auth-page .toggle-form a { color: var(--primary-green); text-decoration: none; font-weight: 600; }


.app-container {
    display: flex;
    min-height: 100vh; /* Ensure app-container stretches to full height */
    gap: 32px;
    padding: 32px;
    width: 100%; /* Ensure it takes full width */
    overflow: hidden; /* Prevent app-container from causing outer scroll */
}

/* Glassmorphism Base Classes */
.glass-bg {
    background: var(--glass-bg-color);
    backdrop-filter: blur(12px);
}

.glass-card {
    background: var(--glass-card-bg-color);
    border-radius: 24px; /* User's radius */
    box-shadow: var(--glass-shadow);
    padding: 24px; /* Default padding for cards */
    border: 1px solid var(--glass-border-color);
}

/* Sidebar */
.sidebar {
    width: 260px; /* User's width */
    display: flex;
    flex-direction: column;
    gap: 24px; /* User's gap */
    flex-shrink: 0;
    /* Ensure sidebar also takes full height */
    height: calc(100vh - 64px); /* Full viewport height minus app-container top/bottom padding */
    overflow-y: auto; /* Enable scroll if content overflows */
    box-shadow: var(--glass-shadow); /* Applied to sidebar as a whole */
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px; /* User's margin */
}

.sidebar .logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.sidebar .logo-text h1 {
    font-size: 1.5rem; /* User's size */
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.sidebar .logo-text p {
    font-size: 0.9rem; /* User's size */
    color: var(--text-medium);
    margin: 0;
}

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

.nav-menu ul li {
    margin-bottom: 8px; /* Tighter spacing for list items */
}

.nav-menu .nav-item {
    display: flex;
    align-items: center;
    gap: 12px; /* User's gap */
    padding: 12px 18px; /* User's padding */
    border-radius: 12px; /* User's radius */
    text-decoration: none;
    color: #374151; /* User's text color */
    font-weight: 500;
    transition: background 0.2s, color 0.2s; /* User's transition */
    font-size: 15px;
}

.nav-menu .nav-item.active,
.nav-menu .nav-item:hover {
    background: var(--primary-green);
    color: #fff;
    /* Removed explicit box-shadow for active state as glass-card handles it */
}

.nav-menu .nav-item .material-icons {
    font-size: 22px; /* Consistent icon size */
    color: inherit; /* Inherit color from parent for hover effect */
    transition: color 0.2s ease;
}

/* Mobile-only labels under icons */
@media (max-width: 768px) {
    .nav-menu .nav-item { flex-direction: column; gap: 4px; align-items: center; }
    .nav-menu .nav-item::after {
        content: attr(data-label);
        display: block;
        font-family: 'Poppins', sans-serif !important;
        font-size: 10px;
        line-height: 1.1;
        color: currentColor;
        margin-top: 2px;
        white-space: nowrap;
    }
    /* Hide the inline text on mobile to avoid duplication */
    .nav-menu .nav-item > span:last-child { display: none; }
}

/* Daily Goal */
.daily-goal {
    margin-top: auto;
    /* User's styles */
    background: rgba(76, 175, 80, 0.08);
    border-radius: 16px;
    padding: 18px;
    text-align: center; /* center align title and progress by default */
    /* Inherits glass-card properties too but these are more specific */
}

.daily-goal h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}

.daily-goal p {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 12px;
}
/* Separate lines inside daily-goal for clarity */
.daily-goal .dg-line { display:block; }
.daily-goal .dg-line + .dg-line { margin-top: 4px; }

.progress-bar-container {
    width: 100%;
    background-color: var(--progress-bar-bg-color); /* User's background */
    border-radius: 8px; /* User's radius */
    height: 10px; /* User's height */
    overflow: hidden;
    margin-top: 8px; /* User's margin */
}

.progress-bar {
    height: 100%;
    background: var(--progress-bar-fill-gradient); /* User's gradient */
    border-radius: 8px;
    transition: width 0.4s; /* User's transition */
}

.daily-goal .logout-btn {
    margin-top: 14px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--glass-border-color);
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
}

/* Main Content */
.main-content {
    flex: 1; /* User's flex property */
    display: flex;
    flex-direction: column;
    gap: 24px; /* User's gap */
    /* Inherits glass-card properties */
    height: calc(100vh - 64px); /* Full viewport height minus app-container top/bottom padding */
    overflow-y: auto; /* Enable scrolling for main content if it overflows */
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Removed margin-bottom here, content sections will handle their own top margin/padding */
    /* Topbar should also be a glass card for consistency */
    background: var(--glass-card-bg-color); /* Apply directly or use glass-card class in HTML */
    border-radius: 24px; /* Consistent with other glass cards */
    box-shadow: var(--glass-shadow); /* Consistent with other glass cards */
    padding: 18px 24px; /* Adjusted padding for topbar */
    border: 1px solid var(--glass-border-color);
    flex-shrink: 0; /* Prevent topbar from shrinking */
}

/* Mobile topbar and drawer (ensure hamburger is on TOP on small/medium screens) */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 8px;
    padding: 10px 12px;
    background: var(--glass-card-bg-color);
    border-radius: 16px;
    border: 1px solid var(--glass-border-color);
    box-shadow: var(--glass-shadow);
    position: sticky;
    top: 0;
    z-index: 1001;
}
.mobile-topbar .brand-name { font-weight: 700; margin-left: 8px; }
.mobile-topbar .hamburger-btn { background: transparent; border: 1px solid rgba(0,0,0,0.08); border-radius: 10px; padding: 6px 8px; cursor: pointer; }
.mobile-topbar .material-icons { font-size: 22px; }
.mobile-topbar .mobile-brand { display: flex; align-items: center; gap: 8px; }

.mobile-drawer-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 9998; }
.mobile-drawer { display: none; position: fixed; top: 0; left: 0; height: 100vh; width: 78%; max-width: 320px; background: var(--glass-card-bg-color); backdrop-filter: blur(16px); border-right: 1px solid var(--glass-border-color); box-shadow: var(--glass-shadow); z-index: 9999; transform: translateX(-100%); transition: transform 0.25s ease; padding: 14px; }
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mobile-drawer-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mobile-drawer-list a { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 10px; color: var(--text-dark); text-decoration: none; }
.mobile-drawer-list a:hover { background: rgba(76,175,80,0.08); }
.mobile-drawer-list a.active { background: rgba(76,175,80,0.12); }

/* Prevent background scroll when drawer is open */
body.drawer-open { overflow: hidden; }

/* Hide any stray hamburger buttons outside the topbar by default */
#mobile-menu-btn { display: none; }
.app-container #mobile-menu-btn { display: none; }

/* Keep layout simple at <=1200px without introducing a hamburger */
@media (max-width: 1200px) {
    .mobile-topbar { display: none; }
    .mobile-drawer { display: none; }
    .mobile-drawer-overlay.show { display: none; }
    .app-container { padding: 12px; gap: 16px; }
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-light); /* User's background */
    border-radius: 12px; /* User's radius */
    padding: 8px 16px; /* User's padding */
    gap: 8px; /* User's gap */
    box-shadow: 0 2px 8px rgba(76,175,80,0.05); /* User's shadow */
}

.search-bar .material-icons {
    color: var(--text-medium);
    font-size: 20px;
}

.search-bar input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 1rem; /* User's size */
    width: 220px; /* User's width */
    color: var(--text-dark);
}

.search-bar input::placeholder {
    color: var(--text-light);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 18px; /* User's gap */
}

.icon-button {
    background: var(--progress-bar-bg-color); /* User's background */
    border: none;
    border-radius: 50%;
    padding: 8px; /* User's padding */
    cursor: pointer;
    transition: background 0.2s, color 0.2s; /* User's transition */
    display: flex; /* For icon centering */
    align-items: center;
    justify-content: center;
}

.icon-button:hover {
    background: var(--primary-green); /* User's hover background */
    color: #fff;
}

.user-actions .material-icons {
    font-size: 24px;
    color: var(--text-medium); /* Default icon color */
}

.icon-button:hover .material-icons {
    color: #fff; /* Icon color on hover */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px; /* User's gap */
    background: var(--bg-light); /* User's background */
    border-radius: 16px; /* User's radius */
    padding: 6px 14px; /* User's padding */
    box-shadow: 0 2px 8px rgba(76,175,80,0.05); /* User's shadow */
}

.user-profile .avatar {
    border-radius: 50%;
    border: 2px solid var(--primary-green); /* User's border color */
    width: 36px; /* User's width */
    height: 36px; /* User's height */
    object-fit: cover;
}

.user-info p {
    margin: 0;
    font-weight: 600;
    font-size: 15px; /* Consistent font size */
    color: var(--text-dark);
}

.user-info span {
    font-size: 0.85rem; /* User's size */
    color: var(--text-medium);
}

.grade-pill {
    background: var(--primary-green); /* User's background */
    color: #fff;
    border-radius: 12px; /* User's radius */
    padding: 2px 10px; /* User's padding */
    font-size: 0.9rem; /* User's size */
    font-weight: 600;
    margin-left: 8px; /* User's margin */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dashboard Specific Styles (Integrated with Glassmorphism) */
.dashboard-overview {
    flex-grow: 1; /* Allow dashboard content to fill remaining vertical space */
    display: flex;
    flex-direction: column;
    /* Ensure content within dashboard-overview has space */
    padding-top: 0; /* Already handled by main-content padding */
    padding-bottom: 0; /* Already handled by main-content padding */
}

.welcome-heading, .section-heading { /* Combined heading for consistency */
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-message, .section-description { /* Combined description for consistency */
    color: var(--text-medium);
    font-size: 15px;
    margin-bottom: 30px;
}

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px; /* Consistent with modern-grid gap */
    margin-bottom: 30px;
}

.stat-card {
    /* Now uses glass-card */
    display: flex;
    flex-direction: row; /* enable side-by-side icon + body default */
    justify-content: flex-start;
    align-items: center;
    padding: 16px 18px; /* Slightly tighter padding for compact look */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--glass-card-shadow-hover); /* Use glass shadow for hover */
    background: var(--glass-card-hover-bg-color); /* Use glass hover background */
}

.stat-card-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
}

.stat-card-icon .material-icons {
    font-size: 26px;
    color: white; /* Icons in stat cards are white as per original image */
}

.stat-card-body { display:flex; flex-direction: column; justify-content:center; align-items:center; text-align:center; }
.stat-text { display: inline-flex; align-items: baseline; gap: 10px; }
.stat-text .value { font-size: 24px; font-weight: 700; color: var(--text-dark); }
.stat-text .label { font-size: 14px; color: var(--text-medium); }
.stat-card h4 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.stat-card p {
    font-size: 14px;
    color: var(--text-medium);
}

/* Specific Stat Card Colors (backgrounds are rgba to show glass effect) */
.stat-card.problems { background-color: var(--stat-card-problems-bg); }
.stat-card.problems .stat-card-icon { background-color: var(--stat-card-problems-icon); }
.stat-card.accuracy { background-color: var(--stat-card-accuracy-bg); }
.stat-card.accuracy .stat-card-icon { background-color: var(--stat-card-accuracy-icon); }
.stat-card.streak { background-color: var(--stat-card-streak-bg); }
.stat-card.streak .stat-card-icon { background-color: var(--stat-card-streak-icon); }
.stat-card.time { background-color: var(--stat-card-time-bg); }
.stat-card.time .stat-card-icon { background-color: var(--stat-card-time-icon); }

/* Trend Indicator */
.stat-card-trend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--primary-green); /* Green for up trend */
    margin-top: 10px;
}
.stat-card-trend .material-icons {
    font-size: 16px;
    color: var(--primary-green);
}
.stat-card-trend.down {
    color: #DC3545; /* Red for down trend */
}
.stat-card-trend.down .material-icons {
    color: #DC3545;
}


/* Bottom Sections Grid (Learning Progress, AI Recommendations, Quick Actions) */
.bottom-sections-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr; /* Learning Progress wider, right column narrower */
    gap: 24px; /* Consistent gap */
    align-items: start;
    flex-grow: 1; /* Allow this grid to grow and fill remaining vertical space */
    min-height: 0; /* Allow flex item to shrink if necessary */
}

.bottom-sections-grid .glass-card h3,
.analytics-insights-grid .glass-card h3, /* Added for analytics */
.profile-settings-grid .glass-card h3 { /* Added for profile */
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-dark);
}

/* Learning Progress */
.learning-progress-section {
    /* Now uses glass-card */
    padding: 24px; /* Consistent padding */
    display: flex; /* Make it a flex container to manage its children */
    flex-direction: column;
    flex-grow: 1; /* Allow it to fill vertical space */
    min-height: 0; /* Allow flex item to shrink */
}
.progress-items {
    flex-grow: 1; /* Allow progress items container to grow */
    overflow-y: auto; /* Add scroll if too many items */
}

.progress-item {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--progress-bar-bg-color);
}
.progress-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.progress-item-header {
    display: flex;
    flex-direction: column; /* topic on first line; subline on next */
    gap: 4px;
    margin-bottom: 8px;
}

.progress-item-header p.topic-name {
    font-weight: 500;
    font-size: 15px;
    color: var(--text-dark);
}

.progress-item-subline {
    display:flex;
    justify-content: space-between; /* difficulty left, solved right */
    align-items:center;
    width:100%;
}
.progress-item-subline .level-tag { background: var(--primary-blue-600); color:#fff; border-radius:10px; padding:2px 8px; font-size:12px; }
.progress-item-subline .solved-count { font-size: 14px; color: var(--text-medium); }

.progress-line-container {
    width: 100%;
    background-color: var(--progress-bar-bg-color);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-line {
    height: 100%;
    background: var(--progress-bar-fill-gradient); /* Consistent with daily goal */
    border-radius: 10px;
    transition: width 0.8s ease-out;
}

/* Right Column Sections (AI Recommendations, Quick Actions) */
.right-column-sections {
    display: flex;
    flex-direction: column;
    gap: 24px; /* Consistent gap */
    flex-grow: 1; /* Allow this column to grow */
    min-height: 0; /* Allow flex item to shrink */
}

/* AI Recommendations */
.ai-recommendations-section {
    /* Now uses glass-card */
    padding: 24px; /* Consistent padding */
    flex-grow: 1; /* Allow this section to grow */
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.recommendations-list {
    flex-grow: 1; /* Allow the list itself to grow */
    overflow-y: auto; /* Add scroll if too many items */
}
.recommendations-list ul {
    list-style: none;
    padding: 0;
}

.recommendations-list li {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recommendations-list li:last-child {
    margin-bottom: 0;
}

.recommendations-list li .mastery-text {
    font-size: 14px;
    color: var(--text-medium);
    margin-left: 10px;
    flex-shrink: 0;
}

/* Quick Actions */
.quick-actions-section {
    /* Now uses glass-card */
    padding: 24px; /* Consistent padding */
    flex-shrink: 0; /* Prevent this section from shrinking too much */
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.action-btn, .start-practice-btn, .save-changes-btn { /* Combined styles for consistency, added save changes */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 12px 20px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3); /* Green shadow */
}
    .action-btn:disabled, .start-practice-btn:disabled, .save-changes-btn:disabled {
        background-color: #e0e0e0 !important;
        color: #9e9e9e !important;
        cursor: not-allowed !important;
        box-shadow: none !important;
        opacity: 0.8;
    }
    .action-btn.secondary:disabled {
        background-color: #f1f1f1 !important;
        color: #9e9e9e !important;
        border-color: #d0d0d0 !important;
    }

.action-btn:hover, .start-practice-btn:hover, .save-changes-btn:hover {
    background-color: #388E3C; /* Darker green on hover */
    transform: translateY(-1px);
}

.action-btn:active, .start-practice-btn:active, .save-changes-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.action-btn.secondary { /* For 'View Progress', 'View Analytics' */
    background: rgba(76, 175, 80, 0.08); /* Light green background */
    color: var(--primary-green);
    border: 1px solid rgba(76, 175, 80, 0.2); /* Subtle green border */
    box-shadow: none;
}

.action-btn.secondary:hover {
    background: rgba(76, 175, 80, 0.15); /* Slightly darker light green on hover */
    color: var(--primary-green);
}

.action-btn.secondary:active {
    box-shadow: none;
}

.action-btn .material-icons, .start-practice-btn .material-icons, .save-changes-btn .material-icons {
    color: white;
    font-size: 20px;
    transition: transform 0.2s ease;
}

.action-btn.secondary .material-icons {
    color: var(--primary-green);
}

.action-btn:hover .material-icons, .start-practice-btn:hover .material-icons {
    transform: translateX(3px);
}

/* Level Tags for Practice Hub (re-included as they were lost in prev user CSS) */
.level-tag {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    line-height: 1;
}
.level-tag.intermediate {
    background-color: var(--level-intermediate-bg);
    color: var(--level-intermediate-text);
}
.level-tag.beginner {
    background-color: var(--level-beginner-bg);
    color: var(--level-beginner-text);
}
.level-tag.advanced {
    background-color: var(--level-advanced-bg);
    color: var(--level-advanced-text);
}

/* Mastery Info for Practice Hub cards (re-included) */
.mastery-info {
    margin-top: 18px;
    margin-bottom: 15px;
}
.mastery-info p {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 8px;
}
.mastery-progress-bar-container {
    width: 100%;
    background-color: var(--progress-bar-bg-color);
    border-radius: 10px;
    height: 7px;
    overflow: hidden;
}
.mastery-progress-bar {
    height: 100%;
    background: var(--progress-bar-fill-gradient); /* Green gradient */
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
}
.topic-details p {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 8px;
}
.topic-details p:last-of-type {
    margin-bottom: 0;
}
.topic-details p .material-icons {
    font-size: 18px;
    color: var(--text-medium);
}


/* Practice Hub Specific Styles */
.practice-hub {
    flex-grow: 1; /* Allow practice hub content to fill remaining vertical space */
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-bottom: 0;
}
.subject-section {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Allow the section to shrink */
}
.topic-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); /* Adjusted for better card distribution */
    gap: 24px;
    flex-grow: 1; /* Allow the grid to grow vertically */
    overflow-y: auto; /* Enable scroll if content overflows */
    min-height: 0; /* Important for flex children with overflow */
    margin-top: 20px; /* Space from subject header */
}
.topic-card {
    display: flex;
    flex-direction: column;
    /* Removed fixed height, let content define height or flex grow */
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.topic-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--glass-card-shadow-hover);
    background: var(--glass-card-hover-bg-color);
}
.topic-icon {
    font-size: 32px;
    margin-bottom: 15px;
    color: var(--primary-green);
}
.topic-card h4 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}
.topic-difficulty { margin: 6px 0 10px; }
.topic-card p {
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 15px;
    flex-grow: 1; /* Allow description to push down other content */
}
.topic-card-header {
    display: flex;
    justify-content: flex-end; /* Push level tag to the right */
    margin-bottom: 10px; /* Space between level tag and topic title */
}
/* Re-use .start-practice-btn */

/* Progress Page Specific Styles */
.progress-summary {
    flex-grow: 1; /* Allow progress summary to fill remaining vertical space */
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-bottom: 0;
}

.progress-summary h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.progress-summary .section-description {
    margin-bottom: 30px;
}

.progress-content-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr; /* Similar layout to dashboard bottom sections */
    gap: 24px;
    align-items: start;
    flex-grow: 1; /* Allow this grid to grow and fill vertical space */
    min-height: 0; /* Allow flex item to shrink if necessary */
}

.topic-mastery-section {
    /* Inherits glass-card */
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow it to fill vertical space */
    min-height: 0;
}
.topic-mastery-list {
    list-style: none;
    padding: 0;
    flex-grow: 1; /* Allow the list itself to grow */
    overflow-y: auto; /* Add scroll if too many items */
}

.topic-mastery-item {
    margin-bottom: 20px;
}

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

.topic-mastery-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8px;
}

.topic-mastery-item-header .topic-name {
    font-weight: 500;
    font-size: 16px;
    color: var(--text-dark);
}

.topic-mastery-item-header .mastery-percentage {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary-green);
}

.topic-mastery-item-details {
    font-size: 13px;
    color: var(--text-medium);
    margin-bottom: 8px;
}

/* Re-use progress-line-container and progress-line from dashboard */


.achievements-section {
    /* Inherits glass-card */
    padding: 24px;
    flex-shrink: 0; /* Prevent from shrinking too much if topic mastery grows */
}

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

.achievement-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.achievement-item:last-child {
    margin-bottom: 0;
}

.achievement-icon-container {
    width: 45px;
    height: 45px;
    min-width: 45px; /* Prevent shrinking */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-green-light); /* Light green for achievement icons */
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
}

.achievement-icon-container .material-icons {
    font-size: 26px;
    color: var(--primary-green);
}

.achievement-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.achievement-content p {
    font-size: 14px;
    color: var(--text-medium);
}

/* New: Analytics Page Specific Styles */
.analytics-overview {
    flex-grow: 1; /* Allow analytics overview to fill remaining vertical space */
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-bottom: 0;
}

.analytics-insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); /* Adjusted for fewer, wider cards */
    gap: 24px;
    margin-top: 30px; /* Space from heading */
    flex-grow: 1; /* Allow this grid to grow */
    min-height: 0;
    align-items: start; /* Align cards to the top of their grid cells */
}

.performance-overview-card,
.learning-insights-card {
    /* Inherits glass-card */
    padding: 24px;
    flex-grow: 1; /* Allow these cards to grow and fill vertical space */
    display: flex; /* Make cards flex containers to control their content */
    flex-direction: column;
    min-height: 0; /* Allow card to shrink if necessary */
}
.performance-overview-card ul,
.learning-insights-card ul {
    list-style: none;
    padding: 0;
    flex-grow: 1; /* Allow lists within cards to grow */
    overflow-y: auto; /* Add scroll if too many items */
}

.performance-overview-card li,
.learning-insights-card li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    margin-bottom: 15px;
}

.performance-overview-card li:last-child,
.learning-insights-card li:last-child {
    margin-bottom: 0;
}

.performance-overview-card li span:first-child,
.learning-insights-card li span:first-child {
    font-weight: 500;
    color: var(--text-dark);
}

.performance-overview-card li span:last-child,
.learning-insights-card li span:last-child {
    font-weight: 600;
    color: var(--primary-green); /* Use green for key metrics */
}

/* New: Profile Page Specific Styles */
.profile-settings {
    flex-grow: 1; /* Allow profile settings to fill remaining vertical space */
    display: flex;
    flex-direction: column;
    padding-top: 0;
    padding-bottom: 0;
}

.profile-settings-grid {
    display: grid;
    grid-template-columns: 2fr 1.2fr; /* Similar to dashboard/progress layout */
    gap: 24px;
    margin-top: 30px;
    align-items: start;
    flex-grow: 1; /* Allow this grid to grow */
    min-height: 0;
}

.personal-info-card {
    /* Inherits glass-card */
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex-grow: 1; /* Allow personal info card to grow */
    min-height: 0;
}

.profile-input-group {
    margin-bottom: 0; /* Removed margin-bottom because of gap on parent */
}

.profile-input-group label {
    display: block;
    font-size: 14px;
    color: var(--text-medium);
    margin-bottom: 6px;
    font-weight: 500;
}

.profile-input-group input[type="text"],
.profile-input-group input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--glass-border-color); /* Subtle glass border */
    background: rgba(255, 255, 255, 0.4); /* Slightly opaque for input fields */
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.profile-input-group input[type="text"]:focus,
.profile-input-group input[type="email"]:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Save Changes button reuses .save-changes-btn from common actions */
.save-changes-btn {
    margin-top: auto; /* Push button to the bottom within the card */
    width: auto; /* Allow button to size itself */
    align-self: flex-start; /* Align to start within flex column */
    padding-left: 25px; /* Adjust padding for text only button */
    padding-right: 25px;
    justify-content: center; /* Center text */
}

.preferences-card,
.notifications-card {
    /* Inherits glass-card */
    padding: 24px;
    flex-grow: 1; /* Allow preferences and notifications cards to grow */
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.preferences-card ul,
.notifications-card ul {
    list-style: none;
    padding: 0;
    flex-grow: 1; /* Allow lists within cards to grow */
    overflow-y: auto; /* Add scroll if too many items */
}

.preferences-card li,
.notifications-card li {
    font-size: 15px;
    color: var(--text-dark);
    margin-bottom: 12px;
}
.preferences-card li:last-child,
.notifications-card li:last-child {
    margin-bottom: 0;
}


/* Responsive adjustments (Common for both pages) */
/* Compact desktop for common laptop resolutions (reduce perceived zoom/density) */
@media (min-width: 992px) and (max-width: 1368px) {
    html, body { font-size: 14px; }
    .app-container { padding: 24px; gap: 24px; }
    .sidebar { width: 220px; }
    .nav-menu .nav-item { font-size: 14px; padding: 10px 14px; }
    .topbar { padding: 14px 20px; }
    .search-bar { padding: 6px 12px; }
    .search-bar input { font-size: 0.95rem; }
}
@media (max-width: 1200px) {
    .sidebar {
        width: 220px;
        padding: 20px 15px;
        height: calc(100vh - 40px); /* Adjust height for smaller padding */
    }
    .sidebar .logo {
        margin-bottom: 30px;
        gap: 10px;
    }
    .sidebar .logo-img { width: 32px; height: 32px; }
    .sidebar .logo-text h1 {
        font-size: 20px;
    }
    .sidebar .logo-text p {
        font-size: 12px;
    }
    .nav-menu .nav-item {
        padding: 10px 15px;
        font-size: 14px;
        gap: 12px;
    }
    .main-content {
        padding: 20px 25px;
        height: calc(100vh - 40px); /* Adjust height for smaller padding */
    }
    .topbar {
        padding: 12px 20px;
    }
    .search-bar {
        width: 300px; /* Adjusted width */
    }
    .search-bar input {
        width: 200px;
    }
    .user-profile .avatar {
        width: 32px;
        height: 32px;
    }
    .user-info p {
        font-size: 14px;
    }
    .user-info span {
        font-size: 12px;
    }
    .welcome-heading, .section-heading { /* Combined heading for consistency */
        font-size: 26px;
    }
    .welcome-message, .section-description { /* Combined description for consistency */
        font-size: 14px;
    }
    .bottom-sections-grid .glass-card h3,
    .analytics-insights-grid .glass-card h3,
    .profile-settings-grid .glass-card h3 {
        font-size: 19px;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
    }
    .stat-card h4 {
        font-size: 22px;
    }
    .bottom-sections-grid,
    .progress-content-grid,
    .analytics-insights-grid, /* Added analytics grid */
    .profile-settings-grid { /* Added profile grid */
        grid-template-columns: 1.8fr 1fr;
        gap: 20px;
    }
    .topic-cards-grid { /* For practice hub */
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 18px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        width: 70px; /* Collapsed sidebar */
        align-items: center;
        padding: 20px 0;
        height: calc(100vh - 40px); /* Maintain height */
    }
    .sidebar .logo-text,
    .nav-menu span:not(.material-icons),
    .daily-goal h3,
    .daily-goal p {
        display: none; /* Hide text */
    }
    .sidebar .logo {
        justify-content: center;
        margin-bottom: 20px;
        padding-left: 0;
    }
    .sidebar .logo-img { width: 36px; height: 36px; }
    .nav-menu ul li {
        width: 100%;
    }
    .nav-menu .nav-item {
        padding: 10px 0;
        justify-content: center;
        border-radius: 0; /* No rounded corners for collapsed nav */
    }
    .nav-menu .nav-item .material-icons {
        margin-right: 0;
    }

    .daily-goal {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden; /* Hide text, just show round goal indicator */
        box-shadow: none; /* Remove shadow */
    }
    .daily-goal .progress-bar-container {
        display: none; /* Hide progress bar */
    }

    .app-container {
        padding: 20px; /* Reduced padding for smaller screens */
        gap: 20px;
        flex-direction: row; /* Keep as row for collapsed sidebar */
    }
    .main-content {
        height: calc(100vh - 40px); /* Adjust for app-container padding */
        padding: 20px;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    .search-bar {
        width: 100%;
    }
    .user-actions {
        width: 100%;
        justify-content: space-between;
        padding-top: 15px;
        border-top: 1px solid var(--glass-border-color); /* Glass border */
        margin-top: 10px;
    }
    .user-profile {
        padding-left: 0;
        margin-left: 0;
    }
    .user-profile .grade-pill {
        margin-left: auto; /* Push to the right */
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
    }
    .bottom-sections-grid,
    .progress-content-grid,
    .analytics-insights-grid, /* Added analytics grid */
    .profile-settings-grid { /* Added profile grid */
        grid-template-columns: 1fr; /* Stack bottom sections on tablets */
    }
    .topic-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); /* Re-adjust for remaining space */
    }
}

@media (max-width: 768px) {
    /* Keep stat content inline with icon on mobile, remove extra gaps */
    .stats-grid { grid-template-columns: 1fr; gap: 16px; }
    .stat-card { align-items: center; padding: 16px 18px; }
    .stat-card h4 { margin: 0; font-size: 22px; }
    .stat-card p { margin: 0; font-size: 13px; }
    .stat-card-icon { width: 42px; height: 42px; margin-right: 12px; }
    .stat-card-body { align-items: center; text-align: center; }

    /* Learning progress clarity on mobile */
    .progress-item { padding-bottom: 12px; }
    .progress-item-header { gap: 6px; }
    .progress-item-subline .level-tag { font-size: 12px; }
    /* continue mobile adjustments */
    html, body { font-size: 15px; }
    .app-container {
        flex-direction: column; /* Stack sidebar and main content */
        padding: 15px; /* Smaller padding */
        gap: 15px;
        height: auto; /* Allow content to dictate height, enable scrolling on body */
        min-height: unset;
        overflow: visible; /* Let content overflow if needed */
    }
    html, body {
        overflow-y: auto; /* Allow full page scroll on small screens */
    }
    .sidebar {
        width: 100%;
        height: auto; /* Allow sidebar to be compact */
        display: flex;
        flex-direction: column; /* Column layout: Header > Menu > Daily Goal > Logout */
        align-items: stretch;
        padding: 10px 15px; /* Adjusted padding */
        border-right: none;
        border-bottom: 1px solid var(--glass-border-color); /* Glass border */
        box-shadow: 0 2px 5px rgba(31, 38, 135, 0.1); /* Lighter glass shadow for bottom */
        position: static; /* Remove sticky on mobile */
        overflow-y: visible;
        border-radius: 18px; /* Consistent radius for a standalone element */
    }
    .sidebar .logo {
        margin-bottom: 8px; /* Header at top */
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    /* Ensure brand name and slogan are visible next to the logo on mobile */
    .sidebar .logo-text { display: block !important; }
    .sidebar .logo-text h1 { font-size: 18px; margin: 0; }
    .sidebar .logo-text p { font-size: 12px; margin: 0; color: var(--text-medium); }
    .nav-menu {
        order: 2; /* After header */
        width: 100%;
        margin: 0 0 10px 0;
    }
    .nav-menu ul { display: flex; justify-content: space-around; width: 100%; }
    .nav-menu ul li {
        margin-bottom: 0;
        flex: 1;
    }
    .nav-menu .nav-item {
        padding: 10px 0;
        text-align: center;
        font-size: 14px;
        flex-direction: column;
        gap: 5px;
    }
    .nav-menu .nav-item.active {
        box-shadow: none;
    }
    /* Sidebar: logo + nav evenly spaced, daily goal follows beneath */
    .sidebar { gap: 10px; }
    .sidebar .logo, .sidebar .nav-menu { width: 100%; }
    .daily-goal { order: 3; margin-top: 6px; width: 100%; border-radius: 12px; padding: 10px 14px; box-shadow: 0 2px 5px rgba(76,175,80,0.18); }
    .logout-btn { order: 4; margin-top: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--glass-border-color); background: #fff; color: var(--text-dark); cursor: pointer; }
    .daily-goal h3, .daily-goal p {
        display: block;
    }
    .progress-bar-container {
        display: block;
        margin-top: 5px;
    }

    .main-content {
        padding: 15px; /* Consistent with app-container */
        height: auto; /* Allow content to dictate height */
        min-height: unset; /* Remove min-height */
        overflow-y: visible; /* Allow content to expand */
    }
    .topbar {
        padding: 10px 15px;
    }
    .search-bar input {
        width: 100%;
    }
    .stats-grid { grid-template-columns: 1fr; }
    .stats-grid .stat-card { text-align: left; }
    .welcome-heading, .welcome-message { text-align: center; }
    .topbar { align-items: center; }
    .topbar .user-info { text-align: center; width: 100%; }
    .topic-cards-grid {
        grid-template-columns: 1fr; /* Single column on very small screens */
    }
    .bottom-sections-grid,
    .progress-content-grid,
    .analytics-insights-grid,
    .profile-settings-grid {
        grid-template-columns: 1fr; /* Single column on phones */
    }
    /* Learning Progress clearer separation */
    .learning-progress-section h3 { text-align: left; margin-bottom: 14px; }
    .progress-item { padding: 6px 0; }
    .progress-item-header { display: flex; flex-direction: column; align-items: stretch; }
    .progress-item-subline { margin-top: 2px; }

    /* Practice Session inner spacing and chips */
    .practice-session-section h2 { font-size: 1.55rem !important; }
    .practice-session-section .level-tag { display:inline-block; margin-top:8px; }
    .practice-option { font-size: 14px !important; }
    .navigation-controls { gap: 10px; flex-wrap: wrap; }
    .navigation-controls .action-btn, .navigation-controls .action-btn.secondary { width: auto !important; min-width: 110px; }
    .navigation-controls .next { margin-left: auto; }
    .practice-session-section { padding: 12px !important; }
    .practice-options { display: flex; flex-direction: column; gap: 10px; }
    /* Override inline font-size on question text when needed on mobile */
    .question-text { font-size: 15px !important; }
    /* Make feedback boxes slightly smaller on mobile despite inline styles */
    .practice-feedback { font-size: 14px !important; padding: 12px 14px !important; }
}

@media (max-width: 480px) {
    html, body { font-size: 14px; }
    .sidebar .logo h1 { font-size: 18px; }
    .sidebar .logo-img { width: 28px; height: 28px; }
    .user-profile p {
        font-size: 13px;
    }
    .user-profile span {
        font-size: 11px;
    }
    .welcome-heading, .section-heading {
        font-size: 22px;
    }
    .bottom-sections-grid .glass-card h3,
    .analytics-insights-grid .glass-card h3,
    .profile-settings-grid .glass-card h3 {
        font-size: 18px;
    }
    .topic-card h4 {
        font-size: 16px;
    }
    .stat-card h4 {
        font-size: 20px;
    }
    .action-btn, .start-practice-btn, .save-changes-btn { font-size: 14px; padding: 10px 14px; }
    .practice-option { font-size: 14px !important; }
    .question-text { font-size: 14px !important; }
    .practice-feedback { font-size: 13.5px !important; padding: 10px 12px !important; }
    .practice-session-section .navigation-controls { justify-content: space-between; }
}

/* MathJax containers: match surrounding text size exactly for inline equations */
.mjx-container { font-size: 1em; line-height: 1.4; overflow: visible; }
.mjx-container[display="true"] { overflow-x: auto; }
.mjx-container svg { max-width: 100%; height: auto; }

/* MathJax CHTML output: ensure inline sizing and containment */
.mjx-chtml {
    max-width: 100% !important;
    overflow-wrap: anywhere;
    word-break: normal;
}
.question-text .mjx-chtml,
.practice-option .mjx-chtml {
    display: inline !important;
    font-size: 1em !important;
    vertical-align: baseline !important;
}
.question-text { overflow: hidden; }
.question-text .mjx-chtml { max-width: 100% !important; }

/* Ensure math inside .math-explanation matches surrounding text size/baseline (hints and questions) */
/* no per-container override; rely on global .mjx-container (1.06em) so hints and questions match exactly */
/* Prevent content overflow within feedback/context boxes on small screens */
.practice-feedback { max-width: 100%; overflow-x: hidden; }
.practice-feedback, .practice-feedback .math-explanation { overflow-wrap: anywhere; word-break: break-word; }

/* Defensive: hide any global SVG cache MathJax might inject (prevents giant glyph overlays) */
svg#MJX-SVG-global-cache,
svg#mjx-svg-global,
svg.mjx-svg-global,
svg[aria-hidden="true"][style*="position: absolute"],
svg[id*="MJX-SVG-global"],
svg[id*="MJX-SVG"][id*="global"],
svg[id^="MJX-"][id$="global-cache"],
svg[data-mjx-global-cache] {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
    /* Keep it rendered so <defs> are available for <use> references */
    display: block !important;
    clip-path: inset(50%) !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

/* If the cache SVG has unexpected non-def content, force-hide those nodes */
svg#MJX-SVG-global-cache > :not(defs),
svg#mjx-svg-global > :not(defs),
svg.mjx-svg-global > :not(defs) {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Extra defensive rule: if any unexpected top-level SVG gets inserted and is huge, mask it */
body > svg:not(#MJX-SVG-global-cache):not(#mjx-svg-global):not(.mjx-svg-global),
.app-container > svg:not(#MJX-SVG-global-cache):not(#mjx-svg-global):not(.mjx-svg-global) {
    /* As a safety net, prevent interaction; JS will further zero-size if detected oversized */
    pointer-events: none !important;
}

/* If a top-level SVG balloons beyond the viewport (common overlay symptom), neutralize it */
@media (min-width: 0px) {
    body > svg:not(#MJX-SVG-global-cache):not(#mjx-svg-global):not(.mjx-svg-global) {
        max-width: 100vw !important;
        max-height: 100vh !important;
    }
}
/* Prevent oversized MathJax from overflowing cards */
.practice-session-section .mjx-container,
.dashboard-overview .mjx-container { max-width: 100%; }

/* Question line readability and wrapping for equations */
.question-text { overflow-wrap: anywhere; word-break: normal; line-height: 1.5; }
/* Redundant but harmless; global rule already sets this on .mjx-container svg */
.question-text svg { max-width: 100%; height: auto; }

/* Force MathJax in question sentences to behave like inline text and match text size */
.question-text mjx-container {
    font-size: 1em !important;
    display: inline !important;
    vertical-align: baseline !important;
    margin: 0 !important;
}
.question-text mjx-container[display="true"] {
    display: inline !important;
}
/* Clamp inline MathJax svg to line height inside questions to prevent oversized render */
.question-text mjx-container svg {
    height: 1em !important;
    width: auto !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* Also clamp math inside options to inline line-height */
.practice-option mjx-container {
    font-size: 1em !important;
    display: inline !important;
    vertical-align: baseline !important;
}
.practice-option mjx-container svg {
    height: 1em !important;
    width: auto !important;
}

/* Hard stop: if MathJax ever inserts a root-level mjx-container, neutralize it (not used for inline math) */
body > mjx-container,
.app-container > mjx-container {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}
body > mjx-container svg,
.app-container > mjx-container svg {
    width: 0 !important;
    height: 0 !important;
}

/* Mobile-only two-line layout for Daily Goal */
@media (max-width: 768px) {
    .daily-goal { display: block; }
    .daily-goal { text-align: center; }
    .daily-goal h3.dg-line { display: block; margin-bottom: 6px; line-height: 1.3; }
    .daily-goal .dg-line + .dg-line { display: block; margin-top: 0; }
    /* Ensure the progress sentence is on its own line and readable */
    .daily-goal p.dg-line { display: block; line-height: 1.4; margin-bottom: 10px; color: var(--text-dark); }
    /* Center the progress bar beneath the text */
    .daily-goal .progress-bar-container { margin-left: auto; margin-right: auto; }
}

/* Override older collapsed-sidebar behavior to keep Daily Goal readable on ≤992px */
@media (max-width: 992px) {
    .sidebar .daily-goal {
        width: 100% !important;
        height: auto !important;
        min-height: 72px !important;
        border-radius: 16px !important;
        padding: 14px !important;
        display: block !important;
        align-items: initial !important;
        justify-content: initial !important;
        overflow: visible !important;
        box-shadow: var(--glass-shadow) !important;
        text-align: center !important;
    }
    .sidebar .daily-goal h3,
    .sidebar .daily-goal p { display: block !important; }
    .sidebar .daily-goal .progress-bar-container { display: block !important; }
}
.password-field input[type="password"]::-ms-reveal,
.password-field input[type="password"]::-ms-clear,
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
    display: none; /* Hide native Edge/IE password reveal & clear to prevent double icons */
}