/* ============================================================
   NetFive Academy LMS - Main Stylesheet
   ============================================================ */
:root {
    --navy:        #0d1b3e;
    --navy-dark:   #080f24;
    --orange:      #e85d04;
    --orange-dark: #c44d00;
    --teal:        #0077b6;
    --green:       #2a9d8f;
    --white:       #ffffff;
    --light-bg:    #f5f7fa;
    --sidebar-w:   260px;
    --header-h:    64px;
    --text:        #2d3748;
    --text-muted:  #718096;
    --border:      #e2e8f0;
    --shadow:      0 2px 12px rgba(0,0,0,.08);
    --radius:      10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', sans-serif; background: var(--light-bg); color: var(--text); font-size: 14px; }
a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--orange-dark); }
img { max-width: 100%; }
code { white-space: normal; overflow-wrap: anywhere; }

/* Auth Page */
.lms-auth-page { background: linear-gradient(135deg, var(--navy) 0%, var(--teal) 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.lms-auth-container { width: 100%; max-width: 420px; padding: 20px; }
.lms-auth-card { background: var(--white); border-radius: 16px; padding: 40px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.lms-auth-logo { text-align: center; margin-bottom: 28px; }
.lms-auth-logo h2 { font-size: 22px; font-weight: 700; color: var(--navy); margin-top: 8px; }
.lms-auth-logo h2 span { color: var(--orange); }
.lms-auth-logo p { font-size: 12px; margin-top: 2px; }
.lms-auth-footer { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.lms-demo-creds { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-icon .form-control { padding-left: 36px; }
.btn-lms-submit { background: var(--orange); border-color: var(--orange); font-weight: 600; padding: 10px; margin-top: 8px; }
.btn-lms-submit:hover { background: var(--orange-dark); border-color: var(--orange-dark); }

/* Layout */
.lms-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.lms-sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: var(--white);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform .3s;
    display: flex;
    flex-direction: column;
}
.lms-sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.lms-sidebar-brand img { width: 36px; height: 36px; object-fit: contain; }
.lms-sidebar-brand span { font-size: 15px; font-weight: 700; }
.lms-sidebar-brand span em { color: var(--orange); font-style: normal; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.sidebar-section { padding: 10px 20px 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.4); }
.sidebar-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px; color: rgba(255,255,255,.75);
    font-size: 13.5px; font-weight: 500;
    transition: background .2s, color .2s;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: var(--white); }
.sidebar-nav a.active { background: rgba(232,93,4,.15); color: var(--orange); border-left-color: var(--orange); }
.sidebar-nav a i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-badge { margin-left: auto; background: var(--orange); color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600; }

.lms-sidebar-user {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex; align-items: center; gap: 10px;
}
.lms-sidebar-user img, .lms-sidebar-user .avatar-placeholder {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    background: var(--orange); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.lms-sidebar-user .user-info small { display: block; font-size: 10px; color: rgba(255,255,255,.5); }
.lms-sidebar-user .user-info strong { font-size: 13px; }

/* Main Content */
.lms-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; }

/* Topbar */
.lms-topbar {
    height: var(--header-h);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky; top: 0; z-index: 900;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.lms-topbar .topbar-title { font-size: 17px; font-weight: 600; flex: 1; }
.lms-topbar .topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); cursor: pointer; position: relative;
    transition: background .2s;
    border: 1px solid var(--border);
    background: var(--white);
}
.topbar-icon-btn:hover { background: var(--light-bg); color: var(--text); }
.topbar-icon-btn .badge-dot {
    width: 8px; height: 8px; background: var(--orange);
    border-radius: 50%; position: absolute; top: 4px; right: 4px;
    border: 2px solid var(--white);
}
.topbar-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; cursor: pointer; }

/* Page Content */
.lms-content { padding: 28px; flex: 1; }

/* Stat Cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card {
    background: var(--white); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-icon.orange { background: rgba(232,93,4,.12); color: var(--orange); }
.stat-icon.teal   { background: rgba(0,119,182,.12);  color: var(--teal); }
.stat-icon.green  { background: rgba(42,157,143,.12); color: var(--green); }
.stat-icon.navy   { background: rgba(13,27,62,.12);   color: var(--navy); }
.stat-icon.purple { background: rgba(128,90,213,.12); color: #805ad5; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-change { font-size: 11px; margin-top: 4px; }
.stat-change.up   { color: var(--green); }
.stat-change.down { color: #e53e3e; }

/* Cards */
.lms-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.lms-card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.lms-card-header h5 { font-size: 15px; font-weight: 600; margin: 0; }
.lms-card-body { padding: 20px; }
.lms-card-body.p-0 { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lms-card-body > div[style*="overflow-x:auto"],
.lms-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tables */
.lms-table { width: 100%; border-collapse: collapse; }
.lms-table th { background: var(--light-bg); padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.lms-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.lms-table tr:last-child td { border-bottom: none; }
.lms-table tr:hover td { background: rgba(245,247,250,.7); }
.lms-table code { word-break: break-word; }

/* Badges */
.badge-role { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-admin    { background: rgba(128,90,213,.15); color: #805ad5; }
.badge-teacher  { background: rgba(0,119,182,.15);  color: var(--teal); }
.badge-student  { background: rgba(42,157,143,.15); color: var(--green); }
.badge-staff    { background: rgba(13,27,62,.12);   color: var(--navy); }

.badge-status { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-active    { background: rgba(42,157,143,.15);  color: var(--green); }
.badge-inactive  { background: rgba(113,128,150,.15); color: var(--text-muted); }
.badge-suspended { background: rgba(229,62,62,.15);   color: #e53e3e; }
.badge-published { background: rgba(42,157,143,.15);  color: var(--green); }
.badge-draft     { background: rgba(113,128,150,.15); color: var(--text-muted); }
.badge-completed { background: rgba(0,119,182,.15);   color: var(--teal); }
.badge-pending   { background: rgba(232,93,4,.15);    color: var(--orange); }

/* Course Cards */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.course-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.course-card:hover { transform: translateY(-4px); box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.course-thumb { height: 160px; background: linear-gradient(135deg, var(--navy), var(--teal)); display: flex; align-items: center; justify-content: center; font-size: 48px; color: rgba(255,255,255,.3); position: relative; overflow: hidden; }
.course-thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-thumb .course-level { position: absolute; top: 10px; right: 10px; background: var(--orange); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.course-info { padding: 16px; }
.course-info h6 { font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.course-info p  { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.course-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); margin-bottom: 12px; }
.course-meta span { display: flex; align-items: center; gap: 4px; }
.course-progress-bar { height: 4px; background: var(--border); border-radius: 2px; margin-bottom: 8px; }
.course-progress-bar .fill { height: 100%; background: var(--orange); border-radius: 2px; transition: width .5s; }
.course-footer { display: flex; align-items: center; justify-content: space-between; }
.course-price { font-size: 16px; font-weight: 700; color: var(--orange); }
.course-price.free { color: var(--green); }

/* Progress Ring */
.progress-ring-wrap { display: inline-flex; align-items: center; justify-content: center; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring-circle { transition: stroke-dashoffset .5s; }

/* Avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* Forms */
.lms-form .form-group { margin-bottom: 18px; }
.lms-form label { font-size: 13px; font-weight: 500; margin-bottom: 6px; display: block; }
.lms-form .form-control { border-radius: 8px; border: 1px solid var(--border); font-size: 13px; padding: 9px 12px; transition: border .2s; }
.lms-form .form-control:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,93,4,.12); outline: none; }
.lms-form textarea.form-control { resize: vertical; min-height: 100px; }

/* Buttons */
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; border-radius: 8px; }
.btn-orange:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.btn-navy   { background: var(--navy);   border-color: var(--navy);   color: #fff; border-radius: 8px; }
.btn-navy:hover { background: var(--navy-dark); color: #fff; }
.btn-icon { padding: 6px 10px; border-radius: 6px; }

/* Page Header */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.page-header h4 { font-size: 20px; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.breadcrumb-lms { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb-lms a { color: var(--text-muted); }
.breadcrumb-lms span { color: var(--text); }

/* Lesson Player */
.lesson-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; }
.lesson-player-area { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.lesson-video-wrap { background: #000; aspect-ratio: 16/9; }
.lesson-video-wrap iframe, .lesson-video-wrap video { width: 100%; height: 100%; border: 0; }
.lesson-content-body { padding: 24px; }
.lesson-list-panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lesson-list-header { padding: 14px 16px; background: var(--navy); color: #fff; font-weight: 600; font-size: 13px; }
.lesson-module { border-bottom: 1px solid var(--border); }
.lesson-module-title { padding: 12px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); background: var(--light-bg); cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.lesson-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; cursor: pointer; transition: background .2s; border-bottom: 1px solid rgba(226,232,240,.5); }
.lesson-item:hover { background: var(--light-bg); }
.lesson-item.active { background: rgba(232,93,4,.08); }
.lesson-item.completed .lesson-item-icon { color: var(--green); }
.lesson-item-icon { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.lesson-item.completed .lesson-item-icon { background: var(--green); border-color: var(--green); color: #fff; }
.lesson-item-info { flex: 1; }
.lesson-item-info small { display: block; font-size: 11px; color: var(--text-muted); }

/* Gradebook */
.grade-pill { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.grade-a { background: rgba(42,157,143,.15);  color: var(--green); }
.grade-b { background: rgba(0,119,182,.15);   color: var(--teal); }
.grade-c { background: rgba(232,93,4,.15);    color: var(--orange); }
.grade-d { background: rgba(229,62,62,.15);   color: #e53e3e; }
.grade-f { background: rgba(229,62,62,.15);   color: #e53e3e; }

/* Messages */
.message-page-header p { margin: 4px 0 0; font-size: 13px; color: var(--text-muted); }
.message-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.message-tab { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--white); color: var(--text); border: 1px solid var(--border); font-size: 13px; font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.message-tab:hover { color: var(--orange); border-color: rgba(232,93,4,.35); }
.message-tab.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.message-tab-count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: rgba(232,93,4,.12); color: var(--orange); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.message-tab.active .message-tab-count { background: rgba(255,255,255,.18); color: #fff; }
.message-layout { display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); height: calc(100vh - var(--header-h) - 112px); min-height: 560px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.message-list-panel { background: var(--white); overflow-y: auto; border-right: 1px solid var(--border); }
.message-list-header { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.message-list-header h6 { margin: 0; font-size: 14px; color: var(--navy); }
.message-thread-panel { min-width: 0; background: var(--white); display: flex; flex-direction: column; }
.message-item { display: flex; gap: 12px; padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .2s, box-shadow .2s; }
.message-item:hover { background: var(--light-bg); }
.message-item.active { background: rgba(232,93,4,.08); box-shadow: inset 3px 0 0 var(--orange); }
.message-item.unread .message-name, .message-item.unread .msg-subject { font-weight: 800; }
.message-avatar { flex-shrink: 0; background: var(--navy); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: 0; }
.message-item-main { min-width: 0; flex: 1; }
.message-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.message-name { min-width: 0; color: var(--text); font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-time { flex-shrink: 0; color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.message-item-meta { display: flex; align-items: center; gap: 6px; min-width: 0; margin-top: 4px; }
.message-role-badge { flex-shrink: 0; display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; background: #e2e8f0; color: #334155; }
.message-role-badge.role-admin { background: #fee2e2; color: #991b1b; }
.message-role-badge.role-teacher { background: #dbeafe; color: #1d4ed8; }
.message-role-badge.role-student { background: #dcfce7; color: #166534; }
.message-role-badge.role-staff { background: #fef3c7; color: #92400e; }
.message-role-badge.role-non_staff { background: #ede9fe; color: #6d28d9; }
.msg-subject { min-width: 0; color: #475569; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-preview { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-unread-count { flex-shrink: 0; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--orange); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.message-thread-header { padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--white); }
.message-thread-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.message-thread-title .avatar { width: 42px; height: 42px; }
.message-thread-subject { color: var(--navy); font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-thread-with { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 3px; color: var(--text-muted); font-size: 12px; }
.message-thread-action { margin-left: auto; flex-shrink: 0; }
.message-thread-body { flex: 1; padding: 22px; overflow-y: auto; background: linear-gradient(180deg, #fff 0%, #f8fafc 100%); }
.message-bubble { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.message-bubble.sent { flex-direction: row-reverse; }
.msg-bubble-content { background: #f1f5f9; color: var(--text); padding: 10px 14px; border-radius: 14px 14px 14px 4px; max-width: min(70%, 680px); font-size: 13px; line-height: 1.6; box-shadow: 0 1px 2px rgba(15,23,42,.05); overflow-wrap: anywhere; }
.message-bubble.sent .msg-bubble-content { background: var(--navy); color: #fff; border-radius: 14px 14px 4px 14px; }
.message-bubble-meta { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 4px; color: var(--text-muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.message-bubble.sent .message-bubble-meta { color: rgba(255,255,255,.72); }
.message-text { white-space: normal; }
.message-edited-note { margin-top: 5px; color: var(--text-muted); font-size: 10px; font-style: italic; }
.message-bubble.sent .message-edited-note { color: rgba(255,255,255,.7); }
.message-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; }
.message-actions form { margin: 0; }
.message-edit-panel { width: 100%; }
.message-edit-panel summary { display: inline-flex; align-items: center; gap: 5px; color: var(--orange); font-size: 11px; font-weight: 800; cursor: pointer; list-style: none; }
.message-edit-panel summary::-webkit-details-marker { display: none; }
.message-bubble.sent .message-edit-panel summary { color: #ffd7c2; }
.message-edit-form { display: grid; gap: 8px; margin-top: 8px; }
.message-edit-form textarea { width: 100%; min-height: 82px; resize: vertical; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; font-family: inherit; font-size: 13px; line-height: 1.5; }
.message-action-link { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: #dc2626; font-size: 11px; font-weight: 800; cursor: pointer; }
.message-bubble.sent .message-action-link { color: #fecaca; }
.message-compose-bar { padding: 14px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-end; background: var(--white); }
.message-compose-bar textarea { flex: 1; min-height: 44px; max-height: 120px; resize: vertical; border-radius: 10px; border: 1px solid var(--border); padding: 11px 12px; font-size: 13px; font-family: inherit; line-height: 1.5; }
.message-compose-bar textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,93,4,.12); }
.message-page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.message-page-header h4 { margin: 0; color: var(--navy); font-weight: 800; }
.message-compose-btn { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; box-shadow: 0 8px 18px rgba(232,93,4,.22); }
.message-layout { border: 0; border-radius: 12px; box-shadow: 0 16px 42px rgba(13,27,62,.12); }
.message-list-panel { background: #fbfdff; }
.message-list-header { min-height: 62px; }
.message-list-header h6 { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.message-list-header span { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.message-item { align-items: flex-start; color: var(--text); }
.message-item.active { background: #fff7ed; box-shadow: inset 4px 0 0 var(--orange); }
.message-item.unread { background: #fffaf5; }
.message-item .message-avatar, .message-thread-title .message-avatar { background: linear-gradient(135deg, var(--navy), var(--teal)); }
.message-thread-header { min-height: 74px; }
.message-thread-title > div:nth-child(2) { min-width: 0; flex: 1; }
.message-thread-action .btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; font-size: 12px; font-weight: 700; }
.message-thread-body { background: #f6f8fb; }
.message-bubble { align-items: flex-start; }
.message-bubble.sent .message-avatar { background: var(--orange); }
.msg-bubble-content { padding: 12px 14px; border: 1px solid #e5edf6; }
.message-bubble.sent .msg-bubble-content { background: #0d1b3e; border-color: #0d1b3e; }
.message-actions { opacity: .96; }
.message-edit-panel { width: auto; }
.message-edit-panel summary, .message-action-link { min-height: 28px; padding: 3px 7px; border-radius: 7px; }
.message-edit-panel summary:hover, .message-action-link:hover { background: rgba(15,23,42,.07); }
.message-bubble.sent .message-edit-panel summary:hover, .message-bubble.sent .message-action-link:hover { background: rgba(255,255,255,.12); }
.message-reply-form { display: flex; gap: 10px; flex: 1; align-items: flex-end; }
.message-reply-form .btn { width: 42px; height: 42px; flex-shrink: 0; border-radius: 10px; }
.message-compose-modal .modal-content { border: 0; border-radius: 12px; overflow: hidden; box-shadow: 0 18px 56px rgba(13,27,62,.28); }
.message-compose-modal .modal-header { background: var(--navy); color: #fff; border: 0; }
.message-compose-modal .modal-header .close { color: #fff; opacity: .9; text-shadow: none; }
.message-compose-modal .modal-title { font-size: 16px; font-weight: 800; }
.message-compose-modal .modal-footer { border-top: 1px solid var(--border); background: #f8fafc; }

/* Notifications dropdown */
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; background: var(--white); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.15); border: 1px solid var(--border); z-index: 9999; overflow: hidden; display: none; }
.notif-dropdown.show { display: block; }
.notif-dropdown-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-item:hover { background: var(--light-bg); }
.notif-item.unread { background: rgba(232,93,4,.04); }
.notif-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

/* Quiz */
.quiz-card { background: var(--white); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.quiz-option { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 2px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: border .2s, background .2s; }
.quiz-option:hover { border-color: var(--orange); background: rgba(232,93,4,.04); }
.quiz-option.selected { border-color: var(--orange); background: rgba(232,93,4,.08); }
.quiz-option.correct  { border-color: var(--green);  background: rgba(42,157,143,.1); }
.quiz-option.wrong    { border-color: #e53e3e;        background: rgba(229,62,62,.08); }
.quiz-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.quiz-timer { background: var(--navy); color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; }

/* Calendar / Timetable */
.timetable-grid { display: grid; grid-template-columns: 80px repeat(5,1fr); gap: 2px; }
.timetable-cell { padding: 8px; background: var(--white); border-radius: 6px; font-size: 11px; }
.timetable-cell.header { background: var(--navy); color: #fff; font-weight: 600; text-align: center; }
.timetable-event { background: rgba(232,93,4,.15); color: var(--orange); padding: 4px 6px; border-radius: 4px; font-size: 10px; margin-bottom: 2px; border-left: 2px solid var(--orange); }

/* Certificate */
.certificate-preview { border: 3px solid var(--orange); border-radius: 16px; padding: 40px; text-align: center; background: linear-gradient(135deg, #fff9f5, #fff); }
.certificate-preview h2 { color: var(--navy); font-size: 28px; font-weight: 700; }
.certificate-preview .cert-name { font-size: 22px; color: var(--orange); font-weight: 700; margin: 12px 0; }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state h6 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* Rich lesson content (Summernote output) */
.lesson-rich-content h1,.lesson-rich-content h2,.lesson-rich-content h3,
.lesson-rich-content h4,.lesson-rich-content h5,.lesson-rich-content h6 {
    font-weight: 700; margin-top: 1.4em; margin-bottom: .5em; color: var(--navy);
}
.lesson-rich-content h2 { font-size: 1.35em; }
.lesson-rich-content h3 { font-size: 1.15em; }
.lesson-rich-content p  { margin-bottom: .9em; }
.lesson-rich-content ul,.lesson-rich-content ol { padding-left: 1.6em; margin-bottom: .9em; }
.lesson-rich-content li { margin-bottom: .3em; }
.lesson-rich-content blockquote {
    border-left: 4px solid var(--orange); margin: 1em 0;
    padding: 10px 16px; background: #fff8f5; border-radius: 0 8px 8px 0;
    color: #4a5568; font-style: italic;
}
.lesson-rich-content pre, .lesson-rich-content code {
    font-family: 'Courier New', Courier, monospace; font-size: .88em;
    background: #1e293b; color: #e2e8f0; border-radius: 6px;
}
.lesson-rich-content pre { padding: 14px 18px; overflow-x: auto; margin-bottom: .9em; }
.lesson-rich-content code { padding: 2px 5px; }
.lesson-rich-content pre code { background: none; padding: 0; color: inherit; }
.lesson-rich-content table {
    width: 100%; border-collapse: collapse; margin-bottom: 1em; font-size: .93em;
}
.lesson-rich-content th,.lesson-rich-content td {
    border: 1px solid #e2e8f0; padding: 8px 12px; text-align: left;
}
.lesson-rich-content th { background: var(--navy); color: #fff; font-weight: 600; }
.lesson-rich-content tr:nth-child(even) td { background: #f8fafc; }
.lesson-rich-content img { max-width: 100%; height: auto; border-radius: 8px; margin: .5em 0; }
.lesson-rich-content a { color: var(--orange); text-decoration: underline; }
.lesson-rich-content hr { border: none; border-top: 2px solid #e2e8f0; margin: 1.5em 0; }

/* Responsive */
.lms-sidebar-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; padding: 4px; }

@media (max-width: 992px) {
    .lms-sidebar { transform: translateX(-100%); }
    .lms-sidebar.open { transform: translateX(0); }
    .lms-main { margin-left: 0; }
    .lms-sidebar-toggle { display: flex; }
    .lesson-layout { grid-template-columns: 1fr; }
    .message-layout { grid-template-columns: 1fr; height: auto; min-height: 0; }
    .message-list-panel { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--border); }
    .message-thread-panel { min-height: 520px; }
    .stat-cards { grid-template-columns: 1fr 1fr; }
    .lms-card-body .row > [class*="col-"] { margin-bottom: 12px; }
    .lms-card-body .row > [class*="col-"]:last-child { margin-bottom: 0; }
}
@media (max-width: 576px) {
    .lms-content { padding: 16px; }
    .stat-cards { grid-template-columns: 1fr; }
    .stat-cards[style] { grid-template-columns: 1fr !important; }
    .stat-card { padding: 16px; align-items: flex-start; }
    .stat-value { font-size: 21px; overflow-wrap: anywhere; }
    .course-grid { grid-template-columns: 1fr; }
    .lms-topbar { padding: 0 14px; }
    .lms-topbar .topbar-title { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .page-header { align-items: stretch; flex-direction: column; }
    .page-header > div[style*="display:flex"] { flex-direction: column; width: 100%; }
    .page-header .btn, .page-header button, .page-header a.btn { width: 100%; justify-content: center; }
    .lms-card { border-radius: 8px; }
    .lms-card-header { align-items: flex-start; flex-direction: column; gap: 6px; padding: 14px 16px; }
    .lms-card-body { padding: 16px; }
    .lms-table { min-width: 640px; }
    .lms-table th, .lms-table td { padding: 10px 12px; }
    div[style*="grid-template-columns:repeat(4,1fr)"],
    div[style*="grid-template-columns:repeat(7,1fr)"] { grid-template-columns: 1fr !important; }
    .lms-card-body.p-0 > div[style*="grid-template-columns:repeat(7,1fr)"] { min-width: 700px; }
    .lms-card-body.p-0 > div[style*="grid-template-columns:repeat(7,1fr)"] + div[style*="grid-template-columns:repeat(7,1fr)"] { min-width: 700px; }
    .modal-dialog { margin: 10px; }
    .modal-body, .modal-footer, .modal-header { padding-left: 16px; padding-right: 16px; }
    .modal-footer { align-items: stretch; flex-direction: column; }
    .modal-footer .btn { width: 100%; margin-left: 0 !important; }
    .btn-icon { min-width: 34px; }
    .message-tabs { gap: 6px; }
    .message-tab { padding: 8px 11px; }
    .message-list-header, .message-thread-header, .message-compose-bar { padding: 12px; }
    .message-page-header { align-items: flex-start; flex-direction: column; }
    .message-thread-title { align-items: flex-start; flex-wrap: wrap; }
    .message-thread-action { width: 100%; margin-left: 0; }
    .message-thread-body { padding: 14px 12px; }
    .msg-bubble-content { max-width: calc(100% - 46px); }
    .message-compose-bar { flex-wrap: wrap; }
    .message-reply-form { flex-wrap: wrap; }
    .message-compose-bar textarea { flex-basis: 100%; }
    .message-reply-form .btn { width: 100%; }
}
