/* LMS Pro — Main Stylesheet */
* { box-sizing: border-box; }
body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: #f5f7fb;
    color: #2d3748;
    margin: 0;
}

.lms-app {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 270px;
    background: #fff;
    border-right: 1px solid #e6e9f0;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    overflow-y: auto;
    z-index: 1040;
    transition: transform .3s ease, width .3s ease;
    display: flex;
    flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.sidebar-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f0f2f7;
    display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; text-decoration: none; color: inherit; gap: .7rem; }
.brand-icon {
    width: 38px; height: 38px;
    background: var(--gradient);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.3rem;
}
.brand-text { font-weight: 700; font-size: 1.1rem; color: #2d3748; }

.sidebar-user {
    padding: 1.25rem 1.5rem;
    display: flex; align-items: center; gap: .8rem;
    background: linear-gradient(135deg, var(--primary-light), transparent);
    margin: 0;
}
.user-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem;
}
.user-name { font-weight: 600; font-size: .95rem; }
.user-role { font-size: .78rem; color: #718096; }

.sidebar-nav { padding: .75rem; flex: 1; }
.nav-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #a0aec0;
    padding: 1rem 1rem .5rem;
    font-weight: 700;
}
.nav-item {
    display: flex; align-items: center;
    gap: .8rem;
    padding: .65rem 1rem;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    font-size: .92rem;
    margin-bottom: 2px;
    transition: all .2s;
}
.nav-item i { font-size: 1.15rem; width: 22px; text-align: center; }
.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-item.active {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 6px 16px rgba(113,65,177,.25);
}

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1030;
}

/* Collapsed mode */
.lms-app.sidebar-collapsed .sidebar { width: 78px; }
.lms-app.sidebar-collapsed .brand-text,
.lms-app.sidebar-collapsed .user-info,
.lms-app.sidebar-collapsed .nav-item span,
.lms-app.sidebar-collapsed .nav-section-title { display: none; }
.lms-app.sidebar-collapsed .nav-item { justify-content: center; }
.lms-app.sidebar-collapsed .main-content { margin-left: 78px; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 270px;
    display: flex; flex-direction: column;
    min-height: 100vh;
    transition: margin-left .3s ease;
}

/* ===== TOPBAR ===== */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e6e9f0;
    padding: .75rem 1.5rem;
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 1020;
}
.sidebar-toggle-btn {
    background: transparent; border: none; font-size: 1.4rem;
    color: #4a5568; cursor: pointer; padding: .25rem .5rem;
    border-radius: 6px;
}
.sidebar-toggle-btn:hover { background: #f0f2f7; color: var(--primary); }

.search-box {
    flex: 1; max-width: 460px;
    position: relative;
}
.search-box i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: #a0aec0;
}
.search-box input {
    width: 100%;
    padding: .55rem 1rem .55rem 2.5rem;
    background: #f5f7fb;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: .9rem;
    outline: none;
}
.search-box input:focus { border-color: var(--primary); background: #fff; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.topbar-btn {
    background: transparent; border: none;
    width: 42px; height: 42px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #4a5568; font-size: 1.15rem;
    cursor: pointer; position: relative;
    transition: all .2s;
}
.topbar-btn:hover { background: var(--primary-light); color: var(--primary); }
.topbar-btn.user-btn { width: auto; padding: .35rem .75rem; }

.badge-dot {
    position: absolute; top: 4px; right: 4px;
    background: #ef4444; color: #fff;
    font-size: .65rem; font-weight: 700;
    min-width: 18px; height: 18px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    padding: 0 5px;
}

.user-avatar-sm {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .85rem;
}

