:root {
    --primary: #4A6CF7;
    --primary-dark: #4f46e5;
    --secondary: #8B5CF6;
    --accent: #2DD4BF;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Light theme */
    --bg-light: #ffffff;
    --card-light: #f8fafc;
    --text-light: #64748B;
    --text-light-primary: #1e293b;
    --border-light: #e2e8f0;
    
    /* Dark theme */
    --bg-dark: #0f172a;
    --card-dark: #1e293b;
    --text-dark: #f8fafc;
    --text-dark-primary: #f1f5f9;
    --border-dark: #334155;

    --gradient-primary: linear-gradient(135deg, var(--primary), var(--secondary));
    --gradient-card: linear-gradient(135deg, #FFFFFF, #F8FAFC);
    --gradient-card-dark: linear-gradient(135deg, var(--card-dark), var(--bg-dark));
    --gradient-hover: linear-gradient(135deg, var(--primary), #5B7CF9);
    
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --card-shadow-dark: 0 4px 20px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.12);
    --card-shadow-hover-dark: 0 8px 30px rgba(0, 0, 0, 0.4);
    --header-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: var(--text-light-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: all 0.3s ease;
}

body.dark {
    background: var(--bg-dark);
    color: var(--text-dark-primary);
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-light);
    z-index: 1000;
    padding: 1rem 0;
    box-shadow: var(--header-shadow);
    transition: all 0.3s ease;
}

body.dark .header {
    background: rgba(15, 23, 42, 0.95);
    border-bottom-color: var(--border-dark);
}

.nav {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: relative;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    transition: all 0.3s ease;
}

.nav-link {
    color: var(--text-light);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-weight: 400;
    position: relative;
}

body.dark .nav-link {
    color: var(--text-dark);
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* Header Icons */
        .header-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(99, 102, 241, 0.1);
            color: var(--primary);
            cursor: pointer;
            transition: all 0.2s;
        }

        .header-icon:hover {
            background: var(--primary);
            color: white;
        }

.header-icon:hover svg {
    fill: white;
}

.header-icon svg {
    width: 20px;
    height: 20px;
    fill: var(--light-text);
    transition: fill 0.3s ease;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--error);
    color: white;
    border-radius: 10px;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border: 2px solid var(--white);
}

body.dark .notification-badge {
    border-color: var(--light-bg);
}

/* Notifications Dropdown */
.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    background: var(--card-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

body.dark .notifications-dropdown {
    background: var(--card-dark);
    border-color: var(--border-dark);
}

.notifications-dropdown.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.notifications-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark .notifications-header {
    border-bottom-color: var(--border-dark);
}

.notifications-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
}

body.dark .notifications-header h3 {
    color: var(--text-dark);
}

