/**
 * POS-LMS Unified Modern Design System
 * Clean, professional, accessible, high-performance styling for Admin, Guru, & Siswa portals
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Brand & Accent Colors */
    --lms-primary: #2563EB;
    --lms-primary-hover: #1D4ED8;
    --lms-primary-active: #1E40AF;
    --lms-primary-light: #EFF6FF;
    --lms-primary-rgb: 37, 99, 235;

    --lms-secondary: #475569;
    --lms-secondary-light: #F1F5F9;

    --lms-success: #10B981;
    --lms-success-hover: #059669;
    --lms-success-light: #ECFDF5;

    --lms-warning: #F59E0B;
    --lms-warning-hover: #D97706;
    --lms-warning-light: #FFFBEB;

    --lms-danger: #EF4444;
    --lms-danger-hover: #DC2626;
    --lms-danger-light: #FEF2F2;

    --lms-info: #0EA5E9;
    --lms-info-light: #F0F9FF;

    /* Neutrals & Surfaces */
    --lms-bg: #F8FAFC;
    --lms-surface: #FFFFFF;
    --lms-border: #E2E8F0;
    --lms-border-focus: #93C5FD;

    /* Typography Colors */
    --lms-text-heading: #0F172A;
    --lms-text-body: #334155;
    --lms-text-muted: #64748B;
    --lms-text-subtle: #94A3B8;

    /* Font stack */
    --lms-font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Border Radius */
    --lms-radius-xs: 4px;
    --lms-radius-sm: 8px;
    --lms-radius: 12px;
    --lms-radius-lg: 16px;
    --lms-radius-xl: 24px;
    --lms-radius-pill: 9999px;

    /* Elevation Shadows */
    --lms-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --lms-shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
    --lms-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --lms-shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --lms-shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

/* ==========================================================
   Global Base & Typography
   ========================================================== */
html, body {
    font-family: var(--lms-font-sans) !important;
    color: var(--lms-text-body);
    background-color: var(--lms-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--lms-font-sans) !important;
    font-weight: 700;
    color: var(--lms-text-heading);
    letter-spacing: -0.02em;
}

p, span, a, input, select, textarea, button, label, table {
    font-family: var(--lms-font-sans) !important;
}

a {
    color: var(--lms-primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: var(--lms-primary-hover);
}

/* ==========================================================
   Layout Containers & Content Area
   ========================================================== */
.main-panel {
    background-color: var(--lms-bg) !important;
    min-height: calc(100vh - 70px);
}

.content-wrapper {
    background: transparent !important;
    padding: 1.5rem 1.75rem !important;
}

@media (max-width: 991.98px) {
    /* Keep navbar on one row: brand (55px) + menu (rest) */
    .navbar {
        flex-wrap: nowrap !important;
    }
    .navbar .navbar-brand-wrapper {
        width: 55px !important;
        flex: 0 0 55px !important;
    }
    .navbar .navbar-menu-wrapper {
        width: auto !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }
    .page-body-wrapper:not(.full-page-wrapper) {
        padding-top: 60px !important;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem 0.75rem !important;
    }

    /* Full-width containers were designed for desktop gutters;
       shrink them on phones so content isn't squeezed. */
    .container-fluid.px-3,
    .container-fluid.px-4,
    .container-fluid.px-5 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* ---- Tables -> stacked cards on phones ----
       JS (lms-mobile-tables.js) stamps data-label from each column's <th>. */
    .table-responsive {
        overflow-x: visible;
    }
    .table-responsive .table {
        display: block;
    }
    .table-responsive .table thead {
        display: none;
    }
    .table-responsive .table tbody {
        display: block;
    }
    .table-responsive .table tbody tr {
        display: block;
        background: var(--lms-surface, #fff);
        border: 1px solid var(--lms-border, #E2E8F0);
        border-radius: var(--lms-radius, 12px);
        margin: 0.75rem;
        padding: 0.4rem 0.25rem;
        box-shadow: var(--lms-shadow-xs, 0 1px 2px rgba(15, 23, 42, 0.05));
    }
    .table-responsive .table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 0.75rem;
        border: none !important;
        padding: 0.4rem 0.9rem !important;
        text-align: right;
        font-size: 0.85rem;
        overflow-wrap: anywhere;
    }
    .table-responsive .table tbody td > * {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }
    .table-responsive .table tbody td,
    .table-responsive .table tbody td * {
        white-space: normal;
    }
    .table-responsive .table tbody td * {
        min-width: 0;
    }
    .table-responsive .table tbody td::before {
        content: attr(data-label);
        flex-shrink: 0;
        font-weight: 600;
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--lms-text-muted, #64748B);
        text-align: left;
    }
    .table-responsive .table tbody td[colspan] {
        display: block;
        text-align: center;
        padding: 1.5rem 0.9rem !important;
    }
    .table-responsive .table tbody td[colspan]::before {
        content: none;
    }

    /* DataTables chrome stacks cleanly too */
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        float: none;
        text-align: left;
        margin-bottom: 0.5rem;
    }
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
    }
    .dataTables_wrapper .dataTables_info,
    .dataTables_wrapper .dataTables_paginate {
        float: none;
        text-align: center;
    }
}

/* Page Header Banner */
.lms-page-header {
    background: linear-gradient(135deg, #1E3A8A 0%, #2563EB 60%, #3B82F6 100%);
    color: #FFFFFF;
    border-radius: var(--lms-radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    box-shadow: var(--lms-shadow-md);
    position: relative;
    overflow: hidden;
}

.lms-page-header::after {
    content: '';
    position: absolute;
    right: -20px;
    top: -20px;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.lms-page-header h1,
.lms-page-header h2,
.lms-page-header h3 {
    color: #FFFFFF !important;
    margin-bottom: 0.25rem;
}

.lms-page-header p {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0;
    font-size: 0.95rem;
}

.lms-page-header p.text-muted,
.lms-page-header small.text-muted,
.lms-page-header span.text-muted:not(.badge) {
    color: rgba(255, 255, 255, 0.85) !important;
}

.lms-page-header .breadcrumb {
    background: rgba(255, 255, 255, 0.15) !important;
    border-radius: 0.5rem;
    padding: 0.5rem 0.9rem;
    display: inline-flex;
}

.lms-page-header .breadcrumb-item,
.lms-page-header .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.85) !important;
}

.lms-page-header .breadcrumb-item.active,
.lms-page-header .breadcrumb-item.active.text-primary {
    color: #FFFFFF !important;
}

.lms-page-header .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.6);
}

