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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

:root {
    /* Primary Brand Colors */
    --primary: #305CDE;
    --primary-hover: #264bb3;
    --secondary: #f97316;
    --secondary-hover: #ea580c;
    
    /* MD System Colors (Light Theme Default) */
    --md-sys-color-primary: var(--primary);
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #e0e7ff;
    --md-sys-color-on-primary-container: #1e1b4b;
    
    --md-sys-color-surface: #fdfbff;
    --md-sys-color-on-surface: #1a1b1e;
    --md-sys-color-surface-variant: #f1f5f9;
    --md-sys-color-on-surface-variant: #44474f;
    --md-sys-color-outline: #74777f;
    
    /* Functional Variables */
    --bg: var(--md-sys-color-surface);
    --card-bg: #ffffff;
    --text-main: var(--md-sys-color-on-surface);
    --text-muted: var(--md-sys-color-on-surface-variant);
    --border: rgba(0, 0, 0, 0.1);
    --nav-bg: rgba(255, 255, 255, 0.95);
    
    --sidebar-width: 88px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Radius Variables */
    --m3-radius-large: 16px;
    --m3-radius-medium: 16px;
    --m3-radius-full: 16px;
}

[data-theme="dark"] {
    --md-sys-color-primary: #adc6ff;
    --md-sys-color-on-primary: #002d6f;
    --md-sys-color-primary-container: #00429a;
    --md-sys-color-on-primary-container: #d8e2ff;

    /* Secondary Orange Colors */
    --md-sys-color-secondary: #f9a825;
    --md-sys-color-on-secondary: #212121;
    --secondary-hover: #ffc107;

    /* Lighter Dark Mode Surface */
    --md-sys-color-surface: #161B22;
    --md-sys-color-on-surface: #f8fafc;
    --md-sys-color-surface-variant: #21262D;
    --md-sys-color-on-surface-variant: #94a3b8;
    --md-sys-color-outline: #30363d;
    
    --bg: var(--md-sys-color-surface);
    --card-bg: var(--md-sys-color-surface-variant);
    --text-main: var(--md-sys-color-on-surface);
    --text-muted: var(--md-sys-color-on-surface-variant);
    --border: rgba(255, 255, 255, 0.1);
    --nav-bg: rgba(13, 17, 23, 0.95);
}

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

body {
    font-family: 'Google Sans', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    line-height: 1.5; /* Reduced from 1.6 */
    font-size: 0.95rem; /* Reduced from 1rem */
    overflow-x: hidden;
    transition: var(--transition);
    display: flex;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4 {
    font-weight: 700;
    line-height: 1.2; /* Reduced from 1.25 */
    color: var(--text-main);
    letter-spacing: -0.01em;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

h1 { font-size: 1.75rem; } /* Reduced from 2rem */
h2 { font-size: 1.35rem; } /* Reduced from 1.5rem */
h3 { font-size: 1.15rem; } /* Reduced from 1.25rem */
h4 { font-size: 1.05rem; } /* Reduced from 1.125rem */

@media (min-width: 768px) {
    body { font-size: 1.05rem; } /* Reduced from 1.125rem */
    h1 { font-size: 2.5rem; } /* Reduced from 3rem */
    h2 { font-size: 1.75rem; } /* Reduced from 2rem */
    h3 { font-size: 1.5rem; } /* Reduced from 1.75rem */
    h4 { font-size: 1.25rem; } /* Reduced from 1.5rem */
}

/* Layout */
.container {
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0.5rem;
}

.main-content {
    flex: 1;
    width: calc(100% );
}

/* Navigation Rail (Sidebar/Bottom Bar) - Material Design 3 Expressive */
:root {
    --nav-rail-width: 88px;
    --nav-bar-height: 80px;
}

.nav-rail {
    width: var(--nav-rail-width);
    height: 100vh;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    border-right: 1px solid var(--border);
    transition: var(--transition);
}

.nav-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.nav-content-wrapper::-webkit-scrollbar {
    display: none;
}

.nav-rail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    padding: 8px 0;
    text-decoration: none;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    margin-bottom: 8px;
    transition: var(--transition);
}

.nav-rail-item .state-layer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 12px;
    width: 100%;
    transition: background-color 0.2s;
}

.nav-rail-item .icon-wrapper {
    position: relative;
    width: 56px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: all 0.3s cubic-bezier(0.2, 0.0, 0, 1.0);
    margin-bottom: 4px;
}