/* Mark All Read Button */
.mark-all-read {
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mark-all-read:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.mark-all-read:active {
    transform: translateY(0);
}

.notifications-list {
    padding: 0.5rem 0;
}

.notification-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

body.dark .notification-item {
    border-bottom-color: var(--border-dark);
}

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

.notification-item:hover {
    background: var(--bg-light);
}

body.dark .notification-item:hover {
    background: var(--bg-dark);
}

.notification-item.unread {
    background: rgba(99, 102, 241, 0.05);
}

body.dark .notification-item.unread {
    background: rgba(99, 102, 241, 0.1);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

body.dark .notification-title {
    color: var(--text-dark);
}

.notification-message {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: var(--text-light);
}

body.dark .notification-message {
    color: var(--text-dark);
}

.notification-time {
    font-size: 0.75rem;
    opacity: 0.6;
    color: var(--text-light);
}

body.dark .notification-time {
    color: var(--text-dark);
}

.notification-empty {
    padding: 2rem 1.5rem;
    text-align: center;
    opacity: 0.7;
}

.notification-empty svg {
    width: 40px;
    height: 40px;
    fill: var(--text-light);
    opacity: 0.5;
    margin-bottom: 1rem;
}

body.dark .notification-empty svg {
    fill: var(--text-dark);
}

.notification-empty p {
    margin: 0;
    color: var(--text-light);
}

body.dark .notification-empty p {
    color: var(--text-dark);
}

/* Notification Type Indicators */
.notification-item[data-type="course"] .notification-title::before {
    content: '📚 ';
}

.notification-item[data-type="reminder"] .notification-title::before {
    content: '⏰ ';
}

.notification-item[data-type="achievement"] .notification-title::before {
    content: '🏆 ';
}

.notification-item[data-type="forum"] .notification-title::before {
    content: '💬 ';
}

.notification-item[data-type="info"] .notification-title::before {
    content: 'ℹ️ ';
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .notifications-dropdown {
        position: fixed;
        top: 80px;
        left: 1rem;
        right: 1rem;
        width: auto;
        max-height: 60vh;
    }
    
    .notification-bell,
    .profile-icon {
        width: 36px;
        height: 36px;
        border-width: 1px;
    }
    
    .notification-bell svg,
    .profile-icon svg {
        width: 18px;
        height: 18px;
    }
    
    .mark-all-read {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
}

/* Notification Toast */
.notification-toast {
    position: fixed;
    top: 100px;
    right: 20px;
    background: var(--card-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    cursor: pointer;
    border-left: 4px solid var(--primary);
    color: var(--text-light);
}

.notification-toast strong {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.notification-toast p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-light);
    opacity: 0.9;
}

body.dark .notification-toast {
    background: var(--card-dark);
    border-color: var(--border-dark);
}

body.dark .notification-toast strong,
body.dark .notification-toast p {
    color: var(--text-dark);
}

@media (max-width: 768px) {
    .notification-toast {
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Mobile Menu for Dashboard */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1002;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--primary);
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .nav {
        padding: 0 1rem;
    }

    .nav-left {
        gap: 1rem;
    }

    .nav-right {
        gap: 0.5rem;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--bg-light);
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem;
        gap: 2rem;
        transition: left 0.3s ease;
        z-index: 999;
    }

    body.dark .nav-links {
        background: var(--bg-dark);
    }

    .nav-links.active {
        left: 0;
    }

    .nav-link {
        font-size: 1.1rem;
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-light);
        width: 100%;
        text-align: center;
    }

    body.dark .nav-link {
        border-bottom-color: var(--border-dark);
    }
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px 2rem 2rem;
    min-height: 100vh;
}

/* Page Sections */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* Welcome Section */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-light);
    border: 1px solid var(--border-light);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

body.dark .welcome-section {
    background: var(--card-dark);
    border-color: var(--border-dark);
}

@keyframes pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

.welcome-content {
    position: relative;
    z-index: 2;
}

.welcome-content h1 {
    font-size: 1.7rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 0.3rem 0;
}

.welcome-content p {
    font-size: 0.95rem;
    opacity: 0.7;
    margin: 0;
}

.welcome-section::before {
    display: none;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--gradient-card);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Add dark theme for stat cards */
