:root {
    --primary-color: #4e73df;
    --primary-gradient: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    --secondary-gradient: linear-gradient(135deg, #6f42c1 0%, #4e73df 100%);
    --accent-gradient: linear-gradient(135deg, #36b9cc 0%, #1a8a9a 100%);
    --sidebar-bg: #1a1c23;
    --sidebar-gradient: linear-gradient(180deg, #1a1c23 0%, #0d1221 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: #4e73df;
    --content-bg: #f8f9fc;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    --card-hover-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.25);
    --navbar-height: 70px;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --transition-speed: 0.3s;
}

html, body {
    height: 100%;
    margin: 0;
}

#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

#sidebar-wrapper {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-gradient);
    transition: width var(--transition-speed) ease;
    z-index: 1000;
    position: fixed;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

#sidebar-wrapper.collapsed {
    width: var(--sidebar-collapsed-width);
}

#content-wrapper {
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-width));
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease, width var(--transition-speed) ease;
    background-color: var(--content-bg);
}

#sidebar-wrapper.collapsed + #content-wrapper {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

.main-content {
    padding: 1.5rem;
    flex: 1 0 auto;
}

footer.sticky-footer {
    padding: 2rem 0;
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #e3e6f0;
    margin-top: auto;
}

[data-bs-theme="dark"] {
    --primary-color: #375add;
    --sidebar-bg: #0f1014;
    --sidebar-hover: #1e2029;
    --content-bg: #0b0c10;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #5a5c69;
}

/* Navbar */
.navbar-premium {
    height: var(--navbar-height);
    background: white;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
    z-index: 999;
}

.navbar-gradient {
    background: var(--primary-gradient) !important;
}

.topbar-divider {
    width: 0;
    border-right: 1px solid #e3e6f0;
    height: calc(var(--navbar-height) - 30px);
    margin: auto 1rem;
}

.nav-link-icon {
    position: relative;
    padding: 0.5rem;
}

.badge-counter {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(50%, -50%);
    font-size: 0.65rem;
}

/* Sidebar Branding */
.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    color: white;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 0.05rem;
}

/* Sidebar Menu */
.sidebar-heading {
    padding: 1.5rem 1.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-nav-item {
    padding: 0.25rem 1rem;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-nav-link i {
    font-size: 1.1rem;
    margin-right: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar-nav-link:hover {
    color: white;
    background: var(--sidebar-hover);
}

.sidebar-nav-link.active {
    color: white;
    background: var(--primary-color);
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.3);
}

.collapsed .sidebar-nav-link span,
.collapsed .sidebar-heading,
.collapsed .sidebar-nav-link::after {
    display: none;
}

/* Cards */
.card-premium {
    border: none;
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition-speed);
}

.card-premium:hover {
    box-shadow: var(--card-shadow);
}

.card-header-premium {
    background: transparent;
    border-bottom: 1px solid #f1f1f1;
    padding: 1.25rem;
}

/* Buttons */
.btn-gradient-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: 0 4px 12px rgba(78, 115, 223, 0.2);
}

.btn-gradient-primary:hover {
    background: var(--primary-gradient);
    filter: brightness(1.1);
    color: white;
}

.btn-rounded {
    border-radius: 50rem;
}

/* Forms */
.form-control-premium {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d3e2;
}

.form-control-premium:focus {
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.1);
}

/* Sub-header */
.page-header {
    background: white;
    border-bottom: 1px solid #e3e6f0;
    padding: 1.5rem 0;
    margin-bottom: 1.5rem;
}

/* Table */
.table-premium thead th {
    background: #f8f9fc;
    color: #4e73df;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    border-top: none;
}

/* Stats */
.stat-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    font-size: 1.5rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

#sidebar-wrapper::-webkit-scrollbar {
    width: 4px;
}

#sidebar-wrapper::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

#sidebar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Responsiveness Improvements */
@media (max-width: 992px) {
    #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
        box-shadow: none;
    }

    #sidebar-wrapper.show {
        margin-left: 0;
        box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    }

    #content-wrapper {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.4);
        backdrop-filter: blur(4px);
        z-index: 998;
    }

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

    .navbar-premium {
        padding: 0.5rem;
    }
    
    .topbar-divider {
        display: none;
    }

    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .navbar-search {
        display: none !important;
    }
    
    .h3, .fs-3 {
        font-size: 1.25rem !important;
    }
}