/* Active States */
.nav-rail-item.active .icon-wrapper {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.nav-rail-item.active .label {
    font-weight: 700;
    color: var(--text-main);
}

.nav-rail-item .label {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.5px;
}

/* Hover States */
.nav-rail-item:hover .icon-wrapper {
    background-color: var(--md-sys-color-surface-variant);
}

.nav-rail-item.active:hover .icon-wrapper {
    background-color: var(--md-sys-color-primary-container);
}

/* Special Items (Student/Dashboard) */
.nav-item-special.student .icon-wrapper {
    color: #008080; /* Teal */
    background-color: rgba(0, 128, 128, 0.08);
}

.nav-item-special.student.active .icon-wrapper {
    background-color: #008080;
    color: white;
}

.nav-item-special.dashboard .icon-wrapper {
    color: #2e7d32; /* Green */
    background-color: rgba(46, 125, 50, 0.08);
}

.nav-item-special.dashboard.active .icon-wrapper {
    background-color: #2e7d32;
    color: white;
}

/* Secondary Nav & Spacer */
.nav-spacer {
    flex-grow: 1;
}

.nav-rail-secondary {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
}

/* Theme Toggle Button specific styling */
.theme-toggle-btn {
    margin-top: 8px;
}

/* Mobile Styles */
@media (max-width: 600px) {
    .nav-rail {
        width: 100%;
        height: var(--nav-bar-height);
        top: auto;
        bottom: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        padding: 0;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }

    .nav-content-wrapper {
        flex-direction: row;
        justify-content: space-evenly;
        align-items: center;
        padding: 0 8px;
        overflow-x: auto;
        overflow-y: hidden;
    }

    .nav-rail-item {
        width: auto;
        padding: 0;
        margin: 0;
        min-width: 64px;
        flex: 1;
    }

    .nav-rail-item .icon-wrapper {
        width: 64px;
        height: 32px;
        margin-bottom: 4px;
    }

    .nav-rail-item .label {
        font-size: 0.7rem;
    }

    .nav-spacer {
        display: none;
    }

    /* Secondary Nav (Menu Mode) */
    .nav-rail-secondary {
        display: none; /* Controlled by JS */
        position: fixed;
        bottom: calc(var(--nav-bar-height) + 16px);
        right: 16px;
        width: 220px;
        background-color: var(--card-bg);
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
        padding: 8px;
        z-index: 1001;
        border: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
    }

    .nav-rail-secondary.active {
        display: flex;
        animation: scaleIn 0.2s cubic-bezier(0.2, 0.0, 0, 1.0);
    }
    
    .nav-rail-secondary .nav-rail-item {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        padding: 12px 16px;
        gap: 12px;
        height: auto;
        min-height: 48px;
        border-radius: 12px;
    }
    
    .nav-rail-secondary .nav-rail-item:hover {
        background-color: var(--md-sys-color-surface-variant);
    }

    .nav-rail-secondary .nav-rail-item .icon-wrapper {
        background-color: transparent !important;
        color: var(--primary);
        width: 24px;
        height: 24px;
        margin: 0;
    }
    
    .nav-rail-secondary .nav-rail-item .label {
        font-size: 1rem;
        font-weight: 500;
        text-align: left;
    }

    .more-btn {
        display: flex;
    }
}

/* Desktop Only Overrides */
@media (min-width: 601px) {
    .more-btn {
        display: none;
    }
    
    .nav-rail-secondary {
        display: flex !important;
        position: static;
        width: 100%;
        box-shadow: none;
        background: transparent;
        border: none;
        padding-bottom: 0;
    }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); transform-origin: bottom right; }
    to { opacity: 1; transform: scale(1); transform-origin: bottom right; }
}

/* Navbar (Sticky Top Alternative) */
nav:not(.nav-rail) {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    padding: 0 5%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.nav-links {
    display: none;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
        gap: 2rem;
        list-style: none;
        align-items: center;
    }

    .nav-links a {
        color: var(--text-main);
        text-decoration: none;
        font-weight: 500;
        transition: var(--transition);
    }

    .nav-links a:hover {
        color: var(--primary);
    }
}

/* Hero Section */
.hero {
    padding: 6rem 2rem;
    text-align: center;
    background: radial-gradient(circle at top, var(--md-sys-color-primary-container) 0%, var(--bg) 100%);
}

.hero h1 {
    font-size: 2.25rem; /* 36px (Mobile) */
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .hero h1 {
        font-size: 3.5rem; /* 56px (Desktop) */
    }
}

.hero p {
    color: var(--text-muted);
    font-size: 1.125rem; /* 18px */
    margin-bottom: 2rem;
    max-width: 800px; /* Increased for character length guideline */
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Buttons */
.cta-button {
    background-color: var(--primary);
    color: #ffffff;
    padding: 1rem 3rem;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.cta-button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(48, 92, 222, 0.3);
}

.cta-button.outlined {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--md-sys-color-outline);
}

.cta-button.outlined:hover {
    background-color: var(--md-sys-color-surface-variant);
}

/* Course Grid */
.courses {
    padding: 4rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

.section-title h2 {
    font-size: 2rem; /* Reduced from 2.5rem */
    margin-bottom: 0.75rem;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.course-card {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.course-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.course-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--md-sys-color-surface-variant);
}

.course-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 1rem;
}

