/* ============================================================
   Wonderful Writers LMS — Premium Design System v2.0
   Glass-morphism | Dark/Light Mode | Animations | Inter Font
   ============================================================ */

/* ---- CSS CUSTOM PROPERTIES — LIGHT MODE ---- */
:root {
    --primary:          #1e3a5f;
    --primary-light:    #2563EB;
    --primary-glow:     rgba(37,99,235,0.18);
    --accent:           #c9a84c;
    --accent-light:     rgba(201,168,76,0.15);
    --success:          #16a34a;
    --danger:           #dc2626;
    --warning:          #d97706;
    --info:             #0891b2;
    --purple:           #7c3aed;

    --text:             #1f2937;
    --text-muted:       #6b7280;
    --text-light:       #9ca3af;

    --bg:               #f0f4f8;
    --bg-card:          #ffffff;
    --bg-card2:         #f8fafc;
    --bg-sidebar:       linear-gradient(180deg, #1e3a5f 0%, #152d4a 100%);
    --border:           #e5e7eb;
    --border-light:     rgba(0,0,0,0.06);

    --sidebar-width:    260px;
    --topbar-height:    64px;
    --radius:           12px;
    --radius-lg:        16px;
    --radius-xl:        24px;
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
    --shadow:           0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-lg:        0 10px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.07);
    --shadow-xl:        0 20px 60px rgba(0,0,0,0.18);

    --glass-bg:         rgba(255,255,255,0.7);
    --glass-border:     rgba(255,255,255,0.5);
    --glass-blur:       12px;

    --transition:       0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:  0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- DARK MODE ---- */
[data-theme="dark"] {
    --primary:          #3b82f6;
    --primary-light:    #60a5fa;
    --primary-glow:     rgba(96,165,250,0.2);
    --accent:           #f59e0b;
    --text:             #f1f5f9;
    --text-muted:       #94a3b8;
    --text-light:       #64748b;
    --bg:               #0f172a;
    --bg-card:          #1e293b;
    --bg-card2:         #162032;
    --bg-sidebar:       linear-gradient(180deg, #0f172a 0%, #0a1628 100%);
    --border:           #334155;
    --border-light:     rgba(255,255,255,0.06);
    --glass-bg:         rgba(30,41,59,0.8);
    --glass-border:     rgba(255,255,255,0.08);
    --shadow:           0 4px 16px rgba(0,0,0,0.4), 0 2px 6px rgba(0,0,0,0.3);
    --shadow-lg:        0 10px 40px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);
}

/* ---- RESET & BASE ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition-slow), color var(--transition-slow);
}

a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }
img { max-width: 100%; }

/* ---- TYPOGRAPHY ---- */
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text); line-height: 1.3; }
.font-display { font-family: 'Space Grotesk', 'Inter', sans-serif; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ============================================================
   AUTH PAGES — PREMIUM GLASSMORPHISM
   ============================================================ */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1d4ed8 70%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(37,99,235,0.3) 0%, transparent 70%);
    top: -100px; right: -100px;
    pointer-events: none;
}
.auth-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(201,168,76,0.15) 0%, transparent 70%);
    bottom: -80px; left: -80px;
    pointer-events: none;
}

.auth-particles {
    position: absolute; inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.auth-particles span {
    position: absolute;
    display: block;
    width: 4px; height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 50%;
    animation: float-particle 8s infinite ease-in-out;
}
@keyframes float-particle {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.15; }
    50% { transform: translateY(-30px) rotate(180deg); opacity: 0.4; }
}

.auth-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 24px;
    padding: 44px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}