.lms-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 0.5rem;
}

.lms-breadcrumb a {
    color: rgba(255, 255, 255, 0.9);
}

.lms-breadcrumb a:hover {
    color: #FFFFFF;
    text-decoration: underline;
}

.lms-page-header .btn-outline-secondary {
    color: #FFFFFF !important;
    border-color: rgba(255, 255, 255, 0.6) !important;
    background-color: rgba(255, 255, 255, 0.12) !important;
}

.lms-page-header .btn-outline-secondary:hover,
.lms-page-header .btn-outline-secondary:focus {
    color: #1E3A8A !important;
    border-color: #FFFFFF !important;
    background-color: #FFFFFF !important;
}

/* ==========================================================
   Modern Stat & KPI Cards
   ========================================================== */
.lms-stat-card {
    background: var(--lms-surface);
    border: 1px solid var(--lms-border);
    border-radius: var(--lms-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--lms-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.lms-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--lms-shadow-md);
    border-color: #CBD5E1;
}

.lms-stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--lms-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.lms-stat-icon.primary { background: var(--lms-primary-light); color: var(--lms-primary); }
.lms-stat-icon.success { background: var(--lms-success-light); color: var(--lms-success); }
.lms-stat-icon.warning { background: var(--lms-warning-light); color: var(--lms-warning); }
.lms-stat-icon.danger { background: var(--lms-danger-light); color: var(--lms-danger); }
.lms-stat-icon.info { background: var(--lms-info-light); color: var(--lms-info); }

.lms-stat-info {
    flex-grow: 1;
    margin-left: 1rem;
}

.lms-stat-label {
    font-size: 0.825rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--lms-text-muted);
    margin-bottom: 0.25rem;
}

.lms-stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--lms-text-heading);
    line-height: 1.2;
    margin-bottom: 0;
}

.lms-stat-desc {
    font-size: 0.775rem;
    color: var(--lms-text-subtle);
    margin-top: 0.25rem;
    margin-bottom: 0;
}

/* ==========================================================
   General Cards
   ========================================================== */
.card {
    background: var(--lms-surface);
    border: 1px solid var(--lms-border) !important;
    border-radius: var(--lms-radius) !important;
    box-shadow: var(--lms-shadow-sm) !important;
    transition: box-shadow 0.2s ease;
    margin-bottom: 1.5rem;
}

.card-header:not([class*="bg-"]) {
    background: transparent !important;
}

.card-header {
    border-bottom: 1px solid var(--lms-border) !important;
    padding: 1.25rem 1.5rem !important;
    font-weight: 700;
    color: var(--lms-text-heading);
}

.card-header[class*="bg-"] h1,
.card-header[class*="bg-"] h2,
.card-header[class*="bg-"] h3,
.card-header[class*="bg-"] h4,
.card-header[class*="bg-"] h5,
.card-header[class*="bg-"] h6,
.card-header[class*="bg-"] .h1,
.card-header[class*="bg-"] .h2,
.card-header[class*="bg-"] .h3,
.card-header[class*="bg-"] .h4,
.card-header[class*="bg-"] .h5,
.card-header[class*="bg-"] .h6 {
    color: inherit;
}

/* Headings inside text-white containers (colored banners) keep the
   inherited color instead of the global dark heading color. */
.text-white h1, .text-white h2, .text-white h3,
.text-white h4, .text-white h5, .text-white h6,
.text-white .h1, .text-white .h2, .text-white .h3,
.text-white .h4, .text-white .h5, .text-white .h6 {
    color: inherit;
}

.card-body {
    padding: 1.5rem !important;
}

.card-footer {
    background: transparent !important;
    border-top: 1px solid var(--lms-border) !important;
    padding: 1rem 1.5rem !important;
}

/* Action Quick Cards */
.lms-quick-card {
    background: var(--lms-surface);
    border: 1px solid var(--lms-border);
    border-radius: var(--lms-radius);
    padding: 1.25rem;
    text-align: center;
    transition: all 0.2s ease;
    display: block;
    color: var(--lms-text-body);
    box-shadow: var(--lms-shadow-xs);
    height: 100%;
}

.lms-quick-card:hover {
    border-color: var(--lms-primary);
    box-shadow: var(--lms-shadow);
    transform: translateY(-3px);
    color: var(--lms-primary);
}

.lms-quick-card i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: inline-block;
    color: var(--lms-primary);
}

.lms-quick-card .title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.lms-quick-card .desc {
    font-size: 0.8rem;
    color: var(--lms-text-muted);
}

/* ==========================================================
   Modern Tables
   ========================================================== */
.table-responsive {
    border-radius: var(--lms-radius);
    border: 1px solid var(--lms-border);
    background: var(--lms-surface);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0 !important;
    color: var(--lms-text-body);
    vertical-align: middle;
}

.table thead th {
    background-color: #F8FAFC !important;
    color: var(--lms-text-heading) !important;
    font-weight: 700 !important;
    font-size: 0.825rem !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.9rem 1rem !important;
    border-bottom: 1px solid var(--lms-border) !important;
    border-top: none !important;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.9rem 1rem !important;
    font-size: 0.875rem;
    border-top: 1px solid var(--lms-border) !important;
    border-bottom: none !important;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #F8FAFC !important;
}

/* ==========================================================
   Badges & Status Indicators
   ========================================================== */
.badge,
.lms-badge {
    padding: 0.35rem 0.65rem !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    border-radius: var(--lms-radius-pill) !important;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    letter-spacing: 0.02em;
}

.badge-success, .badge.bg-success, .lms-badge.success {
    background-color: var(--lms-success-light) !important;
    color: var(--lms-success-hover) !important;
}

.badge-primary, .badge.bg-primary, .lms-badge.primary {
    background-color: var(--lms-primary-light) !important;
    color: var(--lms-primary) !important;
}

.badge-warning, .badge.bg-warning, .lms-badge.warning {
    background-color: var(--lms-warning-light) !important;
    color: var(--lms-warning-hover) !important;
}