.course-icon {
    font-size: 1.5rem;
    color: var(--primary);
}

.course-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    line-height: 1.4;
    font-weight: 700;
}

.course-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-item i {
    width: 24px;
    height: 24px;
    background: var(--md-sys-color-surface-variant);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.card-image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.course-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.course-card:hover .course-image {
    transform: scale(1.05);
}

.badges-container {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.badge {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-main);
    padding: 0.3rem 0.6rem;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.badge.simulation { color: #f59e0b; }
.badge.game { color: #8b5cf6; }

.price-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.original-price {
    font-size: 0.9rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

.course-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.cta-button.add-to-cart-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}


.price {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.5rem;
}

/* Features */
.features {
    padding: 4rem 2rem;
    background: var(--md-sys-color-surface-variant);
    border-radius: 16px;
    margin: 2rem;
}

.feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 3rem;
}

.feature-item {
    text-align: center;
}

.feature-item i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
}

/* --- Redesigned Profile Styles --- */
.profile-page-wrapper {
    background-color: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(48, 92, 222, 0.1) 0px, transparent 40%),
        radial-gradient(at 100% 100%, rgba(0, 128, 128, 0.05) 0px, transparent 40%);
    min-height: 100vh;
    padding: 1.5rem 0 6rem; /* Reduced from 2rem and 8rem */
}

.profile-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* Reduced from 2.5rem */
}

/* Hero Card */
.profile-hero-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem 2rem !important; /* Reduced from 2.5rem 3rem */
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    border: 1px solid var(--border) !important;
}

.hero-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem; /* Reduced from 2rem */
}

@media (max-width: 768px) {
    .hero-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.5rem;
    }
}

.contact-info-strip {
    display: flex;
    gap: 1.5rem; /* Reduced from 3rem */
    padding-top: 1.25rem; /* Reduced from 1.5rem */
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.contact-info-strip .info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Reduced from 0.75rem */
}

.contact-info-strip i {
    color: var(--primary);
    font-size: 1rem; /* Reduced from 1.1rem */
}

.contact-info-strip span {
    font-weight: 500;
}

.user-full-name {
    font-size: 1.75rem; /* Reduced from 2.5rem */
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0.25rem; /* Reduced from 0.5rem */
    letter-spacing: -0.5px;
}

.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 6px 16px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 16px;
    font-size: 0.9rem;
    font-weight: 600;
}

.logout-btn {
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: 1px solid rgba(255, 68, 68, 0.2);
    padding: 0.6rem 1.25rem; /* Reduced from 0.8rem 1.75rem */
    border-radius: 16px;
    font-weight: 600;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Reduced from 0.75rem */
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: #ff4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.2);
}

/* Main Grid Layout */
.profile-main-grid {
    display: grid;
    grid-template-columns: 320px 1fr; /* Reduced from 340px */
    gap: 1.5rem; /* Reduced from 2.5rem */
    align-items: start;
}

@media (max-width: 1100px) {
    .profile-main-grid {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Info Cards */
.info-column {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Reduced from 2rem */
}

.card-title-small {
    font-size: 1.1rem; /* Reduced from 1.25rem */
    font-weight: 700;
    margin-bottom: 1.25rem; /* Reduced from 1.75rem */
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.6rem; /* Reduced from 0.75rem */
}

.contact-card, .quick-links-card {
    padding: 1.5rem !important; /* Reduced from 2.5rem */
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem; /* Reduced from 1.5rem */
}

.info-item {
    display: flex;
    gap: 1rem; /* Reduced from 1.25rem */
    align-items: center;
}

.info-item i {
    width: 36px; /* Reduced from 44px */
    height: 36px; /* Reduced from 44px */
    background: var(--md-sys-color-surface-variant);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem; /* Reduced from 1.2rem */
    flex-shrink: 0;
}

.info-item label {
    display: block;
    font-size: 0.65rem; /* Reduced from 0.7rem */
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px; /* Reduced from 1px */
    margin-bottom: 1px; /* Reduced from 2px */
}

.info-item span {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem; /* Reduced from 1rem */
    word-break: break-all;
}

.quick-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 1rem; /* Reduced from 1.25rem */
    padding: 0.75rem 1rem; /* Reduced from 1rem 1.25rem */
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    transition: var(--transition);
    background: transparent;
}

.link-item:hover {
    background: var(--md-sys-color-surface-variant);
    transform: translateX(5px);
}

.link-item i {
    font-size: 1.3rem;
    color: var(--primary);
    width: 24px;
    text-align: center;
}

/* Settings Card Redesign */
.settings-card {
    padding: 0 !important;
}

.card-header-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.card-header-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    padding: 1.25rem 1.25rem; /* Reduced from 1.75rem 1.5rem */
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-family: inherit;
    font-size: 0.95rem; /* Reduced from 1rem */
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modern-form {
    padding: 1.5rem 2rem; /* Reduced from 3rem */
}

@media (max-width: 640px) {
    .modern-form {
        padding: 1.25rem 1rem; /* Reduced from 2rem 1.5rem */
    }
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem 1.5rem; /* Reduced from 2rem 2.5rem */
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem; /* Reduced from 1.5rem */
    }
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Reduced from 0.75rem */
}

