*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* --primary: #ea580c; */
    --primary: #1d35ff;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(135deg, #1d35ff 0%, #6366f1 100%);
    --secondary: #f59e0b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --orange: #f97316;

    --bg: #fafaf9;
    --sidebar-bg: #1c1917;
    --sidebar-w: 290px;
    --card: #ffffff;
    --border: #e7e5e4;
    --text: #0f172a;
    --muted: #57534e;
    --radius: 6px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
}

html,
body {
    height: 100%;
    font-family: "Inter", sans-serif;
    font-size: 15px !important;
    color: var(--text);
    background: var(--bg);
}

/* ─── Layout ─────────────────────────────────── */
.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.layout.sidebar-collapsed .sidebar {
    margin-left: calc(-1 * var(--sidebar-w));
}

/* ─── Sidebar ─────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: margin-left 0.2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-icon svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.brand-name {
    color: #1e293b;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.2px;
    line-height: 1.1;
}

.sidebar-section {
    margin-top: 8px;
}

.sidebar-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #64748b;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    margin: 4px 10px;
    cursor: pointer;
    /* color: #86868b; */
    color: #475569;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 15px;
    transition: all 0.15s ease-in-out;
    position: relative;
    user-select: none;
    text-decoration: none;
}

.nav-item:hover {
    color: #1d1d1f;
    background: #f5f5f7;
}

.nav-item.active {
    color: #ffffff;
    background: linear-gradient(135deg, #6366f1 0%, #d946ef 100%);
    font-weight: 600;
}

.nav-item.active-parent {
    color: #1d1d1f;
    background: #e8e8ed;
    font-weight: 600;
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item.active .nav-icon {
    fill: #ffffff !important;
    stroke: #ffffff !important;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sf-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sf-name {
    color: #1e293b;
    font-weight: 600;
    font-size: 13px;
}

.sf-role {
    color: #64748b;
    font-size: 11px;
}

/* ─── Main ─────────────────────────────────── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 0;
}

.topbar {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 70px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.topbar-breadcrumb {
    color: #4b5563;
    font-size: 12px;
    margin-left: 4px;
    font-weight: 500;
}

.search-box {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 12px;
    width: 220px;
}

.search-box svg {
    color: var(--muted);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.search-box input {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    outline: none;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--muted);
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    color: var(--muted);
    transition: all 0.15s;
}

.icon-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.icon-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--card);
}

.avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4361ee, #7209b7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    /* border: 2px solid #fff; */
    box-shadow: 0 0 0 2px var(--primary);
}

.user-menu-wrapper {
    position: relative;
}

.avatar-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 240px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
    padding: 10px;
    z-index: 1000;
}

.avatar-menu[x-cloak] {
    display: none !important;
}

.avatar-menu__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.avatar-btn--menu {
    width: 42px;
    height: 42px;
    font-size: 14px;
}

.avatar-menu__name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.avatar-menu__email {
    font-size: 11px;
    color: var(--muted);
}

.avatar-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 8px;
    border-radius: 10px;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
}

.avatar-menu__item:hover {
    background: var(--bg);
}

.avatar-menu__item svg {
    width: 16px;
    height: 16px;
    color: var(--muted);
}

.avatar-menu__item--danger {
    color: var(--danger);
}

.avatar-menu__form {
    display: block;
}

/* ─── User Profile Page ─────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.2s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: #304ddf;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f1f3ff;
}

/* ─── Content ─────────────────────────────────── */
.content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding: 24px 28px;
    scrollbar-gutter: stable;
}

/* ─── Middle row ─────────────────────────────────── */

/* Chart card */
.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tab-pill.active {
    background: var(--primary);
    color: #fff;
}

.tab-pill:hover:not(.active) {
    background: var(--primary-light);
    color: var(--primary);
}

/* ─── Bottom row ─────────────────────────────────── */

/* Table */

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--muted);
    padding: 10px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

tbody tr:last-child {
    border-bottom: none;
}

tbody tr:hover {
    background: #fafbff;
}

tbody td {
    padding: 12px 16px;
    font-size: 13px;
}

.student-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stu-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.stu-name {
    font-weight: 600;
    font-size: 13px;
}