body.dark .stat-card {
    background: linear-gradient(135deg, var(--card-dark), var(--bg-dark));
    border-color: var(--border-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

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

/* Dark theme hover effect */
body.dark .stat-card:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.stat-card:hover::before {
    transform: scaleY(1);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(74, 108, 247, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

/* Dark theme for stat icons */
body.dark .stat-icon {
    background: rgba(74, 108, 247, 0.2);
    color: var(--primary);
}

.stat-card:hover .stat-icon {
    background: var(--gradient-primary);
    color: white;
    transform: scale(1.1);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--light-text);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Dark theme for stat labels */
body.dark .stat-label {
    color: var(--text-dark);
    opacity: 0.8;
}

.stat-change {
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Course Filters */
.course-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--card-light);
    border: 2px solid var(--border-light);
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: inherit;
    font-weight: 500;
}

body.dark .filter-btn {
    background: var(--card-dark);
    border-color: var(--border-dark);
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2.5rem;
}

.course-card {
    background: var(--card-light);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s ease;
    cursor: pointer;
    border: 1px solid var(--border-light);
}

body.dark .course-card {
    background: var(--card-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: var(--border-dark);
}

.course-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.course-image {
    width: 100%;
    height: 220px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.course-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.course-card:hover .course-image::before {
    opacity: 0.6;
}

.course-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    color: white;
    z-index: 2;
    transition: transform 0.3s ease;
}

.course-card:hover .course-icon {
    transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
}

.course-difficulty {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 3;
}

.course-content {
    padding: 2rem;
}

.course-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--primary);
    line-height: 1.3;
}

.course-description {
    opacity: 0.8;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    opacity: 0.7;
    margin-bottom: 1.5rem;
}

.course-progress {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    margin: 1rem 0;
    overflow: hidden;
}

body.dark .course-progress {
    background: var(--border-dark);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 4px;
    transition: width 0.8s ease;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

/* Video Section */
.video-section {
    background: var(--card-light);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

body.dark .video-section {
    background: var(--card-dark);
    border-color: var(--border-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.video-player {
    background: #000;
    aspect-ratio: 16/9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
}

.play-btn {
    background: var(--primary);
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.video-progress {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.video-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.1s ease;
}

.video-time {
    font-size: 0.9rem;
    font-weight: 500;
}

.lesson-info {
    padding: 2rem;
}

.lesson-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.lesson-subtitle {
    opacity: 0.8;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.lesson-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

.btn:hover::before {
    left: 100%;
}

.btn.success {
    background: var(--success);
}

.btn.success:hover {
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

/* Leaderboard */
.leaderboard-container {
    background: var(--card-light);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

body.dark .leaderboard-container {
    background: var(--card-dark);
    border-color: var(--border-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background: var(--bg-light);
    border-radius: 15px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    position: relative;
}

body.dark .leaderboard-item {
    background: var(--bg-dark);
    border-color: var(--border-dark);
}

.leaderboard-item:hover {
    transform: translateX(5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.current-user {
    background: linear-gradient(45deg, var(--primary), var(--accent));
    color: white;
    border: none;
}

.leaderboard-item.current-user::before {
    content: '👑';
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    font-size: 1.2rem;
}

.rank {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    margin-right: 1.5rem;
}

.rank.gold {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
}

.rank.silver {
    background: linear-gradient(45deg, #c0c0c0, #e5e7eb);
    color: #333;
}

.rank.bronze {
    background: linear-gradient(45deg, #cd7f32, #f59e0b);
    color: white;
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-stats {
    opacity: 0.8;
    font-size: 0.9rem;
}

.user-points {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--secondary);
}

.leaderboard-item.current-user .user-points {
    color: white;
}

/* Badges */
.badges-section {
    margin-top: 3rem;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.badge {
    background: var(--card-light);
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid var(--border-light);
    cursor: pointer;
}

body.dark .badge {
    background: var(--card-dark);
    border-color: var(--border-dark);
}

.badge:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.badge.earned {
    background: linear-gradient(45deg, var(--secondary), var(--accent));
    color: white;
    border: none;
}

.badge-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    display: block;
}

.badge-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.badge.locked {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
    margin-top: 2rem;
}

.profile-card {
    background: var(--card-light);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
}

.profile-card h4 {
    font-size: 1.15rem;
}

body.dark .profile-card {
    background: var(--card-dark);
    border-color: var(--border-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.profile-avatar {
    width: 120px;
    height: 120px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
    margin: 0 auto 2rem;
    position: relative;
}

.profile-avatar::after {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    border-radius: 50%;
    z-index: -1;
    opacity: 0.3;
    animation: profileGlow 2s ease-in-out infinite;
}

@keyframes profileGlow {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.profile-info h3 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.profile-info p {
    text-align: center;
    opacity: 0.7;
    margin-bottom: 2rem;
}

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

.profile-stat {
    text-align: center;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1px solid var(--border-light);
}

body.dark .profile-stat {
    background: var(--bg-dark);
    border-color: var(--border-dark);
}

.profile-stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary);
    display: block;
}

.profile-stat-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Success Animation */
.success-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, var(--primary), var(--accent));
    color: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    z-index: 10000;
    animation: bounceIn 0.6s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

@keyframes bounceIn {
    0% { transform: translate(-50%, -50%) scale(0); }
    60% { transform: translate(-50%, -50%) scale(1.2); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Responsive Design */
@media (max-width: 1200px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .welcome-content h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 0.3rem 0;
}

    .welcome-content p {
    font-size: 0.75rem;
    opacity: 0.7;
    margin: 0;
    }

    * {
        max-width: 100%;
        box-sizing: border-box;
    }

     .page {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .nav {
        padding: 0 1rem;
        flex-wrap: nowrap;
    }

    .nav-links {
        position: fixed;
        top: 80px;
        right: -100%;
        width: 100%;
        height: calc(100vh - 80px);
        background: var(--bg-light);
        flex-direction: column;
        justify-content: flex-start;
        padding: 1rem;
        gap: 2rem;
        transition: right 0.3s ease;
        z-index: 999;
    }

    body.dark .nav-links {
        background: var(--bg-dark);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-light);
        z-index: -1;
    }

    body.dark .nav-links::before {
        background: var(--bg-dark);
    }

    .nav-link {
        font-size: 1rem;
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-light);
        width: 100%;
        text-align: center;
    }

    body.dark .nav-link {
        border-bottom-color: var(--border-dark);
    }

    .theme-toggle, .logout-btn {
        margin-top: 0.5rem;
        width: auto;
        align-self: center;
    }

    .container {
        padding: 120px 1rem 2rem;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .welcome-section {
        padding: 2rem;
    }

    .welcome-section h1 {
        font-size: 2rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .stat-card {
        padding: 1.5rem;
        min-width: 0;
    }

    .stat-icon {
        font-size: 1.8rem;
    }

    .stat-value {
        font-size: 2rem;
    }

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

    .course-filters {
        justify-content: center;
    }

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

    .section-header {
        flex-direction: column;
        text-align: center;
    }

    .certificate {
        padding: 2rem;
        margin: 1rem;
    }

    .certificate h2 {
        font-size: 2rem;
    }

    .certificate-name {
        font-size: 1.5rem;
    }

    .certificate-course {
        font-size: 1.2rem;
    }

    .lesson-actions {
        flex-direction: column;
    }

    .badges-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }

  .profile-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        width: 100%;
    }

    .profile-card {
        padding: 1.5rem;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .profile-card [style*="font-size: 1.5rem"] {
        font-size: 1rem !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        line-height: 1.3;
    }

    .profile-card h4 {
        font-size: 1rem;
        margin-bottom: 0.8rem !important;
    }

    .profile-stats {
        grid-template-columns: 1fr 1fr;
        gap: 0.8rem;
    }

    .profile-stat {
        padding: 0.8rem;
        min-width: 0;
    }

    .profile-stat-value {
        font-size: 1.4rem;
    }

    .profile-card:first-child {
        order: 2; 
    }

    .profile-card:last-child {
        order: 1;
    }

      .profile-avatar {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
        margin: 0 auto 1.5rem;
    }

    /* Profile Info Text Sizing */
    .profile-info h3 {
        font-size: 1.2rem;
    }

    .profile-info p {
        font-size: 0.9rem;
    }


    /* Fix Leaderboard on Mobile */
    .leaderboard-container {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: visible;
    }

    .leaderboard-item {
        padding: 1rem;
        flex-wrap: wrap;
        justify-content: space-between;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .rank {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-right: 1rem;
        flex-shrink: 0;
    }

    .user-info {
        flex: 1;
        min-width: 0;
        margin-right: 1rem;
    }

    .user-name {
        font-size: 1rem;
        margin-bottom: 0.2rem;
        word-wrap: break-word;
    }

    .user-stats {
        font-size: 0.8rem;
        word-wrap: break-word;
    }

    .user-points {
        font-size: 1.1rem;
        flex-shrink: 0;
        text-align: right;
    }

    /* Ensure all grids respect mobile width */
    .badges-section {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .stats-grid,
    .course-grid,
    .badges-grid {
        width: 100%;
        max-width: 100%;
    }

    .badges-grid {
         grid-template-columns: repeat(2, 1fr) !important;
      
    }
    }

/* Utility Classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(99, 102, 241, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

       /* Quick Access Section */
        .quick-access-section {
            margin-bottom: 3rem;
        }

        .quick-access-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.5rem;
            margin-top: 1.5rem;
        }

        .quick-access-card {
            background: var(--card-light);
            border-radius: 16px;
            padding: 1.5rem;
            border: 1px solid var(--border-light);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

            body.dark .quick-access-card {
            background: var(--card-dark);
            border-color: var(--border-dark);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        }

        .quick-access-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        }

        .quick-access-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(45deg, var(--primary), var(--accent));
        }

        .qa-header {
            display: flex;
            justify-content: space-between;
            align-items: start;
            margin-bottom: 1rem;
        }

        .qa-icon {
            font-size: 2rem;
            margin-bottom: 0.5rem;
        }

        .qa-badge {
            background: linear-gradient(45deg, var(--primary), var(--accent));
            color: white;
            padding: 0.25rem 0.6rem;
            border-radius: 12px;
            font-size: 0.7rem;
            font-weight: 600;
        }

        .qa-title {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 0.5rem;
        }

        .qa-description {
            font-size: 0.85rem;
            opacity: 0.7;
            line-height: 1.4;
        }

        .qa-meta {
            margin-top: 1rem;
            font-size: 0.8rem;
            opacity: 0.6;
        }

        /* Onboarding Guide */
        .onboarding-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            z-index: 10000;
            align-items: center;
            justify-content: center;
        }

        .onboarding-overlay.active {
            display: flex;
        }

        .onboarding-card {
            background: var(--card-light);
            border-radius: 20px;
            padding: 2.5rem;
            max-width: 500px;
            width: 90%;
            position: relative;
            animation: slideUp 0.4s ease;
        }

        body.dark .onboarding-card {
            background: var(--card-dark);
        }

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

        .onboarding-icon {
            font-size: 2rem;
            text-align: center;
            margin-bottom: 1rem;
        }

        .onboarding-title {
            font-size: 1.4rem;
            font-weight: 600;
            color: var(--primary);
            text-align: center;
            margin-bottom: 1rem;
        }

        .onboarding-content {
            opacity: 0.8;
            line-height: 1.6;
            margin-bottom: 1.5rem;
        }

        .onboarding-steps {
            list-style: none;
            padding: 0;
        }

        .onboarding-steps li {
            padding: 0.6rem 0;
            padding-left: 2rem;
            position: relative;
        }

        .onboarding-steps li::before {
            content: '✓';
            position: absolute;
            left: 0;
            color: var(--success);
            font-weight: bold;
            font-size: 1.2rem;
        }

        .onboarding-progress {
            display: flex;
            justify-content: center;
            gap: 0.5rem;
            margin: 1.5rem 0;
        }

        .onboarding-dot {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--border-light);
            transition: all 0.3s ease;
        }

        body.dark .onboarding-dot {
            background: var(--border-dark);
        }

        .onboarding-dot.active {
            background: var(--primary);
            width: 30px;
            border-radius: 5px;
        }

        .onboarding-actions {
            display: flex;
            gap: 1rem;
            justify-content: space-between;
        }

        .onboarding-btn {
            flex: 1;
            padding: 0.85rem;
            border: none;
            border-radius: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .onboarding-btn-primary {
            background: linear-gradient(45deg, var(--primary), var(--accent));
            color: white;
        }

        .onboarding-btn-secondary {
            background: transparent;
            border: 2px solid var(--primary);
            color: var(--primary);
        }

        .onboarding-btn:hover {
            transform: translateY(-2px);
        }

        /* Activity Feed */
        .activity-section {
            margin-top: 3rem;
        }

        .activity-feed {
            background: var(--card-light);
            border-radius: 16px;
            padding: 2rem;
            border: 1px solid var(--border-light);
        }

        body.dark .activity-feed {
            background: var(--card-dark);
            border-color: var(--border-dark);
        }

        .activity-item {
            display: flex;
            gap: 1rem;
            padding: 1rem 0;
            border-bottom: 1px solid var(--border-light);
        }

        body.dark .activity-item {
            border-bottom-color: var(--border-dark);
        }

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

        .activity-icon {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(45deg, var(--primary), var(--accent));
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 1.2rem;
            flex-shrink: 0;
        }

        .activity-content {
            flex: 1;
        }

        .activity-title {
            font-weight: 600;
            margin-bottom: 0.25rem;
        }

        .activity-description {
            font-size: 0.9rem;
            opacity: 0.7;
        }

        .activity-time {
            font-size: 0.8rem;
            opacity: 0.5;
            margin-top: 0.25rem;
        }

/* Badges Styles */
.badges-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.badge-preview {
    padding: 1rem;
    border-radius: 12px;
    text-align: center;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.badge-preview:hover {
    transform: translateY(-2px);
}

.badge-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.badge-name {
    font-size: 0.8rem;
    display: block;
}

.badge.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.badge.earned {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

        /* Help Button */
        .help-button {
            position: fixed;
            bottom: 2rem;
            right: 2rem;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: linear-gradient(45deg, var(--primary), var(--accent));
            color: white;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
            transition: all 0.3s ease;
            z-index: 1000;
        }

        .help-button:hover {
            transform: scale(1.1);
            box-shadow: 0 8px 30px rgba(99, 102, 241, 0.6);
        }

        @media (max-width: 768px) {
            .quick-access-grid {
                grid-template-columns: 1fr;
            }

            .onboarding-card {
                padding: 2rem;
            }

            .help-button {
                width: 50px;
                height: 50px;
                bottom: 1rem;
                right: 1rem;
            }

            .activity-section {
                margin-top: 2rem;
            }
        }