.input-field.full {
    grid-column: 1 / -1;
}

.input-field label {
    font-size: 0.85rem; /* Reduced from 0.9rem */
    font-weight: 700;
    color: var(--text-main);
    padding-left: 2px;
}

.input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.input-box i {
    position: absolute;
    left: 1.25rem; /* Reduced from 1.5rem */
    color: var(--text-muted);
    font-size: 1rem; /* Reduced from 1.1rem */
    pointer-events: none;
}

.input-box input, .input-box select {
    width: 100%;
    padding: 0.8rem 1.25rem 0.8rem 3.5rem; /* Reduced padding */
    background: var(--md-sys-color-surface-variant);
    border: 2px solid transparent;
    border-radius: 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem; /* Reduced from 1rem */
    transition: var(--transition);
}

.input-box input:focus, .input-box select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg);
    box-shadow: 0 0 0 4px rgba(48, 92, 222, 0.1);
}

.input-field.readonly {
    opacity: 0.6;
}

.input-field.readonly input {
    cursor: not-allowed;
}

/* Gender Selection Cards */
.gender-selection {
    display: flex;
    gap: 1.25rem;
}

@media (max-width: 480px) {
    .gender-selection {
        flex-direction: column;
    }
}

.gender-option {
    flex: 1;
    cursor: pointer;
}

.gender-option input {
    display: none;
}

.option-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem; /* Reduced from 0.8rem */
    padding: 0.8rem; /* Reduced from 1.1rem */
    background: var(--md-sys-color-surface-variant);
    border-radius: 16px;
    border: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
}

.gender-option:hover .option-card {
    background: var(--border);
}

.gender-option input:checked + .option-card {
    background: var(--md-sys-color-primary-container);
    color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(48, 92, 222, 0.15);
}

/* Form Actions */
.form-actions {
    margin-top: 4rem;
    padding-top: 2.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.save-btn {
    background: var(--primary);
    color: white;
    padding: 0.8rem 2.5rem; /* Reduced from 1.1rem 3.5rem */
    border-radius: 16px;
    border: none;
    font-weight: 700; /* Reduced from 800 */
    font-size: 1rem; /* Reduced from 1.1rem */
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.75rem; /* Reduced from 1rem */
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(48, 92, 222, 0.3);
}

.save-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(48, 92, 222, 0.4);
    background: var(--primary-hover);
}

.save-btn:active {
    transform: translateY(-1px);
}

.save-btn.success {
    background: #2e7d32;
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.3);
}

/* Logged Out View Redesign */
.logged-out-view {
    max-width: 500px;
    margin: 4rem auto;
    padding: 4rem 2rem;
    text-align: center;
}

.locked-icon-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.locked-icon-container i {
    font-size: 3.5rem;
    color: var(--primary);
    position: relative;
    z-index: 1;
}

/* Logged Out View Polishing */
.logged-out-view {
    max-width: 550px;
    margin: 6rem auto;
    padding: 5rem 3rem;
    background: var(--card-bg);
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
}

.locked-icon-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.locked-icon-container i {
    font-size: 4rem;
    color: var(--primary);
    position: relative;
    z-index: 1;
}

.pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--md-sys-color-primary-container);
    border-radius: 50%;
    animation: pulseLock 2s infinite;
}

@keyframes pulseLock {
    0% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 0.1; }
    100% { transform: scale(0.9); opacity: 0.6; }
}

.logged-out-view h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.logged-out-actions {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    margin-top: 3rem;
}

.m3-btn-filled-large {
    background: var(--primary);
    color: white;
    padding: 0.9rem 2.5rem; /* Reduced from 1.2rem 4rem */
    border-radius: 16px;
    text-decoration: none;
    font-weight: 700; /* Reduced from 800 */
    font-size: 1rem; /* Reduced from 1.1rem */
    display: inline-block;
    transition: var(--transition);
    box-shadow: 0 8px 20px rgba(48, 92, 222, 0.3);
}

.m3-btn-filled-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(48, 92, 222, 0.4);
    background: var(--primary-hover);
}

.m3-btn-text {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 16px;
    transition: var(--transition);
}

.m3-btn-text:hover {
    background: var(--md-sys-color-surface-variant);
}

/* --- Tab Content Management --- */
.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-pane.active {
    display: block;
}

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

