:root {
    --primary: #7c3aed;
    --primary-dark: #5b21b6;
    --primary-light: #a78bfa;
    --primary-50: #f5f3ff;
    --secondary: #10b981;
    --dark: #1f2937;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 14px rgba(124,58,237,0.4);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;
    --transition: all 0.3s ease;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--gray-50); color: var(--dark); line-height: 1.6; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1.5rem; border-radius: var(--radius-lg); font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: var(--transition); text-decoration: none; border: none; }
.btn-primary { background: var(--gradient-primary); color: var(--white); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-primary); }
.btn-outline { background: transparent; border: 2px solid var(--gray-200); color: var(--dark); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 10000; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 1rem 1.5rem; border-radius: var(--radius-lg); color: white; font-weight: 500; animation: slideIn 0.3s ease; }
.toast.success { background: #10b981; }
.toast.error { background: #ef4444; }
.toast.info { background: #3b82f6; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================
   DARK MODE
   ============================================ */
body.dark-mode {
    --white: #1a1a2e;
    --gray-50: #16213e;
    --gray-100: #1a1a2e;
    --gray-200: #2a2a4a;
    --gray-300: #3a3a5a;
    --gray-400: #8888aa;
    --gray-500: #9999bb;
    --gray-600: #aaaacc;
    --gray-700: #ccccee;
    --dark: #ffffff;
    background: #0f0f1a;
    color: #e0e0e0;
}

body.dark-mode .sidebar {
    background: #1a1a2e;
    border-color: #2a2a4a;
}

body.dark-mode .main-content {
    background: #0f0f1a;
}

body.dark-mode .stat-card,
body.dark-mode .course-card,
body.dark-mode .profile-card,
body.dark-mode .card {
    background: #1a1a2e;
    border-color: #2a2a4a;
}

body.dark-mode .top-header {
    background: #1a1a2e;
    border-color: #2a2a4a;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #2a2a4a;
    border-color: #3a3a5a;
    color: #e0e0e0;
}

body.dark-mode .modal {
    background: #1a1a2e;
}

/* ============================================
   MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); position: fixed; z-index: 1000; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .courses-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .courses-grid { grid-template-columns: 1fr; }
    .top-header { padding: 1rem; }
    .page-title { font-size: 1.25rem; }
    .content-area { padding: 1rem; }
    .hero-section { padding: 2rem 1rem; }
    .hero-section h1 { font-size: 2rem; }
    .filter-tabs { flex-wrap: wrap; justify-content: center; }
    .filter-tab { padding: 0.5rem 1rem; font-size: 0.85rem; }
    .course-card { margin-bottom: 1rem; }
    .modal-content { margin: 1rem; max-height: 90vh; }
    .form-row { grid-template-columns: 1fr; }
    .btn { padding: 0.75rem 1rem; font-size: 0.9rem; }
    .profile-info { flex-direction: column; text-align: center; }
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
    .my-courses-header { flex-direction: column; gap: 1rem; }
    .courses-tabs { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .stats-grid { gap: 0.75rem; }
    .stat-card { padding: 1rem; }
    .stat-card h3 { font-size: 1.5rem; }
    .courses-tabs { flex-wrap: wrap; }
    .courses-tab { flex: 1; min-width: 80px; text-align: center; padding: 0.5rem; }
    .profile-stats { grid-template-columns: 1fr; }
    .btn-group { flex-direction: column; }
    .social-auth { grid-template-columns: 1fr; }
    .header-right .btn span { display: none; }
    .header-right .btn i { margin: 0; }
}

/* Mobile menu button */
.mobile-menu-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--dark); cursor: pointer; padding: 0.5rem; }
@media (max-width: 1024px) { .mobile-menu-btn { display: flex; } }

/* ============================================
   DARK MODE FIXES
   ============================================ */
body.dark-mode {
    background: #0f0f1a;
    color: #e0e0e0;
}

body.dark-mode .navbar {
    background: rgba(26, 26, 46, 0.95);
}

body.dark-mode .nav-link,
body.dark-mode .nav-logo .logo-text {
    color: #e0e0e0;
}

body.dark-mode .hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f0f1a 100%);
}