.topbar-dropdown { position: relative; }
.notification-dropdown { width: 360px; padding: 0; max-height: 480px; overflow-y: auto; border: none; box-shadow: 0 20px 50px rgba(0,0,0,.15); border-radius: 14px; }
.notification-dropdown .dropdown-header { padding: 1rem 1.25rem; border-bottom: 1px solid #f0f2f7; }
.notification-list { max-height: 320px; overflow-y: auto; }
.notification-list .notif-item {
    padding: .85rem 1.25rem;
    display: flex; gap: .8rem;
    border-bottom: 1px solid #f0f2f7;
    text-decoration: none; color: inherit;
    transition: background .15s;
}
.notification-list .notif-item:hover { background: #f5f7fb; }
.notification-list .notif-item.unread { background: var(--primary-light); }
.notif-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: .88rem; }
.notif-text { color: #718096; font-size: .8rem; }
.notif-time { font-size: .72rem; color: #a0aec0; margin-top: 2px; }
.dropdown-item-footer { display: block; text-align: center; padding: .75rem; background: #f5f7fb; color: var(--primary); text-decoration: none; font-weight: 600; font-size: .85rem; }

/* ===== THEME PICKER ===== */
.theme-picker {
    position: fixed;
    top: 80px; right: -320px;
    width: 280px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0,0,0,.15);
    padding: 1.5rem;
    z-index: 1050;
    transition: right .3s ease;
}
.theme-picker.show { right: 20px; }
.theme-option {
    display: flex; align-items: center; gap: 1rem;
    padding: .75rem; border-radius: 10px;
    text-decoration: none; color: inherit;
    margin-bottom: .35rem;
    border: 1px solid transparent;
}
.theme-option:hover { background: #f5f7fb; border-color: #e6e9f0; }
.theme-swatches { display: flex; gap: 4px; }
.theme-swatches span { width: 20px; height: 20px; border-radius: 50%; }

/* ===== CONTENT AREA ===== */
.content-area {
    padding: 1.75rem;
    flex: 1;
}

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-title { font-size: 1.6rem; font-weight: 700; margin: 0; color: #1a202c; }
.page-subtitle { color: #718096; font-size: .9rem; margin: .25rem 0 0; }

/* ===== CARDS ===== */
.card { border: 1px solid #e6e9f0; border-radius: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.03); }
.card-header { background: #fff; border-bottom: 1px solid #f0f2f7; padding: 1rem 1.25rem; font-weight: 600; }

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid #e6e9f0;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(0,0,0,.06); }
.stat-card .stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-light); color: var(--primary);
    font-size: 1.4rem;
}
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; margin: .5rem 0 0; color: #1a202c; }
.stat-card .stat-label { font-size: .85rem; color: #718096; }
.stat-card .stat-change { font-size: .8rem; }
.stat-card .stat-change.up { color: #16a34a; }
.stat-card .stat-change.down { color: #dc2626; }

.gradient-card {
    background: var(--gradient);
    color: #fff;
    border-radius: 14px;
    padding: 1.5rem;
}
.gradient-card .stat-value { color: #fff; }
.gradient-card .stat-label { color: rgba(255,255,255,.85); }

/* ===== BUTTONS ===== */
.btn { font-weight: 500; border-radius: 8px; padding: .5rem 1.1rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: color-mix(in srgb, var(--primary) 85%, black); border-color: color-mix(in srgb, var(--primary) 85%, black); }
.btn-secondary-custom { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.btn-secondary-custom:hover { color: #fff; background: color-mix(in srgb, var(--secondary) 85%, black); }
.btn-gradient { background: var(--gradient); color: #fff; border: none; }
.btn-gradient:hover { color: #fff; opacity: .9; }
.text-primary-c { color: var(--primary) !important; }
.bg-primary-c { background: var(--primary) !important; color: #fff; }
.bg-gradient-c { background: var(--gradient) !important; color: #fff; }

/* ===== TABLES ===== */
.table { color: #2d3748; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: #718096; font-weight: 600; border-bottom: 2px solid #e6e9f0; padding: .9rem .75rem; background: #f9fafc; }
.table tbody td { padding: .9rem .75rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--primary-light); }

/* ===== FORMS ===== */
.form-control, .form-select { border-radius: 8px; border: 1px solid #cbd5e0; padding: .55rem .85rem; font-size: .92rem; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 .2rem rgba(113,65,177,.15); }
.form-label { font-weight: 500; font-size: .88rem; color: #4a5568; margin-bottom: .35rem; }

/* ===== BADGES ===== */
.badge { font-weight: 500; padding: .35rem .65rem; border-radius: 6px; font-size: .75rem; }
.badge-primary-c { background: var(--primary-light); color: var(--primary); }

/* ===== PROGRESS ===== */
.progress { height: 8px; background: #f0f2f7; border-radius: 99px; }
.progress-bar { background: var(--gradient); border-radius: 99px; }

/* ===== FOOTER ===== */
.lms-footer {
    background: #fff;
    border-top: 1px solid #e6e9f0;
    padding: 1rem 1.75rem;
    display: flex; justify-content: space-between; align-items: center;
    font-size: .85rem; color: #718096;
}
.lms-footer a { color: var(--primary); text-decoration: none; }

/* ===== AUTH PAGES ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7141b1, #3f9ec5);
    padding: 1rem;
}
.auth-card {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 70px rgba(0,0,0,.2);
    overflow: hidden;
    max-width: 900px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-illustration {
    background: linear-gradient(135deg, #7141b1, #3f9ec5);
    color: #fff;
    padding: 3rem;
    display: flex; flex-direction: column; justify-content: center;
}
.auth-form-side { padding: 3rem; }

/* ===== COURSE CARDS ===== */
.course-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e6e9f0;
    overflow: hidden;
    transition: all .25s;
    height: 100%;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.08); }
.course-thumb { height: 160px; background: var(--gradient); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 2.5rem; }
.course-body { padding: 1.1rem; }
.course-cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--primary); font-weight: 600; }
.course-title { font-weight: 600; font-size: 1.05rem; margin: .35rem 0; color: #1a202c; }
.course-meta { display: flex; justify-content: space-between; font-size: .82rem; color: #718096; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid #f0f2f7; }

/* ===== CHAT ===== */
.chat-container { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 180px); background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid #e6e9f0; }
.chat-list { border-right: 1px solid #f0f2f7; overflow-y: auto; }
.chat-item { padding: 1rem; border-bottom: 1px solid #f0f2f7; cursor: pointer; display: flex; gap: .7rem; transition: background .15s; }
.chat-item:hover, .chat-item.active { background: var(--primary-light); }
.chat-messages { padding: 1rem 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; }
.msg-bubble { max-width: 70%; padding: .65rem 1rem; border-radius: 14px; word-wrap: break-word; }
.msg-bubble.sent { align-self: flex-end; background: var(--gradient); color: #fff; }
.msg-bubble.received { background: #f0f2f7; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-backdrop.show { display: block; }
}