.badge-danger, .badge.bg-danger, .lms-badge.danger {
    background-color: var(--lms-danger-light) !important;
    color: var(--lms-danger-hover) !important;
}

.badge-info, .badge.bg-info, .lms-badge.info {
    background-color: var(--lms-info-light) !important;
    color: var(--lms-info) !important;
}

.badge-secondary, .badge.bg-secondary, .lms-badge.secondary {
    background-color: var(--lms-secondary-light) !important;
    color: var(--lms-secondary) !important;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    border-radius: var(--lms-radius-sm) !important;
    padding: 0.55rem 1.15rem !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.15s ease-in-out !important;
    box-shadow: var(--lms-shadow-xs);
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--lms-shadow-sm);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--lms-primary) !important;
    border-color: var(--lms-primary) !important;
    color: #FFFFFF !important;
}

.btn-primary:hover {
    background-color: var(--lms-primary-hover) !important;
    border-color: var(--lms-primary-hover) !important;
}

.btn-success {
    background-color: var(--lms-success) !important;
    border-color: var(--lms-success) !important;
    color: #FFFFFF !important;
}

.btn-success:hover {
    background-color: var(--lms-success-hover) !important;
    border-color: var(--lms-success-hover) !important;
}

.btn-danger {
    background-color: var(--lms-danger) !important;
    border-color: var(--lms-danger) !important;
    color: #FFFFFF !important;
}

.btn-danger:hover {
    background-color: var(--lms-danger-hover) !important;
    border-color: var(--lms-danger-hover) !important;
}

.btn-warning {
    background-color: var(--lms-warning) !important;
    border-color: var(--lms-warning) !important;
    color: #FFFFFF !important;
}

.btn-warning:hover {
    background-color: var(--lms-warning-hover) !important;
    border-color: var(--lms-warning-hover) !important;
}

.btn-sm {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.8rem !important;
}

.btn-lg {
    padding: 0.75rem 1.5rem !important;
    font-size: 1rem !important;
}

/* ==========================================================
   Forms & Inputs
   ========================================================== */
.form-control,
.form-select {
    border: 1px solid var(--lms-border) !important;
    border-radius: var(--lms-radius-sm) !important;
    padding: 0.625rem 0.875rem !important;
    font-size: 0.875rem !important;
    color: var(--lms-text-body) !important;
    background-color: var(--lms-surface) !important;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--lms-primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
    outline: none !important;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--lms-text-heading);
    margin-bottom: 0.4rem;
}

/* ==========================================================
   Empty States
   ========================================================== */
.lms-empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--lms-text-muted);
}

.lms-empty-state > i {
    font-size: 3rem;
    color: var(--lms-text-subtle);
    margin-bottom: 1rem;
    display: inline-block;
}

.lms-empty-state h5 {
    color: var(--lms-text-heading);
    margin-bottom: 0.5rem;
}

.lms-empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto 1.25rem auto;
}

/* ==========================================================
   Navbar & Top Header Refinement
   ========================================================== */
.navbar {
    background-color: #FFFFFF !important;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.05) !important;
    border-bottom: 1px solid var(--lms-border);
}

.navbar .navbar-brand-wrapper {
    background-color: #FFFFFF !important;
    border-right: 1px solid var(--lms-border) !important;
}

.navbar .navbar-menu-wrapper {
    background-color: #FFFFFF !important;
}

.navbar-brand img {
    height: 42px !important;
    width: auto !important;
}

/* Flex alignment for the full logo — no !important so the template's
   .sidebar-icon-only rule can still hide .brand-logo when minimized */
.navbar-brand-wrapper .brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================
   Sidebar Refinement
   ========================================================== */
.sidebar {
    background: #FFFFFF !important;
    border-right: 1px solid var(--lms-border);
}

.sidebar .nav .nav-item .nav-link {
    border-radius: var(--lms-radius-sm);
    margin: 0.2rem 0.75rem;
    padding: 0.65rem 1rem !important;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--lms-text-body) !important;
    transition: all 0.15s ease;
}

.sidebar .nav .nav-item .nav-link i.menu-icon {
    font-size: 1.15rem;
    color: var(--lms-text-muted);
    margin-right: 0.75rem;
    transition: color 0.15s ease;
}

.sidebar .nav .nav-item.active > .nav-link {
    background-color: var(--lms-primary-light) !important;
    color: var(--lms-primary) !important;
}

/* Hover must be visually distinct from .active so two nav items never
   appear simultaneously highlighted */
.sidebar .nav .nav-item .nav-link:hover {
    background-color: #F1F5F9 !important;
    color: var(--lms-text-heading, #0F172A) !important;
}

.sidebar .nav .nav-item.active > .nav-link i.menu-icon {
    color: var(--lms-primary) !important;
}
.sidebar .nav .nav-item .nav-link:hover i.menu-icon {
    color: var(--lms-text-heading, #0F172A) !important;
}

/* Active-state title & arrow must follow the link's accessible color,
   not the template's hard-coded white-on-dark assumption */
.sidebar .nav .nav-item.active > .nav-link .menu-title,
.sidebar .nav .nav-item.active > .nav-link .menu-arrow {
    color: var(--lms-primary) !important;
}
.sidebar .nav .nav-item .nav-link:hover .menu-title,
.sidebar .nav .nav-item .nav-link:hover .menu-arrow {
    color: var(--lms-text-heading, #0F172A) !important;
}

.sidebar .nav .nav-item .nav-link .menu-title {
    color: inherit;
    text-indent: 0 !important;
}

/* Kill the dark-template top borders between nav items */
.sidebar .nav .nav-item .nav-link {
    border-top: none !important;
}

/* Sub-menu (collapsed dropdowns): template ships white-on-dark rules */
.sidebar .nav.sub-menu {
    background: transparent !important;
}

.sidebar .nav.sub-menu .nav-item .nav-link {
    color: var(--lms-text-body) !important;
    border-top: none !important;
    padding: 0.55rem 1rem 0.55rem 2.6rem !important;
    font-weight: 500 !important;
    margin: 0.1rem 0.75rem !important;
    border-radius: var(--lms-radius-sm) !important;
}

.sidebar .nav.sub-menu .nav-item .nav-link:hover,
.sidebar .nav.sub-menu .nav-item .nav-link.active {
    color: var(--lms-primary) !important;
    background: var(--lms-primary-light) !important;
}

.sidebar .nav.sub-menu .nav-item .nav-link::before {
    border-color: var(--lms-text-subtle) !important;
    left: 1.5rem !important;
    margin-top: 14px !important;
}

.sidebar .nav.sub-menu .nav-item .nav-link:hover::before,
.sidebar .nav.sub-menu .nav-item .nav-link.active::before {
    border-color: var(--lms-primary) !important;
}

.sidebar .nav.sub-menu .nav-item::before {
    background: var(--lms-text-subtle) !important;
}

/* Force the design-system font everywhere template fonts 404 */
.sidebar,
.footer,
.navbar {
    font-family: var(--lms-font-sans) !important;
}

.sidebar .user-profile {
    padding: 1.5rem 1rem 1rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--lms-border);
    margin-bottom: 0.75rem;
}

.sidebar .user-profile .user-image img {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--lms-primary-light);
    box-shadow: var(--lms-shadow-sm);
}

.sidebar .user-profile .user-name {
    font-weight: 700;
    color: var(--lms-text-heading);
    margin-top: 0.75rem;
    font-size: 0.95rem;
}

.sidebar .user-profile .user-designation {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--lms-primary);
    background: var(--lms-primary-light);
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: var(--lms-radius-pill);
    margin-top: 0.25rem;
}

