/* SB ADMIN PRO THEME OVERHAUL */
:root {
    --primary-color: #2563eb;
    --accent-color: #f59e0b;
    --sb-blue: var(--primary-color);
    --sb-indigo: #6900c7;
    --sb-sidebar-bg: #f2f6fc;
    --sb-topbar-bg: #fff;
    --sb-card-border: rgba(33, 40, 50, 0.125);
}

body {
    background-color: #f2f6fc;
    color: #212832;
    overflow-x: hidden;
}

/* Layout Structure */
.sb-sidebar {
    width: 240px;
    background: var(--sb-sidebar-bg);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.3s ease, width 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sb-sidebar-menu {
    padding-top: 5rem;
    overflow-y: auto;
    flex-grow: 1;
}

/* Sidebar Collapsed State */

/* Sidebar Collapsed State */
body.sidebar-toggled .sb-sidebar {
    transform: translateX(-100%);
}

.sb-topbar {
    height: 70px;
    background: var(--sb-topbar-bg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 240px;
    right: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    transition: left 0.3s ease;
}

body.sidebar-toggled .sb-topbar,
body.no-sidebar .sb-topbar {
    left: 0;
}

.sb-main-content {
    margin-left: 240px;
    padding-top: 70px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

body.sidebar-toggled .sb-main-content,
body.no-sidebar .sb-main-content {
    margin-left: 0;
}

/* Dashboard Hero Banner */
.page-header {
    background: linear-gradient(135deg, var(--sb-blue) 0%, var(--sb-indigo) 100%);
    padding: 1.5rem 2rem 5.5rem 2rem;
    color: white;
    margin-bottom: -4rem;
}

.card-dashboard {
    background: white;
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(33, 40, 50, 0.15);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.card-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Progress Tracker Bars (SB Admin style) */
.progress-sb {
    height: 0.5rem;
    background-color: #e3e6ec;
    border-radius: 0.25rem;
    overflow: hidden;
}

/* Status Badges */
.risk-high {
    background: #fee2e2;
    color: #b91c1c;
}

.risk-medium {
    background: #fef3c7;
    color: #d97706;
}

.risk-low {
    background: #dcfce7;
    color: #15803d;
}

.risk-null {
    background: #f1f5f9;
    color: #475569;
}

/* Custom components */
.loader {
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--sb-blue);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.active-nav {
    color: var(--sb-blue) !important;
    font-weight: 700 !important;
    background: white;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.35rem;
}

.course-item {
    transition: all 0.2s;
    cursor: pointer;
    border-radius: 0.35rem;
}

.course-item:hover {
    background: rgba(0, 97, 242, 0.05);
    color: var(--sb-blue) !important;
    padding-left: 1.25rem !important;
}

.course-item.active {
    color: var(--sb-blue) !important;
    font-weight: 800 !important;
    background: rgba(0, 97, 242, 0.08);
    border-left: 3px solid var(--sb-blue);
}

.course-item.active .w-1\.5 {
    background-color: var(--sb-blue) !important;
}

.chart-container {
    position: relative;
    height: 35px;
    width: 140px;
    margin: 0 auto;
}

/* ─── Smooth Scrolling ──────────────────────────────────────────────────── */
html {
    scroll-behavior: smooth;
}

/* ─── Keyboard Focus Styles ─────────────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--sb-blue);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--sb-blue);
    outline-offset: 2px;
}

/* ─── Responsive: Tablets (< 1024px) ────────────────────────────────────── */
@media (max-width: 1023px) {
    .sb-sidebar {
        transform: translateX(-100%);
        z-index: 60;
    }

    .sb-sidebar.open {
        transform: translateX(0);
    }

    .sb-topbar {
        left: 0;
    }

    .sb-main-content {
        margin-left: 0;
    }

    .page-header {
        padding: 1.25rem 1.25rem 5rem 1.25rem;
    }
}

/* ─── Responsive: Mobile (< 768px) ──────────────────────────────────────── */
@media (max-width: 767px) {
    .sb-topbar {
        height: auto;
        min-height: 56px;
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sb-main-content {
        padding-top: 56px;
    }

    .page-header {
        padding: 1rem 1rem 4rem 1rem;
        margin-bottom: -3rem;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .card-dashboard {
        border-radius: 0.75rem;
    }
}

/* ─── Modern Glassmorphism & Animations ───────────────────────────────────── */
.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in-right {
    animation: fadeInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.animate-slide-up {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ─── Drawer Overlays ────────────────────────────────────────────────────── */
.drawer-overlay {
    transition: opacity 0.3s ease;
}

/* ─── Print Styles ──────────────────────────────────────────────────────── */
@media print {
    .sb-sidebar,
    .sb-topbar,
    .page-header,
    button,
    #syncDrawer {
        display: none !important;
    }

    .sb-main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }

    .card-dashboard {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}