/* --- Notifications Layout --- */
.notifications-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 3rem;
}

.notify-section {
    background: var(--card-bg);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.section-header i {
    font-size: 1.5rem;
    color: var(--primary);
    background: var(--md-sys-color-primary-container);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
}

.section-header h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.section-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced from 1.5rem */
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem; /* Reduced from 1.5rem */
}

.toggle-info {
    flex: 1;
}

.toggle-label {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    font-size: 1rem;
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* --- M3 Toggle Switch --- */
.m3-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
    flex-shrink: 0;
}

.m3-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.m3-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--md-sys-color-surface-variant);
    transition: .4s;
    border-radius: 16px;
    border: 2px solid var(--md-sys-color-outline);
}

.m3-switch-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
    background-color: var(--md-sys-color-outline);
    transition: .4s;
    border-radius: 50%;
}

.m3-switch input:checked + .m3-switch-slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

.m3-switch input:checked + .m3-switch-slider:before {
    transform: translateX(20px);
    background-color: white;
}

.m3-switch input:focus + .m3-switch-slider {
    box-shadow: 0 0 1px var(--primary);
}

@media (max-width: 768px) {
    .notifications-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

.hidden {
    display: none !important;
}

.flex {
    display: flex !important;
}

/* Specific Styles for Legal Pages (Privacy Policy, Terms of Service) */
.main-content.container {
    padding: 4rem 0;
    max-width: 900px;
    margin: 0 auto;
}

.page-title {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.page-subtitle {
    color: var(--text-muted);
    margin-bottom: 3rem;
}

.content-wrapper {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-main);
}

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

.section-heading {
    font-size: 1.75rem;
    color: var(--md-sys-color-primary);
    margin-bottom: 1.5rem;
    text-decoration: underline;
}

.section-paragraph {
    margin-bottom: 1rem;
    text-align: justify;
}

.section-paragraph.first-paragraph {
    margin-bottom: 2rem;
}

.list-disc {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    list-style-type: disc;
}

.list-decimal {
    margin-left: 2rem;
    margin-bottom: 1.5rem;
    list-style-type: decimal;
}

.list-item {
    margin-bottom: 0.5rem;
}

.primary-link {
    color: var(--md-sys-color-primary);
}

.highlight-text {
    font-weight: 700;
    margin-top: 4rem;
    text-align: center;
    font-size: 1.25rem;
}


/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.form-control {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 16px;
    width: 100%;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(48, 92, 222, 0.2);
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    background: var(--bg);
    padding: 0.75rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-option input {
    accent-color: var(--primary);
}

/* Footer Redesign */
.site-footer {
    background-color: var(--bg);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 3rem;
}

@media (max-width: 900px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
    
    .brand-section {
        grid-column: 1 / -1;
    }
}

@media (max-width: 600px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
}

.footer-logo {
    font-family: 'Google Sans', sans-serif;
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--primary);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 1rem;
}

[data-theme="dark"] .footer-logo {
    color: var(--md-sys-color-secondary);
}

.footer-desc {
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 360px;
    font-size: 0.95rem;
}

@media (max-width: 600px) {
    .footer-desc {
        margin: 0 auto;
    }
}

.footer-section h4 {
    color: var(--text-main);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.01em;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: var(--transition);
    display: inline-block;
}

.footer-links a:hover {
    color: var(--primary);
    transform: translateX(4px);
}

[data-theme="dark"] .footer-links a:hover {
    color: var(--md-sys-color-secondary);
}

/* Social Links */
.social-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .social-links {
        justify-content: center;
    }
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--md-sys-color-surface-variant);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    font-size: 1.1rem;
}

.social-links a:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(48, 92, 222, 0.3);
}

[data-theme="dark"] .social-links a:hover {
    background: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
    box-shadow: 0 4px 12px rgba(249, 168, 37, 0.3);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Cart Badge */
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--secondary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Visibility Utilities */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: flex !important;
}