body.dark-mode .hero-title,
body.dark-mode .section-header h2,
body.dark-mode .feature-card h3,
body.dark-mode .pricing-card h3 {
    color: #ffffff;
}

body.dark-mode .hero-subtitle,
body.dark-mode .hero-badge,
body.dark-mode .section-header p,
body.dark-mode .feature-card p,
body.dark-mode .stat-item p {
    color: #b0b0c0;
}

body.dark-mode .features-section,
body.dark-mode .pricing-section {
    background: #1a1a2e;
}

body.dark-mode .feature-card,
body.dark-mode .pricing-card {
    background: #252542;
    border: 1px solid #3a3a5a;
}

body.dark-mode .pricing-features li {
    color: #c0c0d0;
}

body.dark-mode .stats-bar {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .btn-ghost {
    color: #e0e0e0;
    border-color: #4a4a6a;
}

body.dark-mode .btn-outline {
    color: #e0e0e0;
    border-color: #4a4a6a;
}

/* ============================================
   DARK MODE - DASHBOARD CARDS FIX
   ============================================ */
body.dark-mode .stat-card,
body.dark-mode .quick-action,
body.dark-mode .course-card,
body.dark-mode .enrolled-course-card,
body.dark-mode .quiz-card,
body.dark-mode .class-card,
body.dark-mode .assignment-card,
body.dark-mode .practical-card,
body.dark-mode .certificate-card,
body.dark-mode .settings-card,
body.dark-mode .profile-card,
body.dark-mode .card {
    background: #252542 !important;
    border: 1px solid #3a3a5a;
    color: #e0e0e0;
}

body.dark-mode .stat-card h3,
body.dark-mode .card h3,
body.dark-mode .card-title,
body.dark-mode .course-title,
body.dark-mode .enrolled-course-title {
    color: #ffffff !important;
}

body.dark-mode .stat-card p,
body.dark-mode .card p,
body.dark-mode .course-meta,
body.dark-mode .enrolled-course-meta {
    color: #b0b0c0 !important;
}

body.dark-mode .quick-action span {
    color: #e0e0e0 !important;
}

body.dark-mode .content-area {
    background: #0f0f1a;
}

body.dark-mode .welcome-card,
body.dark-mode .hero-section,
body.dark-mode .live-hero,
body.dark-mode .quiz-hero,
body.dark-mode .practical-hero {
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #a855f7 100%) !important;
}

body.dark-mode .courses-tabs,
body.dark-mode .filter-tabs {
    background: #252542;
}

body.dark-mode .courses-tab,
body.dark-mode .filter-tab {
    color: #b0b0c0;
}

body.dark-mode .courses-tab.active,
body.dark-mode .filter-tab.active {
    background: #3a3a5a;
    color: #ffffff;
}

body.dark-mode .modal-content,
body.dark-mode .modal {
    background: #1a1a2e !important;
    border: 1px solid #3a3a5a;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #252542 !important;
    border-color: #3a3a5a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .top-header {
    background: #1a1a2e;
    border-color: #3a3a5a;
}

body.dark-mode .page-title {
    color: #ffffff;
}

/* ============================================
   BETTER MOBILE RESPONSIVENESS
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
        width: 260px;
        height: 100vh;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .dashboard {
        display: block;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    
    .courses-grid {
        grid-template-columns: 1fr !important;
    }
    
    .quick-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem;
    }
    
    .content-area {
        padding: 1rem !important;
    }
    
    .welcome-card,
    .hero-section,
    .live-hero,
    .quiz-hero {
        padding: 1.5rem !important;
        border-radius: 1rem;
    }
    
    .welcome-card h2,
    .hero-section h2 {
        font-size: 1.5rem !important;
    }
    
    .top-header {
        padding: 0.75rem 1rem !important;
    }
    
    .page-title {
        font-size: 1.1rem !important;
    }
    
    .header-right .btn span {
        display: none;
    }
    
    .filter-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .filter-tab {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }
    
    .quick-actions {
        grid-template-columns: 1fr !important;
    }
    
    .welcome-card h2 {
        font-size: 1.25rem !important;
    }
    
    .btn {
        padding: 0.6rem 1rem !important;
        font-size: 0.85rem !important;
    }
    
    .course-card,
    .enrolled-course-card {
        margin-bottom: 1rem;
    }
}

/* Mobile menu button always visible on mobile */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    padding: 0.5rem;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex !important;
    }
}

