:root {
    --lms-primary: #4f46e5;
    --lms-primary-dark: #4338ca;
    --lms-primary-rgb: 79, 70, 229;
    --lms-sidebar-bg: #111827;
    --lms-sidebar-text: #9ca3af;
    --lms-sidebar-active: #4f46e5;
    --lms-bg: #f3f4f6;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--lms-bg);
    min-height: 100vh;
}

/* ---------- Auth pages ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #7c3aed 100%);
    padding: 1.5rem;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    border: 0;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.auth-logo {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 1rem;
}
.auth-tabs .nav-link {
    border-radius: 0.5rem;
    font-weight: 600;
}
.auth-tabs .nav-link.active {
    background: var(--lms-primary);
    color: #fff;
}

/* ---------- Dashboard layout ---------- */
.lms-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    background: var(--lms-sidebar-bg);
    color: var(--lms-sidebar-text);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease;
    overflow-y: auto;
}
.lms-sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.lms-sidebar .sidebar-brand img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 0.6rem;
}
.lms-sidebar .sidebar-brand span {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}
.lms-sidebar .sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}
.lms-sidebar .nav-section {
    padding: 0.75rem 1.5rem 0.35rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}
.lms-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.5rem;
    color: var(--lms-sidebar-text);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
}
.lms-sidebar .nav-link i {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
}
.lms-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}
.lms-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.35), transparent);
    border-left-color: var(--lms-sidebar-active);
}
.lms-main {
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease;
}
.lms-topbar {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.6rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.lms-content {
    flex: 1;
    padding: 1.5rem;
}
.lms-footer {
    padding: 1rem 1.5rem;
    color: #6b7280;
    font-size: 0.85rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
}
@media (max-width: 991.98px) {
    .lms-sidebar {
        transform: translateX(-100%);
    }
    .lms-sidebar.open {
        transform: translateX(0);
    }
    .lms-main {
        margin-left: 0;
    }
    .sidebar-backdrop.show {
        display: block;
    }
}

/* ---------- Cards & utilities ---------- */
.card {
    border: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-radius: 0.75rem;
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #eef0f3;
    font-weight: 600;
}
.stat-card {
    border-radius: 0.9rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card .stat-icon {
    position: absolute;
    right: -12px;
    bottom: -12px;
    font-size: 4.5rem;
    opacity: 0.22;
}
.bg-gradient-primary { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.bg-gradient-success { background: linear-gradient(135deg, #059669, #10b981); }
.bg-gradient-info { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.bg-gradient-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.bg-gradient-danger { background: linear-gradient(135deg, #dc2626, #ef4444); }
.bg-gradient-secondary { background: linear-gradient(135deg, #4b5563, #6b7280); }

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.avatar-lg { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}
.table thead th {
    background: #f9fafb;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.badge {
    font-weight: 600;
    padding: 0.4em 0.7em;
}

.file-type-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* ---------- Material cards ---------- */
.material-card .material-thumb {
    height: 140px;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--lms-primary);
    border-radius: 0.6rem;
    margin-bottom: 0.9rem;
}

/* ---------- Public website ---------- */
.site-navbar {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.site-hero {
    background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%);
    color: #fff;
    padding: 5rem 0;
}
.site-footer {
    background: #111827;
    color: #9ca3af;
}
.site-footer a {
    color: #d1d5db;
    text-decoration: none;
}
.site-footer a:hover {
    color: #fff;
}

/* ---------- Notifications ---------- */
.notification-item {
    display: flex;
    gap: 0.9rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f0f1f3;
    text-decoration: none;
    color: inherit;
}
.notification-item:hover {
    background: #f9fafb;
}
.notification-item.unread {
    background: #eef2ff;
}
.notification-item .notif-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* ---------- Viewer ---------- */
.viewer-frame {
    border: 0;
    width: 100%;
    height: 70vh;
    background: #fff;
    border-radius: 0.5rem;
}

/* ---------- Misc ---------- */
.cursor-pointer { cursor: pointer; }
.min-h-100 { min-height: 100vh; }
.required::after {
    content: '*';
    color: #dc2626;
    margin-left: 2px;
}
.dropdown-notifications {
    max-height: 380px;
    overflow-y: auto;
}
[data-tooltip] { position: relative; }

.list-group-item-action:hover {
    background: #f8f9fa;
}

.login-role-btn {
    border-radius: 0.75rem;
    transition: transform 0.15s ease;
}
.login-role-btn:hover {
    transform: translateY(-2px);
}

.prose {
    line-height: 1.75;
}
.prose img { max-width: 100%; border-radius: 0.5rem; }