.auth-brand .brand-icon {
    width: 74px; height: 74px;
    background: linear-gradient(135deg, rgba(255,255,255,0.25), rgba(255,255,255,0.08));
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    font-size: 30px; color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.auth-brand h1 { font-size: 24px; font-weight: 700; color: #fff; }
.auth-brand p { color: rgba(255,255,255,0.65); font-size: 13px; margin-top: 4px; }

.auth-card .form-label { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 600; }
.auth-card .form-control {
    background: rgba(255,255,255,0.1);
    border: 1.5px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 10px;
}
.auth-card .form-control::placeholder { color: rgba(255,255,255,0.4); }
.auth-card .form-control:focus {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.4);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.1);
    color: #fff;
}
.auth-card .form-control option { background: #1e3a5f; color: #fff; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: rgba(255,255,255,0.4); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: rgba(255,255,255,0.15); }
.auth-card p a { color: rgba(255,255,255,0.9); font-weight: 600; }
.auth-card p { color: rgba(255,255,255,0.65); font-size: 14px; text-align: center; }
.auth-card .alert-danger { background: rgba(220,38,38,0.2); border-color: rgba(220,38,38,0.4); color: #fca5a5; }
.auth-demo-box { margin-top: 20px; padding: 14px 16px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; font-size: 12px; color: rgba(255,255,255,0.6); }
.auth-demo-box strong { color: rgba(255,255,255,0.85); display: block; margin-bottom: 6px; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.lms-layout { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-slow), width var(--transition);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.sidebar-brand .brand-logo {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, rgba(37,99,235,0.8), rgba(201,168,76,0.6));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,0.4);
    flex-shrink: 0;
}
.sidebar-brand .brand-text { color: #fff; min-width: 0; }
.sidebar-brand .brand-text strong { display: block; font-size: 14px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.sidebar-brand .brand-text span { font-size: 11px; opacity: 0.55; white-space: nowrap; }

.sidebar-nav { padding: 12px 0; flex: 1; overflow-y: auto; }
.nav-section-title {
    padding: 12px 18px 4px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.8px;
    color: rgba(255,255,255,0.35);
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 18px;
    color: rgba(255,255,255,0.65);
    font-size: 13.5px; font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    margin: 1px 8px 1px 0;
    position: relative;
}
.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    border-left-color: rgba(201,168,76,0.5);
}
.sidebar-nav .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(37,99,235,0.25), rgba(37,99,235,0.08));
    border-left-color: var(--accent);
    font-weight: 600;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; font-size: 15px; opacity: 0.85; }
.sidebar-nav .nav-link .badge-count {
    margin-left: auto;
    background: var(--accent);
    color: #fff; border-radius: 20px;
    padding: 2px 7px; font-size: 10px; font-weight: 700;
}

.sidebar-user {
    padding: 14px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.sidebar-user img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,0.2); }
.sidebar-user .user-info strong { display: block; color: #fff; font-size: 13px; line-height: 1.2; }
.sidebar-user .user-info span { color: rgba(255,255,255,0.5); font-size: 11px; }
.sidebar-user .logout-btn {
    margin-left: auto; background: rgba(255,255,255,0.1); border: none;
    color: rgba(255,255,255,0.6); width: 32px; height: 32px; border-radius: 8px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); flex-shrink: 0;
}
.sidebar-user .logout-btn:hover { background: rgba(220,38,38,0.3); color: #fff; }

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}

/* ---- TOPBAR ---- */
.topbar {
    height: var(--topbar-height);
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 999;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition-slow), border-color var(--transition-slow);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.sidebar-toggle {
    background: none; border: none;
    font-size: 18px; color: var(--text-muted); cursor: pointer;
    padding: 8px; border-radius: 8px;
    transition: all var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-search { position: relative; }
.topbar-search input {
    border: 1.5px solid var(--border); border-radius: 10px;
    padding: 8px 14px 8px 38px; font-size: 13px;
    width: 240px; background: var(--bg);
    color: var(--text); outline: none;
    transition: all var(--transition);
}
.topbar-search input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px var(--primary-glow); width: 280px; }
.topbar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }

/* Topbar icon buttons */
.topbar-btn {
    position: relative; background: var(--bg);
    border: 1.5px solid var(--border); width: 38px; height: 38px;
    border-radius: 10px; font-size: 15px; color: var(--text-muted);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.topbar-btn:hover { border-color: var(--primary-light); color: var(--primary-light); background: var(--primary-glow); }
.notif-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 18px; height: 18px;
    background: var(--danger); border-radius: 9px;
    font-size: 10px; color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-card);
    padding: 0 3px;
}

/* Theme Toggle */
.theme-toggle {
    width: 44px; height: 24px;
    background: var(--border); border-radius: 12px;
    border: none; cursor: pointer;
    position: relative; transition: background var(--transition);
}
.theme-toggle.active { background: var(--primary-light); }
.theme-toggle::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px;
    background: #fff; border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.theme-toggle.active::after { transform: translateX(20px); }