body.dark-mode .mobile-menu-btn {
    color: #ffffff;
}

/* Quick Actions Dark Mode Fix */
body.dark-mode .quick-action {
    background: #252542 !important;
    border: 1px solid #3a3a5a !important;
}

body.dark-mode .quick-action span {
    color: #e0e0e0 !important;
}

body.dark-mode .quick-action:hover {
    background: #2f2f52 !important;
    border-color: var(--primary) !important;
}

/* ============================================
   QUICK ACTIONS DARK MODE - FINAL FIX
   ============================================ */
body.dark-mode .quick-actions .quick-action,
body.dark-mode .quick-action,
body.dark-mode .dashboard .quick-action {
    background: #252542 !important;
    border: 1px solid #3a3a5a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .quick-actions .quick-action span,
body.dark-mode .quick-action span {
    color: #e0e0e0 !important;
}

body.dark-mode .quick-actions .quick-action:hover,
body.dark-mode .quick-action:hover {
    background: #2f2f52 !important;
    border-color: var(--primary) !important;
    transform: translateY(-3px);
}

body.dark-mode .quick-actions .quick-action i,
body.dark-mode .quick-action i {
    color: var(--primary-light) !important;
}

/* ============================================
   QUICK ACTIONS DARK MODE - FINAL FIX
   ============================================ */
body.dark-mode .quick-actions .quick-action,
body.dark-mode .quick-action,
body.dark-mode .dashboard .quick-action {
    background: #252542 !important;
    border: 1px solid #3a3a5a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .quick-actions .quick-action span,
body.dark-mode .quick-action span {
    color: #e0e0e0 !important;
}

body.dark-mode .quick-actions .quick-action:hover,
body.dark-mode .quick-action:hover {
    background: #2f2f52 !important;
    border-color: var(--primary) !important;
    transform: translateY(-3px);
}

body.dark-mode .quick-actions .quick-action i,
body.dark-mode .quick-action i {
    color: var(--primary-light) !important;
}

/* ============================================
   CERTIFICATE MODAL
   ============================================ */
.cert-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 1rem;
}

.cert-modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.cert-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--gray-100);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--gray-600);
    transition: var(--transition);
}

.cert-modal-close:hover {
    background: var(--gray-200);
    color: var(--dark);
}

body.dark-mode .cert-modal {
    background: #1e1e38;
}

body.dark-mode .cert-modal-close {
    background: #3a3a5a;
    color: #e0e0e0;
}

/* ============================================
   TOAST NOTIFICATIONS FIX
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 500;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.show {
    transform: translateX(0);
}

.toast.toast-success, .toast-success {
    background: #10b981;
}

.toast.toast-error, .toast-error {
    background: #ef4444;
}

.toast.toast-info, .toast-info {
    background: #3b82f6;
}

.toast.toast-warning, .toast-warning {
    background: #f59e0b;
}

/* Fix certificate card footer buttons */
.cert-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
}
.cert-footer .btn {
    font-size: 0.8rem;
    padding: 0.6rem 0.75rem;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    text-align: center;
}
.cert-footer .btn i {
    margin-right: 0.3rem;
}

/* Fix study material modal positioning */
.modal-overlay.show .modal {
    position: relative;
    margin: 2rem auto;
    max-height: 85vh;
    overflow-y: auto;
}
