:root {
    /* Base Variables - Light Mode */
    --primary-red: #8B0000;
    --primary-red-hover: #700000;
    --sidebar-bg: #8B0000;
    --bg-body: #F4F7FA;
    --bg-card: #FFFFFF;
    --bg-topnav: #FFFFFF;
    --text-main: #1A1D21;
    --text-muted: #64748B;
    --border-color: #E2E8F0;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --sidebar-width: 260px;
    --topnav-height: 70px;
}

[data-theme="dark"] {
    /* Dark Mode Overrides */
    --bg-body: #0F1113;
    --bg-card: #1C1F23;
    --bg-topnav: #1C1F23;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --border-color: #2D3339;
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

* {
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* Sidebar Styling */
#sidebar-wrapper {
    width: var(--sidebar-width);
    background-color: var(--primary-red) !important;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#sidebar-wrapper .brand-section {
    padding: 2rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

#sidebar-wrapper .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 10px 15px;
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
}

#sidebar-wrapper .nav-link i {
    width: 24px;
    text-align: center;
    margin-right: 8px;
    margin-left: 0;
}

#sidebar-wrapper .nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

#sidebar-wrapper .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #fff !important;
    font-weight: 500;
    border-left: 4px solid #fff;
    border-right: none;
    border-radius: 0 0.5rem 0.5rem 0;
}

/* Profile Section in Sidebar */
.profile-section {
    text-align: center;
    padding: 2rem 1rem;
    color: #fff;
}

.profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    margin-bottom: 1rem;
    object-fit: cover;
}

/* Main Content Layout */
.content-wrapper {
    margin-left: var(--sidebar-width);
    margin-right: 0;
    transition: margin-left 0.3s;
    width: 100%;
    min-width: 0;
}

.top-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Search Box */
.search-box {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    width: 300px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    margin-left: 10px;
    width: 100%;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Components */
.card {
    background-color: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.icon-container {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.bg-soft-red {
    background-color: rgba(139, 0, 0, 0.1);
    color: var(--primary-red);
}

.bg-soft-blue {
    background-color: rgba(0, 102, 204, 0.1);
    color: #0066cc;
}

.bg-soft-green {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.bg-soft-orange {
    background-color: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.smallest {
    font-size: 0.75rem;
}

.avatar-sm {
    width: 38px;
    height: 38px;
    object-fit: cover;
}

.vertical-divider {
    height: 24px;
    width: 1px;
    background: var(--border-color);
}

/* Chart Containers */
.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

.chart-container-donut {
    position: relative;
    height: 260px;
    width: 100%;
}

/* Custom Switch Styling */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-red);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

/* Responsive Adjustments */
/* Responsive Adjustments */
@media (max-width: 992px) {
    #sidebar-wrapper {
        width: 260px;
        /* Full width drawer style */
        transform: translateX(-100%);
        /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    }

    #sidebar-wrapper.sidebar-open {
        transform: translateX(0);
        /* Slide in */
    }

    /* Show labels again since we are full width */
    #sidebar-wrapper .brand-section span,
    #sidebar-wrapper .nav-link span {
        display: inline !important;
    }

    #sidebar-wrapper .nav-link i {
        margin-right: 8px;
        font-size: 1rem;
        width: 24px;
        text-align: center;
    }

    .content-wrapper {
        margin-left: 0;
        /* No margin on mobile */
        width: 100%;
    }

    .search-box {
        width: 200px;
    }
}

/* Backdrop for Mobile Sidebar */
#sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    /* Below sidebar (1000) but above content */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

#sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
}