/* User Menu */
.user-menu { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 10px; border-radius: 10px; transition: background var(--transition); }
.user-menu:hover { background: var(--bg); }
.user-menu img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; border: 2px solid var(--border); }
.user-menu .user-info { display: none; }
.user-menu .user-info strong { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-menu .user-info span { font-size: 11px; color: var(--text-muted); }

/* ---- PAGE CONTENT ---- */
.page-content { padding: 24px; flex: 1; animation: fadeInUp 0.35s ease; }

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

.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 22px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.page-header p { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }
.page-header .header-actions { display: flex; gap: 10px; align-items: center; }

/* ============================================================
   CARDS — PREMIUM
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow var(--transition), border-color var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600; font-size: 14px;
    display: flex; align-items: center; justify-content: space-between;
    color: var(--text);
    background: var(--bg-card);
}
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-card2);
}

/* Glass Card */
.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

/* ============================================================
   STAT CARDS — PREMIUM
   ============================================================ */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 22px 20px;
    display: flex; align-items: center; gap: 16px;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    cursor: default;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 100px; height: 100px;
    border-radius: 50%;
    transform: translate(30px, -30px);
    opacity: 0.06;
    transition: opacity var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card:hover::before { opacity: 0.1; }

.stat-icon {
    width: 54px; height: 54px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}
.stat-icon.blue  { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: var(--primary-light); box-shadow: 0 4px 12px rgba(37,99,235,0.2); }
.stat-icon.green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: var(--success); box-shadow: 0 4px 12px rgba(22,163,74,0.2); }
.stat-icon.gold  { background: linear-gradient(135deg, #fef3c7, #fde68a); color: var(--warning); box-shadow: 0 4px 12px rgba(217,119,6,0.2); }
.stat-icon.red   { background: linear-gradient(135deg, #fee2e2, #fecaca); color: var(--danger); box-shadow: 0 4px 12px rgba(220,38,38,0.2); }
.stat-icon.teal  { background: linear-gradient(135deg, #cffafe, #a5f3fc); color: var(--info); box-shadow: 0 4px 12px rgba(8,145,178,0.2); }
.stat-icon.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: var(--purple); box-shadow: 0 4px 12px rgba(124,58,237,0.2); }

.stat-card::before { background: currentColor; }
.stat-card[class*="blue"]::before { background: #2563EB; }
.stat-card[class*="green"]::before { background: #16a34a; }

.stat-value { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; letter-spacing: -0.5px; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 11.5px; font-weight: 700; margin-top: 5px; display: flex; align-items: center; gap: 3px; }
.stat-change.up   { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   COURSE CARDS
   ============================================================ */
.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
    height: 100%;
    display: flex; flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; }
.course-thumbnail {
    height: 185px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    position: relative; overflow: hidden;
}
.course-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--transition-slow); }
.course-card:hover .course-thumbnail img { transform: scale(1.05); }
.course-thumbnail-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 52px; color: rgba(255,255,255,0.6);
}
.course-level-badge {
    position: absolute; top: 12px; left: 12px;
    background: rgba(255,255,255,0.95);
    color: var(--primary); font-size: 10.5px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px; text-transform: capitalize;
    letter-spacing: 0.3px;
}
.course-free-badge {
    position: absolute; top: 12px; right: 12px;
    background: var(--accent); color: #fff;
    font-size: 10.5px; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
}
.course-card-body { padding: 18px; flex: 1; }
.course-category { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.2px; color: var(--primary-light); margin-bottom: 7px; }
.course-title { font-size: 15.5px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.35; }
.course-title a { color: inherit; }
.course-desc { font-size: 13px; color: var(--text-muted); line-height: 1.55; margin-bottom: 14px; }
.course-meta { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.course-meta i { margin-right: 4px; }
.course-card-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card2);
}

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress {
    height: 8px; border-radius: 6px;
    background: var(--border);
    overflow: hidden; position: relative;
}
.progress-bar {
    height: 100%; border-radius: 6px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.progress-bar::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}
@keyframes shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(100%); }
}
.progress-bar-blue   { background: linear-gradient(90deg, #2563EB, #60a5fa); }
.progress-bar-green  { background: linear-gradient(90deg, #16a34a, #4ade80); }
.progress-bar-gold   { background: linear-gradient(90deg, #d97706, #f59e0b); }

/* ============================================================
   BADGES & PILLS
   ============================================================ */
.badge {
    font-size: 11px; font-weight: 600; padding: 4px 10px;
    border-radius: 20px; display: inline-flex; align-items: center; gap: 4px;
    letter-spacing: 0.2px; white-space: nowrap;
}
.badge-role-admin      { background: #fee2e2; color: #b91c1c; }
.badge-role-instructor { background: #dbeafe; color: #1d4ed8; }
.badge-role-student    { background: #d1fae5; color: #065f46; }
.badge-active, .badge-status-active     { background: #d1fae5; color: #065f46; }
.badge-inactive, .badge-status-inactive { background: #f3f4f6; color: #374151; }
.badge-draft, .badge-status-draft       { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dbeafe; color: #1d4ed8; }
.badge-danger    { background: #fee2e2; color: #b91c1c; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-info      { background: #cffafe; color: #155e75; }

/* ============================================================
   TABLES — PREMIUM
   ============================================================ */
.table-responsive { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.lms-table { border-collapse: collapse; width: 100%; }
.lms-table th {
    background: var(--bg-card2);
    font-weight: 700; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.8px;
    color: var(--text-muted); padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.lms-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); font-size: 14px; }
.lms-table tbody tr { transition: background var(--transition); }
.lms-table tbody tr:hover { background: var(--bg); }
.lms-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   FORMS — PREMIUM
   ============================================================ */
.form-label { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; display: block; }
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: 10px; padding: 10px 14px;
    font-size: 14px; background: var(--bg-card);
    color: var(--text); width: 100%;
    transition: all var(--transition);
    font-family: inherit;
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-control::placeholder { color: var(--text-light); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }
.is-invalid { border-color: var(--danger) !important; }
.invalid-feedback { font-size: 12px; color: var(--danger); margin-top: 4px; }

textarea.form-control { resize: vertical; min-height: 100px; }

/* ============================================================
   BUTTONS — PREMIUM
   ============================================================ */
.btn {
    padding: 10px 20px; border-radius: 10px;
    font-size: 13.5px; font-weight: 600; border: none; cursor: pointer;
    transition: all var(--transition);
    display: inline-flex; align-items: center; gap: 7px;
    text-decoration: none; font-family: inherit;
    position: relative; overflow: hidden;
    white-space: nowrap;
}
.btn::after {
    content: '';
    position: absolute; inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition);
}
.btn:hover::after { background: rgba(255,255,255,0.1); }
.btn:active { transform: translateY(1px); }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-sm { padding: 6px 13px; font-size: 12px; border-radius: 8px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 12px; }
.btn-xl { padding: 16px 36px; font-size: 16px; font-weight: 700; border-radius: 14px; }

.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,0.35); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(37,99,235,0.45); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: linear-gradient(135deg, #16a34a, #22c55e); color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,0.3); }
.btn-success:hover { box-shadow: 0 6px 20px rgba(22,163,74,0.4); color: #fff; }
.btn-danger { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,0.3); }
.btn-danger:hover { box-shadow: 0 6px 20px rgba(220,38,38,0.4); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #d97706, #f59e0b); color: #fff; box-shadow: 0 4px 14px rgba(217,119,6,0.3); }
.btn-warning:hover { color: #fff; }
.btn-info { background: linear-gradient(135deg, #0891b2, #06b6d4); color: #fff; }
.btn-info:hover { color: #fff; }
.btn-purple { background: linear-gradient(135deg, #7c3aed, #8b5cf6); color: #fff; box-shadow: 0 4px 14px rgba(124,58,237,0.3); }
.btn-purple:hover { color: #fff; }
.btn-gold { background: linear-gradient(135deg, #b45309, var(--accent)); color: #fff; }
.btn-gold:hover { color: #fff; }

.btn-outline-primary { background: transparent; color: var(--primary-light); border: 1.5px solid var(--primary-light); }
.btn-outline-primary:hover { background: var(--primary-light); color: #fff; }
.btn-outline-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-outline-success { background: transparent; color: var(--success); border: 1.5px solid var(--success); }
.btn-outline-success:hover { background: var(--success); color: #fff; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 14px 18px; border-radius: var(--radius);
    font-size: 14px; display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 16px; border-left: 4px solid transparent;
}
.alert-success { background: #d1fae5; color: #065f46; border-left-color: var(--success); }
.alert-danger  { background: #fee2e2; color: #b91c1c; border-left-color: var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left-color: var(--warning); }
.alert-info    { background: #dbeafe; color: #1e40af; border-left-color: var(--primary-light); }
.alert .btn-close {
    margin-left: auto; background: none; border: none;
    font-size: 18px; cursor: pointer; opacity: 0.6; color: inherit; line-height: 1;
}
.alert .btn-close:hover { opacity: 1; }

[data-theme="dark"] .alert-success { background: rgba(22,163,74,0.15); color: #86efac; }
[data-theme="dark"] .alert-danger  { background: rgba(220,38,38,0.15); color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: rgba(217,119,6,0.15); color: #fcd34d; }
[data-theme="dark"] .alert-info    { background: rgba(37,99,235,0.15); color: #93c5fd; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0; pointer-events: none;
    transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl); width: 100%;
    max-width: 600px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(24px) scale(0.97);
    transition: transform var(--transition);
    border: 1px solid var(--border);
}
.modal-overlay.active .modal-box { transform: translateY(0) scale(1); }
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-header h5 { font-weight: 700; font-size: 17px; }
.modal-close {
    background: var(--bg); border: 1.5px solid var(--border);
    width: 32px; height: 32px; border-radius: 8px;
    cursor: pointer; color: var(--text-muted); font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ============================================================
   NOTIFICATIONS DROPDOWN
   ============================================================ */
.notif-dropdown {
    position: absolute; right: 0; top: calc(100% + 12px);
    width: 360px; background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1050; display: none;
    overflow: hidden;
    animation: dropDown 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notif-dropdown.show { display: block; }
@keyframes dropDown {
    from { opacity: 0; transform: translateY(-10px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.notif-dropdown-header {
    padding: 15px 18px; border-bottom: 1px solid var(--border);
    font-weight: 700; font-size: 14px;
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-card2);
}
.notif-item {
    padding: 13px 18px; border-bottom: 1px solid var(--border);
    display: flex; gap: 12px; align-items: flex-start;
    transition: background var(--transition);
}
.notif-item:hover { background: var(--bg); }
.notif-item.unread { background: var(--primary-glow); }
.notif-item:last-child { border-bottom: none; }
.notif-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; font-size: 14px;
}
.notif-icon.info    { background: #dbeafe; color: var(--info); }
.notif-icon.success { background: #d1fae5; color: var(--success); }
.notif-icon.warning { background: #fef3c7; color: var(--warning); }
.notif-icon.danger  { background: #fee2e2; color: var(--danger); }
.notif-text strong { font-size: 13px; display: block; color: var(--text); }
.notif-text span { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   QUIZ STYLES
   ============================================================ */
.quiz-option {
    border: 2px solid var(--border);
    border-radius: 10px; padding: 13px 16px;
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 10px; background: var(--bg-card);
}
.quiz-option:hover { border-color: var(--primary-light); background: var(--primary-glow); }
.quiz-option.selected { border-color: var(--primary); background: var(--primary-glow); }
.quiz-option.correct  { border-color: var(--success); background: rgba(22,163,74,0.1); }
.quiz-option.wrong    { border-color: var(--danger); background: rgba(220,38,38,0.1); }
.quiz-option-label { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; transition: all var(--transition); }
.quiz-option.selected .quiz-option-label { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.quiz-option.correct .quiz-option-label  { background: var(--success); border-color: var(--success); color: #fff; }
.quiz-option.wrong .quiz-option-label    { background: var(--danger); border-color: var(--danger); color: #fff; }

.quiz-timer { font-size: 22px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.quiz-timer.warning { color: var(--warning); animation: pulse 1s infinite; }
.quiz-timer.danger  { color: var(--danger); animation: pulse 0.5s infinite; }

/* ============================================================
   LESSON LAYOUT
   ============================================================ */
.lesson-layout { display: flex; gap: 0; min-height: calc(100vh - var(--topbar-height)); }
.lesson-content-area { flex: 1; padding: 28px; overflow-y: auto; max-width: calc(100% - 300px); }
.lesson-sidebar {
    width: 300px; flex-shrink: 0;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    position: sticky; top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
}
.lesson-sidebar-section { border-bottom: 1px solid var(--border); }
.lesson-sidebar-section-title {
    padding: 13px 18px; font-weight: 700; font-size: 13px;
    background: var(--bg-card2); color: var(--text);
    display: flex; align-items: center; justify-content: space-between; cursor: pointer;
    transition: background var(--transition);
}
.lesson-sidebar-section-title:hover { background: var(--bg); }
.lesson-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 18px; font-size: 13px; color: var(--text);
    border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background var(--transition);
}
.lesson-item:hover { background: var(--bg); }
.lesson-item.active { background: var(--primary-glow); color: var(--primary-light); font-weight: 600; }
.lesson-item.completed { color: var(--success); }
.lesson-item .check-icon { color: var(--success); font-size: 14px; margin-left: auto; }

/* ============================================================
   BREADCRUMB
   ============================================================ */
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; flex-wrap: wrap; }
.breadcrumb a { color: var(--primary-light); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .separator { color: var(--border); }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: block; }
.avatar-xs  { width: 28px; height: 28px; }
.avatar-sm  { width: 36px; height: 36px; }
.avatar-md  { width: 48px; height: 48px; }
.avatar-lg  { width: 72px; height: 72px; }
.avatar-xl  { width: 96px; height: 96px; }
.avatar-xxl { width: 120px; height: 120px; }
.avatar-rounded { border-radius: 12px; }

/* ============================================================
   TABS
   ============================================================ */
.nav-tabs {
    border-bottom: 2px solid var(--border);
    display: flex; gap: 0; overflow-x: auto;
}
.nav-tabs .nav-tab {
    padding: 12px 18px; font-size: 14px; font-weight: 600;
    color: var(--text-muted); cursor: pointer;
    border-bottom: 2.5px solid transparent; margin-bottom: -2px;
    transition: all var(--transition); white-space: nowrap;
    display: flex; align-items: center; gap: 7px;
}
.nav-tabs .nav-tab:hover { color: var(--primary-light); }
.nav-tabs .nav-tab.active { color: var(--primary-light); border-bottom-color: var(--primary-light); }
.tab-content .tab-pane { display: none; padding: 20px 0; }
.tab-content .tab-pane.active { display: block; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    width: 80px; height: 80px;
    background: var(--bg); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px; font-size: 32px; color: var(--text-light);
}
.empty-state h4 { font-size: 18px; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ============================================================
   GAMIFICATION / BADGES
   ============================================================ */
.achievement-badge {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; padding: 16px; text-align: center;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); transition: all var(--transition);
}
.achievement-badge:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.achievement-badge.earned { border-color: var(--accent); background: var(--accent-light); }
.achievement-badge.locked { opacity: 0.5; filter: grayscale(1); }
.badge-icon { width: 64px; height: 64px; border-radius: 50%; font-size: 28px; display: flex; align-items: center; justify-content: center; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.fade-in  { animation: fadeIn 0.35s ease; }
.spin     { animation: spin 0.8s linear infinite; }
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeletonLoad 1.5s infinite;
    border-radius: 6px;
}
@keyframes skeletonLoad { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ============================================================
   FORUM / DISCUSSION
   ============================================================ */
.discussion-post {
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: var(--radius-lg); padding: 18px;
    margin-bottom: 14px; transition: border-color var(--transition);
}
.discussion-post:hover { border-color: var(--primary-light); }
.post-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.post-content { font-size: 14px; color: var(--text); line-height: 1.65; }
.post-actions { display: flex; gap: 12px; margin-top: 12px; }
.post-action-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 13px;
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px; border-radius: 6px; transition: all var(--transition);
}
.post-action-btn:hover { background: var(--bg); color: var(--primary-light); }

/* ============================================================
   CERTIFICATE
   ============================================================ */
.cert-preview {
    background: linear-gradient(135deg, #fdfcfb 0%, #f0e6d3 100%);
    border: 10px solid var(--primary);
    border-radius: 4px;
    padding: 50px;
    text-align: center;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.cert-preview::before {
    content: '';
    position: absolute; inset: 12px;
    border: 2px solid var(--accent);
    pointer-events: none;
    border-radius: 2px;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-primary  { color: var(--primary-light) !important; }
.text-muted    { color: var(--text-muted) !important; }
.text-success  { color: var(--success) !important; }
.text-danger   { color: var(--danger) !important; }
.text-warning  { color: var(--warning) !important; }
.text-info     { color: var(--info) !important; }
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-sm       { font-size: 13px !important; }
.text-xs       { font-size: 11px !important; }

.bg-primary    { background: var(--primary-light) !important; }
.bg-success    { background: var(--success) !important; }
.bg-danger     { background: var(--danger) !important; }
.bg-light      { background: var(--bg) !important; }
.bg-card       { background: var(--bg-card) !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.d-flex  { display: flex; }
.d-grid  { display: grid; }
.d-none  { display: none; }
.d-block { display: block; }
.d-inline-flex { display: inline-flex; }

.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }
.gap-4  { gap: 4px; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.mb-6 { margin-bottom: 32px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.ms-auto { margin-left: auto; }

.p-0 { padding: 0 !important; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 24px; }

.w-100  { width: 100%; }
.rounded { border-radius: var(--radius); }
.rounded-full { border-radius: 50%; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Separator tag */
.pill-divider { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; margin: 16px 0; }
.pill-divider::before, .pill-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .main-content { margin-left: 0; }
    .lesson-layout { flex-direction: column; }
    .lesson-content-area { max-width: 100%; }
    .lesson-sidebar { width: 100%; height: auto; position: static; border-left: none; border-top: 1px solid var(--border); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .topbar-search { display: none; }
    .page-content { padding: 16px; }
    .auth-card { padding: 28px 24px; }
    .notif-dropdown { right: -60px; width: 310px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .user-menu .user-info { display: none; }
}
@media (max-width: 576px) {
    :root { --topbar-height: 56px; }
    .page-header h2 { font-size: 18px; }
    .stat-value { font-size: 24px; }
    .auth-card { border-radius: 16px; padding: 24px 20px; }
    .modal-box { border-radius: var(--radius-lg); }
}

/* ============================================================
   DARK MODE OVERRIDES
   ============================================================ */
[data-theme="dark"] .lms-table th { background: var(--bg-card2); }
[data-theme="dark"] .sidebar-nav .nav-link.active { background: linear-gradient(90deg, rgba(59,130,246,0.2), rgba(59,130,246,0.08)); }
[data-theme="dark"] .badge-role-admin      { background: rgba(220,38,38,0.2); color: #fca5a5; }
[data-theme="dark"] .badge-role-instructor { background: rgba(37,99,235,0.2); color: #93c5fd; }
[data-theme="dark"] .badge-role-student    { background: rgba(22,163,74,0.2); color: #86efac; }
[data-theme="dark"] .badge-active, [data-theme="dark"] .badge-status-active { background: rgba(22,163,74,0.2); color: #86efac; }
[data-theme="dark"] .badge-inactive, [data-theme="dark"] .badge-status-inactive { background: rgba(100,116,139,0.2); color: #94a3b8; }
[data-theme="dark"] .badge-draft, [data-theme="dark"] .badge-status-draft { background: rgba(217,119,6,0.2); color: #fcd34d; }
[data-theme="dark"] .quiz-option { border-color: var(--border); }
[data-theme="dark"] .quiz-option:hover { background: var(--primary-glow); }
[data-theme="dark"] .btn-secondary { background: var(--bg-card2); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .course-card-footer { background: var(--bg-card2); }
[data-theme="dark"] .stat-icon.blue  { background: rgba(37,99,235,0.15); }
[data-theme="dark"] .stat-icon.green { background: rgba(22,163,74,0.15); }
[data-theme="dark"] .stat-icon.gold  { background: rgba(217,119,6,0.15); }
[data-theme="dark"] .stat-icon.red   { background: rgba(220,38,38,0.15); }
[data-theme="dark"] .stat-icon.teal  { background: rgba(8,145,178,0.15); }
[data-theme="dark"] .stat-icon.purple { background: rgba(124,58,237,0.15); }
[data-theme="dark"] .empty-state .empty-icon { background: var(--bg-card2); }
[data-theme="dark"] .card-glass { background: rgba(30,41,59,0.7); border-color: rgba(255,255,255,0.08); }
[data-theme="dark"] .topbar { background: rgba(15,23,42,0.9); border-color: var(--border); }