.stu-id {
    font-size: 11px;
    color: var(--muted);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-badge::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.active {
    background: #e8fbf5;
    color: #06d6a0;
}

.status-badge.inactive {
    background: #fee8ec;
    color: var(--danger);
}

.status-badge.pending {
    background: #fff7e6;
    color: var(--warning);
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: all 0.15s;
}

.action-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Schedule */

/* Scrollbar (Main content right scrollbar only) */
.main::-webkit-scrollbar,
.content::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.main::-webkit-scrollbar-track,
.content::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 10px;
}

.main::-webkit-scrollbar-thumb,
.content::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #6366f1 0%, #a855f7 50%, #d946ef 100%);
    border-radius: 10px;
    border: 3px solid #e2e8f0;
}

.main::-webkit-scrollbar-thumb:hover,
.content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4f46e5 0%, #9333ea 50%, #c026d3 100%);
}

.main, .content {
    scrollbar-width: auto;
    scrollbar-color: #a855f7 #e2e8f0;
}

/* Left sidebar scrollbar (default 5px) */
.sidebar::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.sidebar {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

/* ─── Responsiveness Media Queries ─────────────────── */

/* Mobile & Tablet Styles */
@media (max-width: 768px) {
    .sidebar-footer {
        display: none !important;
    }

    #desktopToggleBtn {
        display: none !important;
    }

    .layout {
        position: relative;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .sidebar-menu-scroll {
        padding-bottom: 180px !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show {
        display: block;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar .search-box {
        display: none;
        /* Hide topbar search on small screens to save space */
    }

    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 9px;
        background: var(--bg);
        border: 1px solid var(--border);
        cursor: pointer;
        color: var(--text);
        margin-right: 8px;
    }

    .mobile-logo-wrap {
        display: flex !important;
    }

    .content {
        padding: 16px;
    }
}

/* ─── Responsive: Stack on smaller screens ───────── */
@media (max-width: 1100px) {}

/* ─── Alerts ─────────────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ─── Card Body Zero Padding Override ─────────────── */

/* ─── Stats Row Bottom Margin Helper ─────────────── */

select.custom-select-processed {
    display: none !important;
}

/* ─── Global Custom Select Dropdown ───────────────── */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px !important;
    padding-right: 36px !important;
    cursor: pointer;
}

/* Custom Select Dropdown UI components */
.custom-select-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    background-color: #f8fafc;
    color: #111827;
    outline: none;
    cursor: pointer;
    min-width: 120px;
    user-select: none;
    transition:
        border-color 0.15s,
        background-color 0.15s;
    height: 32px;
    box-sizing: border-box;
}

.custom-select-trigger:focus {
    background-color: #ffffff;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.custom-select-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 100%;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 4px 0;
    overflow-y: auto;
    max-height: 250px;
}

.custom-select-menu.show {
    display: block;
}

.custom-select-option {
    display: block;
    padding: 8px 12px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 150ms,
        color 150ms;
}

.custom-select-option:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.custom-select-option.selected {
    background-color: var(--primary-light, #eff6ff);
    color: var(--primary, #2563eb);
    font-weight: 600;
}

/* Compact style for pagination and entries selects */
.custom-select-container-sm .custom-select-trigger {
    min-width: 70px;
    height: 30px;
    padding: 4px 8px;
}

.custom-select-container-sm .custom-select-menu {
    min-width: 70px;
}

.custom-select-container-sm .custom-select-option {
    padding: 6px 10px;
}

@media (max-width: 640px) {
    #realBarChart {
        gap: 12px !important;
    }

    #realBarLabels {
        font-size: 10px !important;
    }
}

/* Responsive Layout helper classes */

@media (max-width: 992px) {}

@media (max-width: 992px) {}

@media (max-width: 768px) {}

@media (max-width: 992px) {}

@media (max-width: 768px) {
    .layout {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }

    .main {
        height: auto !important;
        overflow: visible !important;
        padding-bottom: 76px !important;
    }

    .content {
        overflow-y: visible !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 16px 12px !important;
    }

    .mobile-bottom-nav {
        display: flex !important;
    }
}