/* Mobile Adjustments */
@media screen and (max-width: 600px) {
    /* Global Mobile Reductions */
    html {
        font-size: 13px; /* Slightly smaller base for mobile */
    }

    .profile-page-wrapper {
        padding: 1rem 0 5rem;
    }

    .profile-dashboard {
        gap: 1rem;
    }

    /* Hero Card Mobile */
    .profile-hero-card {
        padding: 1.25rem 1.25rem !important;
        border-radius: 16px;
    }

    .hero-content {
        margin-bottom: 1rem;
        gap: 1rem;
    }

    .user-full-name {
        font-size: 1.5rem;
        letter-spacing: -0.2px;
    }

    .contact-info-strip {
        gap: 0.75rem 1.25rem;
        padding-top: 1rem;
    }

    /* Form Mobile */
    .modern-form {
        padding: 1rem;
    }

    .form-grid {
        gap: 0.75rem;
    }

    .input-box input, .input-box select {
        padding: 0.7rem 1rem 0.7rem 3rem;
        border-radius: 12px;
        font-size: 0.9rem;
    }

    .input-box i {
        left: 1rem;
    }

    .tab-btn {
        padding: 1rem 0.85rem;
        font-size: 0.85rem;
    }

    .card-header-tabs {
        padding: 0 0.5rem;
    }

    .save-btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 2rem;
    }

    /* Bottom Nav Rail Height */
    .main-content {
        margin-bottom: 80px; /* Aligned with --nav-bar-height */
    }

    .mobile-only {
        display: flex !important;
    }

    .desktop-only {
        display: none !important;
    }

    /* Additional Profile Mobile Reductions */
    .card-title-small {
        font-size: 1rem;
        margin-bottom: 1rem;
    }

    .logout-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        border-radius: 10px;
    }

    .user-role-badge {
        padding: 4px 12px;
        font-size: 0.8rem;
    }

    .toggle-label {
        font-size: 0.9rem;
    }

    .toggle-desc {
        font-size: 0.75rem;
    }

    .info-item i {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .info-item span {
        font-size: 0.85rem;
    }

    .link-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        gap: 0.75rem;
    }

    .link-item i {
        font-size: 1.1rem;
    }

    .main-content {
        margin-left: 0;
        margin-bottom: 80px;
        width: 100%;
    }

    /* Modal Mobile Reductions */
    .modal-content {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .modal-title {
        font-size: 1.35rem;
    }

    .modal-subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .warning-box-modal {
        padding: 1rem;
        margin: 1rem 0;
    }

    .modal-actions {
        margin-top: 1.5rem;
        gap: 0.75rem;
    }



    .more-btn {
        display: flex !important;
    }
    
    .hero {
        padding: 3rem 1rem; /* Reduced from 4rem */
    }

    .hero h1 {
        font-size: 1.75rem; /* Reduced from 2rem */
    }

    .hero p {
        font-size: 0.9rem; /* Reduced from 1rem */
        margin-bottom: 1.5rem;
    }

    .cta-button {
        padding: 0.75rem 2rem;
        font-size: 0.95rem;
    }

    .course-grid {
        gap: 1.25rem;
    }

    .course-content {
        padding: 1rem;
    }

    .course-card h3 {
        font-size: 1.25rem;
    }

    .course-footer {
        padding-top: 0.75rem;
    }

    .price {
        font-size: 1.25rem;
    }

    .features {
        padding: 2.5rem 1.5rem;
        margin: 1rem;
    }

    .feature-list {
        gap: 2rem;
    }

    .notifications-page-wrapper {
        padding: 1.5rem 0 5rem;
    }

    .header-main {
        gap: 1rem;
    }

    .header-icon {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        border-radius: 14px;
    }

    .header-text h1 {
        font-size: 1.75rem;
    }

    .m3-notification-card {
        padding: 1rem;
        gap: 1rem;
    }

    .notify-message {
        font-size: 0.95rem;
    }

    .notify-card-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .prepare-header h1 {
        font-size: 1.75rem;
    }

    .prepare-header {
        margin-bottom: 2rem;
    }

    .topic-header {
        padding: 1rem 1.25rem;
    }

    .topic-header h3 {
        font-size: 1.1rem;
    }

    .topic-header h3 i {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
}

/* Free Course Styles */
.course-card.free {
    border-style: dashed;
    border-width: 2px;
}

/* Stats Section */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    text-align: center;
    padding: 4rem 0;
}

.stat-number {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* App Section */
.app-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: center;
    padding: 4rem 0;
}

@media (min-width: 992px) {
    .app-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.benefit-item {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.benefit-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.check-list {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.check-item i {
    color: var(--md-sys-color-primary);
}

.hidden {
    display: none !important;
}

/* --- Lab Layout & Top Bar Styles (Shared with Student Page) --- */
.top-bar {
    height: 64px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.partner-info-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-right: 1.5rem;
    border-right: 1px solid var(--border);
}

.partner-info-top img {
    height: 32px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
}

.partner-info-top h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.student-info-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.student-info-top .details h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.student-info-top .details p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.7;
}

.top-bar-center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0 1rem;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-bar-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.top-bar-link:hover {
    color: var(--primary);
}

.avatar-small {
    width: 36px;
    height: 36px;
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    background: var(--md-sys-color-surface-variant);
    color: var(--primary);
}

.mobile-hamburger {
    display: none;
}

.lab-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.course-sidebar {
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.chapter-view {
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg);
}

@media (max-width: 768px) {
    .mobile-hamburger {
        display: flex !important;
    }

    .top-bar-actions > a,
    .top-bar-actions > label,
    .top-bar-actions > #logout_btn {
        display: none !important;
    }

    .student-info-top {
        display: none !important;
    }

    .lab-layout {
        grid-template-columns: 1fr;
    }

    .course-sidebar {
        width: 100%;
        height: calc(100vh - 64px);
        position: absolute;
        z-index: 50;
        background: var(--bg);
    }

    .course-sidebar.hidden {
        display: none !important;
        transform: translateX(-100%);
    }

    .chapter-view {
        padding: 1rem;
    }
}

/* Prepare Page Specific Styles */
.prepare-container {
    padding: 3rem 0;
    max-width: 1000px !important;
}

.prepare-header {
    text-align: center;
    margin-bottom: 4rem;
}

.prepare-header h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topic-group {
    background: var(--card-bg);
    border-radius: var(--m3-radius-large);
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.topic-group:hover {
    border-color: var(--primary);
    background: var(--md-sys-color-surface-variant);
    transform: translateY(-2px);
}

.topic-header {
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.topic-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.25rem;
}

.topic-header h3 i {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-sys-color-primary-container);
    border-radius: 12px;
    font-size: 1.1rem;
}

.topic-count {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--text-muted);
}