/* ==========================================================
   Modals
   ========================================================== */
.modal-content {
    border-radius: var(--lms-radius-lg) !important;
    border: 1px solid var(--lms-border) !important;
    box-shadow: var(--lms-shadow-lg) !important;
    overflow: hidden;
}

.modal-header {
    border-bottom: 1px solid var(--lms-border) !important;
    padding: 1.25rem 1.5rem !important;
    background: #F8FAFC;
}

.modal-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--lms-text-heading);
}

.modal-body {
    padding: 1.5rem !important;
}

.modal-footer {
    border-top: 1px solid var(--lms-border) !important;
    padding: 1rem 1.5rem !important;
    background: #F8FAFC;
}

/* ==========================================================
   Mobile-Specific & Device-Specific Layout Engineering
   ========================================================== */
@media (max-width: 991px) {
    .navbar .navbar-brand-wrapper {
        width: 60px !important;
    }
    .navbar-brand-wrapper .brand-logo {
        display: none !important;
    }
    .navbar-brand-wrapper .brand-logo-mini {
        display: block !important;
    }
    .sidebar-offcanvas {
        top: 60px !important;
        box-shadow: var(--lms-shadow-lg) !important;
    }
}

/* Device-Specific Grid & Layout Utilities */
.lms-academic-banner {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #1E3A8A 100%);
    border-radius: var(--lms-radius-lg);
    box-shadow: var(--lms-shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lms-subject-card {
    background: var(--lms-surface);
    border: 1px solid var(--lms-border);
    border-radius: var(--lms-radius);
    padding: 1.25rem;
    box-shadow: var(--lms-shadow-xs);
    transition: all 0.2s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.lms-subject-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--lms-shadow-md);
    border-color: #CBD5E1;
}

.lms-urgency-card {
    border-left: 4px solid var(--lms-warning) !important;
}

.lms-urgency-card.urgent {
    border-left-color: var(--lms-danger) !important;
}

.lms-action-chip {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--lms-radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
}

/* Mobile Urgency & Tablet Optimizations */
@media (max-width: 767px) {
    .lms-mobile-urgency-first {
        display: flex;
        flex-direction: column;
    }
    .lms-order-mobile-1 { order: 1 !important; }
    .lms-order-mobile-2 { order: 2 !important; }
    .lms-order-mobile-3 { order: 3 !important; }
    .lms-order-mobile-4 { order: 4 !important; }

    /* Touch targets */
    .btn, .nav-link, .lms-action-chip {
        min-height: 44px !important;
    }

    .lms-academic-banner {
        padding: 1.25rem !important;
    }

    .lms-academic-banner h2 {
        font-size: 1.35rem !important;
    }

    .lms-subject-card {
        padding: 1rem !important;
    }

    /* Cards instead of wide tables on mobile */
    .lms-mobile-card-view {
        display: block !important;
    }
    .lms-desktop-table-view {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .lms-mobile-card-view {
        display: none !important;
    }
    .lms-desktop-table-view {
        display: block !important;
    }
}

/* Tablet (768px - 1023px) balanced view */
@media (min-width: 768px) and (max-width: 1023px) {
    .content-wrapper {
        padding: 1.25rem 1rem !important;
    }
    .lms-academic-banner {
        padding: 1.75rem 1.5rem !important;
    }
}

/* Desktop (>= 1024px) productive spacing */
@media (min-width: 1024px) {
    .lms-rail-sticky {
        position: sticky;
        top: 85px;
        z-index: 10;
    }
}

/* Accessibility & Focus Rings */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--lms-primary) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2) !important;
}

/* ==========================================================
   Ujian Siswa — option cards & countdown
   ========================================================== */
.lms-option {
    display: block;
    margin-bottom: 0.5rem;
}
.lms-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.lms-option .lms-option-body {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--lms-border);
    border-radius: var(--lms-radius);
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.lms-option .lms-option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--lms-border);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--lms-text-body);
    background: #F8FAFC;
}
.lms-option .lms-option-text {
    color: var(--lms-text-body);
    line-height: 1.5;
}
.lms-option:hover .lms-option-body {
    border-color: var(--lms-primary);
    background: #F8FAFF;
}
.lms-option input[type="radio"]:checked + .lms-option-body {
    border-color: var(--lms-primary);
    background: var(--lms-primary-light);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.lms-option input[type="radio"]:checked + .lms-option-body .lms-option-letter {
    background: var(--lms-primary);
    border-color: var(--lms-primary);
    color: #fff;
}
.lms-option input[type="radio"]:focus-visible + .lms-option-body {
    outline: 2px solid var(--lms-primary);
    outline-offset: 2px;
}

@media (min-width: 768px) {
    .ps-md-5 { padding-left: 3rem !important; }
}

.lms-countdown {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--lms-radius-pill);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.lms-countdown.is-low {
    background: #DC2626;
    border-color: #DC2626;
    animation: lms-pulse 1s ease-in-out infinite;
}
@keyframes lms-pulse {
    50% { transform: scale(1.04); }
}

/* ==========================================================
   Video Materi (siswa) — 16:9 media thumb
   ========================================================== */
.lms-video-thumb {
    position: relative;
    height: 190px;
    background: #0F172A;
    overflow: hidden;
}
.lms-video-thumb iframe,
.lms-video-thumb video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #000;
}