.topic-content {
    padding: 0 0.75rem 1rem;
    display: none;
    border-top: 1px solid var(--border);
    margin: 0 1rem;
}

.topic-group.active .topic-content {
    display: block;
}

.topic-group.active {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.topic-item {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    border-radius: var(--m3-radius-medium);
    margin-top: 0.5rem;
}

.topic-name {
    font-weight: 600;
    font-size: 1rem;
}

@media (min-width: 640px) {
    .topic-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 1.25rem;
    }
    .topic-header h3 {
        font-size: 1.5rem;
        gap: 1.25rem;
    }
    .topic-header h3 i {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
    }
    .topic-content {
        padding: 0 1.5rem 1.5rem;
        margin: 0 1.5rem;
    }
}

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

.topic-item:hover {
    background: var(--md-sys-color-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.topic-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    justify-content: space-between;
}

@media (min-width: 640px) {
    .topic-controls {
        width: auto;
        justify-content: flex-end;
    }
}

.level-select {
    background: var(--md-sys-color-surface-variant);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: var(--m3-radius-medium);
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    max-width: 160px;
    font-family: inherit;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 -960 960 960' width='24'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.level-select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: var(--md-sys-color-surface);
}

.start-btn {
    background-color: var(--primary);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: var(--m3-radius-medium);
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.start-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Test View Improvements */
.question-card {
    background: var(--card-bg);
    border-radius: var(--m3-radius-large);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.question-card h3 {
    margin-bottom: 1.5rem;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 768px) {
    .question-card {
        padding: 2.5rem;
        margin-bottom: 2rem;
    }
}

.option-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: var(--m3-radius-medium);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

@media (min-width: 768px) {
    .option-item {
        padding: 1.25rem;
    }
}

.option-item:hover {
    border-color: var(--primary);
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.option-item input {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--primary);
}

.submit-large {
    height: 64px;
    width: 100%;
    max-width: 400px;
    padding: 0 2rem;
    border-radius: var(--m3-radius-full);
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 8px 16px rgba(48, 92, 222, 0.2);
}

@media (min-width: 768px) {
    .submit-large {
        height: 72px;
        font-size: 1.25rem;
        padding: 0 4rem;
    }
}

.timer-sticky {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    padding: 0.5rem 1rem;
    border-radius: var(--m3-radius-full);
    border: 1px solid var(--primary);
    font-size: 0.9rem;
}

@media (min-width: 640px) {
    .timer-sticky {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

#result-container {
    padding: 2rem 1.5rem;
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    text-align: center;
}

@media (min-width: 768px) {
    #result-container {
        padding: 4rem 3rem;
        border-radius: 40px;
    }
}

#score-badge {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 1rem;
    line-height: 1;
}

@media (min-width: 768px) {
    #score-badge {
        font-size: 5rem;
        margin-bottom: 1.5rem;
    }
}

/* Centered Loader Styles */
.spinner-overlay {
    width: 100%;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    background: transparent;
    backdrop-filter: none;
}

.loader {
    width: 56px;
    height: 56px;
    border: 4px solid var(--md-sys-color-primary-container);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loading-text {
    margin-top: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
/* --- Notifications Page Redesign --- */
.notifications-page-wrapper {
    background: radial-gradient(circle at 100% 0%, rgba(48, 92, 222, 0.08) 0%, transparent 40%);
    min-height: 100vh;
    padding: 3rem 0 8rem;
}

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

.page-header-md {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.header-main {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-icon {
    width: 64px;
    height: 64px;
    background: var(--md-sys-color-primary-container);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    font-size: 1.75rem;
    box-shadow: 0 8px 16px rgba(48, 92, 222, 0.15);
}

.header-text h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 4px;
}

.notifications-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.m3-notification-card {
    background: var(--card-bg);
    padding: 1.75rem 2rem;
    border-radius: 24px;
    border: 1px solid var(--border);
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.m3-notification-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.m3-notification-card.unread {
    border-left: 6px solid var(--primary);
}

.notify-card-icon {
    width: 48px;
    height: 48px;
    background: var(--md-sys-color-surface-variant);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.notify-card-content {
    flex: 1;
}

.notify-message {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.notify-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.notify-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notify-delete-btn {
    opacity: 0;
    background: rgba(255, 68, 68, 0.1);
    color: #ff4444;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.m3-notification-card:hover .notify-delete-btn {
    opacity: 1;
}

.notify-delete-btn:hover {
    background: #ff4444;
    color: white;
}

/* States */
.loading-card {
    padding: 5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.spinner-m3 {
    width: 48px;
    height: 48px;
    border: 4px solid var(--md-sys-color-primary-container);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.empty-state {
    padding: 6rem 2rem;
    text-align: center;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    opacity: 0.3;
    margin-bottom: 1.5rem;
}

.m3-btn-tonal {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border: none;
    padding: 0.6rem 1.25rem; /* Reduced from 0.75rem 1.5rem */
    border-radius: 12px; /* Reduced from 14px */
    font-weight: 600; /* Reduced from 700 */
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem; /* Reduced from 0.75rem */
    cursor: pointer;
    transition: var(--transition);
}

.m3-btn-tonal:hover {
    background: var(--primary);
    color: white;
}

/* Specific styles for Account tab delete buttons */
.m3-btn-tonal#clear_data {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.m3-btn-tonal#clear_data:hover {
    background-color: #ffc107;
    color: white;
}

.m3-btn-tonal#clear_all_data {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.m3-btn-tonal#clear_all_data:hover {
    background-color: #dc3545;
    color: white;
}

@media (max-width: 640px) {
    .page-header-md {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
    
    .header-actions {
        width: 100%;
    }
    
    .m3-btn-tonal {
        width: 100%;
        justify-content: center;
    }
    
    .m3-notification-card {
        padding: 1.25rem;
        gap: 1rem;
    }
    
    .notify-card-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .notify-delete-btn {
        opacity: 1;
    }
}

/* Dark Theme Secondary Color Overrides */
[data-theme="dark"] .logo {
    color: var(--md-sys-color-secondary);
}

[data-theme="dark"] .cta-button:not(.outlined) {
    background-color: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
    box-shadow: 0 4px 12px rgba(249, 168, 37, 0.3);
}

[data-theme="dark"] .cta-button:not(.outlined):hover {
    background-color: var(--secondary-hover);
    box-shadow: 0 6px 16px rgba(255, 193, 7, 0.4);
}

/* Modal Overlay Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.modal.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 28px;
    max-width: 550px;
    width: 92%;
    position: relative;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    background: transparent;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.close-modal:hover {
    background: var(--md-sys-color-surface-variant);
    color: var(--text-main);
}

.warning-box-modal {
    background: rgba(255, 82, 82, 0.08);
    border-left: 4px solid #ff5252;
    padding: 1.25rem 1.5rem;
    border-radius: 0 16px 16px 0;
    margin: 1.5rem 0;
}

.warning-box-modal h4 {
    color: #ff5252;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.warning-box-modal ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.warning-box-modal li {
    margin-bottom: 0.5rem;
    display: flex;
    gap: 0.75rem;
}

.warning-box-modal li i {
    font-size: 0.5rem;
    margin-top: 0.5rem;
}

.modal-title {
    color: #ff5252;
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.delete-confirm-btn {
    background: #ff5252 !important;
}

/* --- Course Info Page Optimizations --- */
#course-title {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

#course-description {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    padding: 0.75rem 1.5rem;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    z-index: 999;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.mobile-price-container {
    display: flex;
    flex-direction: column;
}

.mobile-mrp {
    font-size: 0.8rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

.mobile-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

@media (max-width: 992px) {
    .course-info-hero {
        padding: 2.5rem 0;
    }
    
    #course-title {
        font-size: 2.5rem;
    }
    
    .hero-grid {
        gap: 2rem;
    }

    .details-section {
        padding: 2rem 0 6rem; /* Extra padding for bottom bar */
    }

    .mobile-bottom-bar {
        display: flex;
    }

    /* Hide the desktop add to cart button in sidebar to reduce clutter, 
       or keep it. The sidebar is at bottom on mobile. */
}

@media (max-width: 600px) {
    #course-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    #course-description {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .hero-text {
        text-align: left;
    }

    .video-facade {
        border-radius: 16px;
    }
    
    .pricing-card {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .includes-list {
        margin: 1.5rem 0;
    }

    .mobile-bottom-bar {
        bottom: 64px;
    }
}