/* ==========================================================
   Chat / Pesan Thread
   ========================================================== */
.lms-chat {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-height: 440px;
    overflow-y: auto;
    padding: 0.25rem;
}

.lms-chat-msg {
    display: flex;
}

.lms-chat-msg.out {
    justify-content: flex-end;
}

.lms-chat-bubble {
    max-width: 75%;
    padding: 0.7rem 1rem;
    border-radius: var(--lms-radius);
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: var(--lms-shadow-xs);
}

.lms-chat-msg.in .lms-chat-bubble {
    background: #F1F5F9;
    color: var(--lms-text-body);
    border-bottom-left-radius: 6px;
}

.lms-chat-msg.out .lms-chat-bubble {
    background: var(--lms-primary-light);
    color: #1E3A8A;
    border-bottom-right-radius: 6px;
}

.lms-chat-bubble .lms-chat-sender {
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 0.15rem;
}

.lms-chat-bubble .lms-chat-meta {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    opacity: 0.65;
}

/* Subtle micro-interaction hover */
.hover-lift {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--lms-shadow-md) !important;
}

/* ==========================================================
   MICRO-DETAILS, VISUAL POLISH & ACCESSIBILITY SYSTEM
   ========================================================== */

/* 1. Typography & Readability Precision */
.font-tabular,
.tabular-nums,
.lms-stat-value,
.badge,
table td.num,
.lms-deadline-badge {
    font-variant-numeric: tabular-nums lining-nums;
    -moz-font-feature-settings: "tnum" 1;
    -webkit-font-feature-settings: "tnum" 1;
    font-feature-settings: "tnum" 1;
}

.text-prose {
    max-width: 65ch;
    line-height: 1.625;
}

::placeholder {
    color: #94A3B8 !important; /* Slate 400 - high contrast readability against white surface */
    opacity: 1 !important;
}

/* 2. Optical Iconography Alignment */
.lms-icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
    pointer-events: none;
}

.btn .lms-icon-inline,
.nav-link .lms-icon-inline,
.lms-action-chip .lms-icon-inline {
    margin-right: 0.5rem;
}

/* Standard icon dimensions */
.lms-icon-xs { width: 14px; height: 14px; font-size: 14px; }
.lms-icon-sm { width: 16px; height: 16px; font-size: 16px; }
.lms-icon-md { width: 20px; height: 20px; font-size: 20px; }
.lms-icon-lg { width: 24px; height: 24px; font-size: 24px; }
.lms-icon-xl { width: 32px; height: 32px; font-size: 32px; }

/* 3. Button States & Interactive Polish */
.btn {
    font-weight: 600;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Button Loading State Spinner */
.btn.is-loading {
    color: transparent !important;
    pointer-events: none !important;
    position: relative;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 1.125rem;
    height: 1.125rem;
    top: calc(50% - 0.5625rem);
    left: calc(50% - 0.5625rem);
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: lms-spin 0.75s linear infinite;
    color: inherit;
}

@keyframes lms-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 4. Form Fields & Validation Polish */
.form-control,
.form-select {
    font-size: 0.9rem;
    color: var(--lms-text-heading);
    border: 1px solid #CBD5E1;
    border-radius: var(--lms-radius-sm);
    padding: 0.625rem 0.875rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:hover,
.form-select:hover {
    border-color: #94A3B8;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--lms-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
    display: inline-block;
}

.form-label .required-star {
    color: var(--lms-danger);
    font-weight: 700;
    margin-left: 2px;
}

.form-text {
    font-size: 0.775rem;
    color: var(--lms-text-muted);
    margin-top: 0.25rem;
}

/* Invalid Field Precision */
.is-invalid,
.was-validated .form-control:invalid {
    border-color: var(--lms-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.invalid-feedback {
    font-size: 0.775rem;
    font-weight: 500;
    color: var(--lms-danger);
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 5. Tables & Density Refinement */
.table {
    margin-bottom: 0;
    vertical-align: middle;
}

.table th {
    background-color: #F8FAFC !important;
    color: #475569 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 0.875rem 1rem !important;
    border-bottom: 2px solid var(--lms-border) !important;
    border-top: none !important;
}

.table td {
    padding: 0.875rem 1rem !important;
    color: #1E293B;
    font-size: 0.875rem;
    border-bottom: 1px solid #F1F5F9 !important;
    border-top: none !important;
}

.table-hover tbody tr:hover td {
    background-color: rgba(241, 245, 249, 0.65) !important;
}

/* Truncation helper */
.lms-truncate {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
}

@media (max-width: 768px) {
    .lms-truncate {
        max-width: 150px;
    }
}

/* 6. Semantic Status Badges */
.badge-subtle-success {
    background-color: #ECFDF5 !important;
    color: #065F46 !important;
    border: 1px solid #A7F3D0 !important;
}

.badge-subtle-warning {
    background-color: #FFFBEB !important;
    color: #92400E !important;
    border: 1px solid #FDE68A !important;
}

.badge-subtle-danger {
    background-color: #FEF2F2 !important;
    color: #991B1B !important;
    border: 1px solid #FECACA !important;
}

.badge-subtle-info {
    background-color: #EFF6FF !important;
    color: #1E40AF !important;
    border: 1px solid #BFDBFE !important;
}

.badge-subtle-secondary {
    background-color: #F1F5F9 !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
}

.badge {
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: var(--lms-radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.2;
}

/* 7. Skeleton Loaders */
.lms-skeleton {
    background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 37%, #F1F5F9 63%);
    background-size: 400% 100%;
    animation: lms-skeleton-pulse 1.4s ease infinite;
    border-radius: var(--lms-radius-xs);
    display: inline-block;
}

@keyframes lms-skeleton-pulse {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

.lms-skeleton-text {
    height: 14px;
    width: 100%;
    margin-bottom: 6px;
}

.lms-skeleton-circle {
    border-radius: 50% !important;
}

/* 8. Dialog & Modal Responsive Shield */
.modal-dialog {
    max-width: 540px;
    margin: 1.75rem auto;
}

@media (max-width: 576px) {
    .modal-dialog {
        max-width: calc(100vw - 2rem) !important;
        margin: 1rem auto !important;
    }
    .modal-content {
        border-radius: var(--lms-radius) !important;
    }
}

.modal-content {
    border: 1px solid var(--lms-border);
    box-shadow: var(--lms-shadow-lg);
    border-radius: var(--lms-radius-lg);
}

.modal-header {
    border-bottom: 1px solid var(--lms-border);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--lms-border);
    padding: 1rem 1.5rem;
}

/* 9. Reduced Motion Support (Accessibility standard) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==========================================================
   10. Bootstrap 5 Backport Utilities for BS4
   Eliminates broken flex spacing and missing utility collapses
   ========================================================== */

/* Flex Gap System */
.gap-0 { gap: 0 !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

.row-gap-1 { row-gap: 0.25rem !important; }
.row-gap-2 { row-gap: 0.5rem !important; }
.row-gap-3 { row-gap: 1rem !important; }
.column-gap-1 { column-gap: 0.25rem !important; }
.column-gap-2 { column-gap: 0.5rem !important; }
.column-gap-3 { column-gap: 1rem !important; }

/* Grid Gutter (.g-*) — BS5-style vertical gutters for this BS4 theme.
   Row pulls up by the gutter amount; each child pushes down by the same,
   so only wrapped rows get separated. Mirrors BS5's own mechanism, so it
   is a no-op on pages that already load Bootstrap 5 (landing, layouts/app).
   Horizontal spacing is already provided by the theme's column padding. */
/* Border side utilities (BS5 backport: .border-start + .border-4 accent) */
.border-start { border-left-width: 1px !important; border-left-style: solid !important; border-left-color: var(--lms-border); }
.border-start.border-4 { border-left-width: 4px !important; }

.row.g-1 { margin-top: -0.25rem; } .row.g-1 > * { margin-top: 0.25rem; }
.row.g-2 { margin-top: -0.5rem; } .row.g-2 > * { margin-top: 0.5rem; }
.row.g-3 { margin-top: -1rem; } .row.g-3 > * { margin-top: 1rem; }
.row.g-4 { margin-top: -1.5rem; } .row.g-4 > * { margin-top: 1.5rem; }
.row.g-5 { margin-top: -3rem; } .row.g-5 > * { margin-top: 3rem; }

/* Margin End (Right) & Start (Left) */
.me-0 { margin-right: 0 !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.me-4 { margin-right: 1.5rem !important; }
.me-5 { margin-right: 3rem !important; }
.me-auto { margin-right: auto !important; }

.ms-0 { margin-left: 0 !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.ms-3 { margin-left: 1rem !important; }
.ms-4 { margin-left: 1.5rem !important; }
.ms-5 { margin-left: 3rem !important; }
.ms-auto { margin-left: auto !important; }

/* Padding End & Start */
.pe-0 { padding-right: 0 !important; }
.pe-1 { padding-right: 0.25rem !important; }
.pe-2 { padding-right: 0.5rem !important; }
.pe-3 { padding-right: 1rem !important; }
.pe-4 { padding-right: 1.5rem !important; }
.pe-5 { padding-right: 3rem !important; }

.ps-0 { padding-left: 0 !important; }
.ps-1 { padding-left: 0.25rem !important; }
.ps-2 { padding-left: 0.5rem !important; }
.ps-3 { padding-left: 1rem !important; }
.ps-4 { padding-left: 1.5rem !important; }
.ps-5 { padding-left: 3rem !important; }

/* Border Radius Utilities */
.rounded-0 { border-radius: 0 !important; }
.rounded-1 { border-radius: var(--lms-radius-xs) !important; }
.rounded-2 { border-radius: var(--lms-radius-sm) !important; }
.rounded-3 { border-radius: var(--lms-radius) !important; }
.rounded-4 { border-radius: var(--lms-radius-lg) !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: var(--lms-radius-pill) !important; }

/* Background Opacity & High-Contrast Harmonization */
/* Prevents solid background from swallowing identically colored icon text */
.bg-opacity-10 {
    --bs-bg-opacity: 0.12;
}

.bg-primary.bg-opacity-10 {
    background-color: rgba(37, 99, 235, 0.12) !important;
    color: #1D4ED8 !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(16, 185, 129, 0.12) !important;
    color: #047857 !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.14) !important;
    color: #B45309 !important;
}

.bg-danger.bg-opacity-10 {
    background-color: rgba(239, 68, 68, 0.12) !important;
    color: #B91C1C !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(14, 165, 233, 0.12) !important;
    color: #0369A1 !important;
}

.bg-secondary.bg-opacity-10 {
    background-color: rgba(100, 116, 139, 0.12) !important;
    color: #334155 !important;
}

.bg-white.bg-opacity-10,
.bg-light.bg-opacity-10 {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Theme bug: legacy .text-secondary is #e4e6f6 (near-white) — invisible on light surfaces */
.text-secondary {
    color: #64748B !important;
}

.bg-white.bg-opacity-15 {
    background-color: rgba(255, 255, 255, 0.2) !important;
}

.bg-white.bg-opacity-20 {
    background-color: rgba(255, 255, 255, 0.25) !important;
}

/* Subtle Variant Utilities */
.bg-primary-subtle {
    background-color: #EFF6FF !important;
    color: #1E40AF !important;
    border-color: #BFDBFE !important;
}

.bg-success-subtle {
    background-color: #ECFDF5 !important;
    color: #065F46 !important;
    border-color: #A7F3D0 !important;
}

.bg-warning-subtle {
    background-color: #FFFBEB !important;
    color: #92400E !important;
    border-color: #FDE68A !important;
}

.bg-danger-subtle {
    background-color: #FEF2F2 !important;
    color: #991B1B !important;
    border-color: #FECACA !important;
}

.bg-info-subtle {
    background-color: #F0F9FF !important;
    color: #075985 !important;
    border-color: #BAE6FD !important;
}

.text-primary-emphasis { color: #1E40AF !important; }
.text-success-emphasis { color: #065F46 !important; }
.text-warning-emphasis { color: #92400E !important; }
.text-danger-emphasis { color: #991B1B !important; }
.text-info-emphasis { color: #075985 !important; }

/* Theme accent colors fail WCAG on light surfaces — darken to passing shades */
.text-success { color: #15803D !important; }
.text-info { color: #0369A1 !important; }
.text-warning { color: #B45309 !important; }
.text-danger { color: #DC2626 !important; }

/* Amber surfaces: white text is unreadable */
.bg-warning.text-white { color: #3F2A00 !important; }

/* Fractional spacing & misc utilities used by views (Tailwind-parity backports) */
.p-1\.5 { padding: 0.375rem !important; }
.p-2\.5 { padding: 0.625rem !important; }
.px-2\.5 { padding-left: 0.625rem !important; padding-right: 0.625rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }
.mt-0\.5 { margin-top: 0.125rem !important; }
.mb-0\.5 { margin-bottom: 0.125rem !important; }
.gap-1\.5 { gap: 0.375rem !important; }

.text-xs { font-size: 0.75rem !important; line-height: 1.35 !important; }
.text-sm { font-size: 0.875rem !important; line-height: 1.4 !important; }
.tracking-wider { letter-spacing: 0.05em !important; }
.shadow-xs { box-shadow: var(--lms-shadow-xs) !important; }
.shadow-none { box-shadow: none !important; }
.opacity-50 { opacity: 0.5 !important; }
.max-w-md { max-width: 28rem !important; }
.last-border-0:last-child { border-bottom: none !important; }
.hover-bg-light:hover { background-color: #F8FAFC !important; }

.bg-opacity-15 { --bs-bg-opacity: 0.15; }
.border-white { border-color: #FFFFFF !important; }
.border-opacity-15 { opacity: 1; }
.border.border-opacity-15 { border-color: rgba(255, 255, 255, 0.15) !important; }
.border-success-subtle { border-color: #A7F3D0 !important; }
.border-danger-subtle { border-color: #FECACA !important; }
.border-primary-subtle { border-color: #BFDBFE !important; }
.border-warning-subtle { border-color: #FDE68A !important; }
.border-info-subtle { border-color: #BAE6FD !important; }

/* Unify outline-primary with the design system (templates ship purple) */
.btn-outline-primary {
    color: var(--lms-primary) !important;
    border-color: var(--lms-primary) !important;
    background-color: transparent !important;
}
.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:not(:disabled):not(.disabled):active {
    color: #FFFFFF !important;
    background-color: var(--lms-primary) !important;
    border-color: var(--lms-primary) !important;
}

.btn-outline-secondary {
    color: var(--lms-secondary) !important;
    border-color: #CBD5E1 !important;
    background-color: transparent !important;
}
.btn-outline-secondary:hover {
    color: var(--lms-text-heading) !important;
    background-color: var(--lms-secondary-light) !important;
    border-color: #94A3B8 !important;
}

.btn-outline-light {
    color: #FFFFFF !important;
    border-color: rgba(255, 255, 255, 0.55) !important;
}
.btn-outline-light:hover {
    color: var(--lms-primary) !important;
    background-color: #FFFFFF !important;
}

.btn-light {
    color: var(--lms-text-body) !important;
    background-color: #F8FAFC !important;
    border-color: var(--lms-border) !important;
}
.btn-light:hover {
    background-color: #F1F5F9 !important;
}

/* Navbar search: give the field usable width instead of truncating placeholder */
.navbar .nav-search .input-group,
.navbar .input-group {
    max-width: 340px;
}

/* ==========================================================
   11. Unified Icon Tile System (.lms-icon-tile)
   No empty color blocks; guaranteed contrast, centering & crisp render
   ========================================================== */
.lms-icon-tile {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    line-height: 1 !important;
    border-radius: var(--lms-radius) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    vertical-align: middle !important;
}

/* Tile Sizes */
.lms-icon-tile-xs {
    width: 24px !important;
    height: 24px !important;
    font-size: 0.75rem !important;
    border-radius: 6px !important;
}

.lms-icon-tile-sm {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.875rem !important;
    border-radius: 8px !important;
}

.lms-icon-tile-md {
    width: 42px !important;
    height: 42px !important;
    font-size: 1.15rem !important;
    border-radius: 10px !important;
}

.lms-icon-tile-lg {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.35rem !important;
    border-radius: 12px !important;
}

.lms-icon-tile-xl {
    width: 58px !important;
    height: 58px !important;
    font-size: 1.65rem !important;
    border-radius: 14px !important;
}

/* Tile Semantic Color Themes (Subtle background + high contrast icon) */
.lms-icon-tile-primary {
    background-color: #EFF6FF !important;
    color: #1D4ED8 !important;
    border: 1px solid #BFDBFE !important;
}

.lms-icon-tile-success {
    background-color: #ECFDF5 !important;
    color: #047857 !important;
    border: 1px solid #A7F3D0 !important;
}

.lms-icon-tile-warning {
    background-color: #FFFBEB !important;
    color: #B45309 !important;
    border: 1px solid #FDE68A !important;
}

.lms-icon-tile-danger {
    background-color: #FEF2F2 !important;
    color: #B91C1C !important;
    border: 1px solid #FECACA !important;
}

.lms-icon-tile-info {
    background-color: #F0F9FF !important;
    color: #0369A1 !important;
    border: 1px solid #BAE6FD !important;
}

.lms-icon-tile-purple {
    background-color: #FAF5FF !important;
    color: #6D28D9 !important;
    border: 1px solid #DDD6FE !important;
}

.lms-icon-tile-slate {
    background-color: #F1F5F9 !important;
    color: #334155 !important;
    border: 1px solid #CBD5E1 !important;
}

/* ==========================================================
   12. Heading Icon Precision & Optical Spacing
   Ensures 8–12px proportional spacing and visual alignment
   ========================================================== */
.lms-heading-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 8px !important;
    margin-right: 10px !important; /* Exactly within 8-12px range */
    flex-shrink: 0 !important;
    font-size: 0.95rem !important;
    line-height: 1 !important;
    vertical-align: middle !important;
}

.lms-heading-icon-primary {
    background-color: #EFF6FF !important;
    color: #2563EB !important;
    border: 1px solid #BFDBFE !important;
}

.lms-heading-icon-success {
    background-color: #ECFDF5 !important;
    color: #059669 !important;
    border: 1px solid #A7F3D0 !important;
}

.lms-heading-icon-warning {
    background-color: #FFFBEB !important;
    color: #D97706 !important;
    border: 1px solid #FDE68A !important;
}

.lms-heading-icon-danger {
    background-color: #FEF2F2 !important;
    color: #DC2626 !important;
    border: 1px solid #FECACA !important;
}

.lms-heading-icon-info {
    background-color: #F0F9FF !important;
    color: #0284C7 !important;
    border: 1px solid #BAE6FD !important;
}

/* Auto-spacing guard for card header titles with direct icons.
   Flex headings (d-flex + gap-*) already control spacing via gap;
   applying margin there would double the distance. */
.card-header h5:not(.d-flex) > i:first-child,
.card-header .h5:not(.d-flex) > i:first-child,
.card-title:not(.d-flex) > i:first-child {
    margin-right: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: -0.1em !important;
}

/* Keep heading icons optically aligned with the first text line
   when a flex heading wraps onto two lines. */
.card-header h5.d-flex > i:first-child,
.card-header .h5.d-flex > i:first-child {
    flex-shrink: 0;
}

/* Button Icon Spacing Guard */
.btn > i:first-child:not(:last-child) {
    margin-right: 8px !important;
}

.btn > i:last-child:not(:first-child) {
    margin-left: 8px !important;
}

/* Badge Icon Spacing Guard */
.badge > i:first-child:not(:last-child) {
    margin-right: 6px !important;
}

/* Table Actions & Mobile Touch Targets */
.btn-icon-only {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--lms-radius-sm) !important;
}

@media (max-width: 576px) {
    .btn-icon-only {
        min-width: 44px !important;
        min-height: 44px !important;
    }
}

/* ==========================================================
   13. Contrast & Surface Separation (Anti White-on-White)
   ========================================================== */
/* Distinct card boundaries */
.card {
    border: 1px solid var(--lms-border) !important;
    background-color: var(--lms-surface) !important;
}

/* Sub-card inside cards (e.g. deadline items, forum links) */
.lms-urgency-card {
    background-color: #FFFFFF !important;
    border: 1px solid #E2E8F0 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.lms-urgency-card:hover {
    border-color: #CBD5E1 !important;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08) !important;
}

.lms-urgency-card.urgent {
    border-left: 4px solid var(--lms-danger) !important;
    background-color: #FFFDFD !important;
}

/* Nested interactive list groups */
.list-group-item {
    background-color: #FFFFFF !important;
    border-color: #E2E8F0 !important;
}

.list-group-item:hover {
    background-color: #F8FAFC !important;
}

/* Clean Empty State Containers */
.lms-empty-state {
    background-color: #F8FAFC !important;
    border: 1px dashed #CBD5E1 !important;
    border-radius: var(--lms-radius) !important;
    padding: 2.25rem 1.5rem !important;
    text-align: center !important;
}

.lms-empty-state i {
    opacity: 0.85;
}



/* text-white-50 (50% opacity) fails WCAG AA on dark gradients; raise to 85% */
.text-white-50 {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Sidebar icon-only hover flyout: template ships a magenta (#b10dbf)
   flyout + blue (#0473f0) submenu with illegible text. Restyle to a
   clean white flyout matching the light sidebar. */
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .nav-link .menu-title,
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .nav-link:hover .menu-title {
    background: #FFFFFF !important;
    color: var(--lms-text-heading, #0F172A) !important;
    font-weight: 600;
    border-radius: 0 10px 10px 0;
    box-shadow: var(--lms-shadow-md, 0 10px 15px -3px rgba(0,0,0,.1));
}
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .nav-link[aria-expanded] .menu-title {
    border-bottom: 1px solid var(--lms-border, #E2E8F0);
    border-radius: 0 10px 0 0;
}
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .collapse,
.sidebar-icon-only .sidebar .nav .nav-item.hover-open .collapsing {
    background: #FFFFFF !important;
    border-radius: 0 0 10px 0;
    box-shadow: var(--lms-shadow-md, 0 10px 15px -3px rgba(0,0,0,.1));
}
.sidebar-icon-only .sidebar .nav.sub-menu .nav-item {
    border-top: 1px solid var(--lms-border, #E2E8F0) !important;
}
.sidebar-icon-only .sidebar .nav.sub-menu .nav-item .nav-link {
    color: var(--lms-text-body, #334155) !important;
}
.sidebar-icon-only .sidebar .nav.sub-menu .nav-item .nav-link:hover,
.sidebar-icon-only .sidebar .nav.sub-menu .nav-item .nav-link.active {
    color: var(--lms-primary, #2563EB) !important;
}

/* ==========================================================
   Mobile bottom navigation (< 992px)
   Primary actions stay reachable without opening the drawer;
   the full menu remains in the off-canvas sidebar.
   ========================================================== */
.lms-bottomnav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: #FFFFFF;
    border-top: 1px solid var(--lms-border, #E2E8F0);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.08);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 991.98px) {
    .lms-bottomnav {
        display: flex;
    }
    /* Keep page content clear of the fixed bar */
    .container-scroller {
        padding-bottom: 64px;
    }
}

.lms-bottomnav .lms-bottomnav-item {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 7px;
    font-size: 0.66rem;
    font-weight: 600;
    line-height: 1;
    color: var(--lms-text-muted, #64748B);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    min-height: 56px;
}

.lms-bottomnav .lms-bottomnav-item i {
    font-size: 1.05rem;
}

.lms-bottomnav .lms-bottomnav-item.active,
.lms-bottomnav .lms-bottomnav-item:active,
.lms-bottomnav .lms-bottomnav-item:hover {
    color: var(--lms-primary, #2563EB);
    text-decoration: none;
}

.lms-bottomnav .lms-bottomnav-item:focus-visible {
    outline: 2px solid var(--lms-primary, #2563EB);
    outline-offset: -2px;
    border-radius: 8px;
}
