:root {
    --primary-color: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.6);
    --secondary-color: #94a3b8;
    --success-color: #10b981;
    --info-color: #0ea5e9;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #0d1117;
    --light-color: #f8fafc;

    --body-bg: #f5f7fb;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --card-bg: #ffffff;
    --text-color: #334155;
    --heading-color: #1e293b;
    --border-color: rgba(226, 232, 240, 0.8);
    --sidebar-width: 240px;

    --modern-radius: 2rem 0.6rem 2rem 0.6rem;
    --shadow-premium: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--body-bg) !important;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.05) 0px, transparent 50%) !important;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    margin: 0;
}

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

/* Sidebar Fixes */
#sidebar-wrapper {
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width) !important;
    max-width: var(--sidebar-width) !important;
    background: #0d1117 !important;
    color: white !important;
    display: flex;
    flex-direction: column;
    padding: 1rem 0.75rem;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1001;
}

.sidebar-heading {
    margin-bottom: 1rem;
}

#sidebar-wrapper .list-group-item {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.6) !important;
    padding: 0.6rem 1rem !important;
    margin-bottom: 0.25rem;
    border-radius: 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    text-decoration: none;
}

#sidebar-wrapper .list-group-item i {
    margin-right: 15px;
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

#sidebar-wrapper .list-group-item:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: white !important;
    transform: translateX(8px);
}

#sidebar-wrapper .list-group-item.active {
    background: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 10px 20px -5px var(--primary-glow);
}

.sidebar-subtitle {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.5);
    margin: 1rem 0 0.5rem 1rem;
}

/* Content Area Fixes */
#page-content-wrapper {
    flex: 1;
    min-width: 0;
    /* Prevents flex items from overflowing */
    padding: 1.5rem 2.5rem;
    background-color: transparent;
}

/* Navbar Premium */
.navbar-custom {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 1.5rem;
    padding: 0.8rem 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-premium);
    z-index: 1000;
}

.global-search-container {
    width: 300px;
}

.top-search-input {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    border-radius: 1rem !important;
    padding: 0.6rem 1rem 0.6rem 3rem !important;
    font-size: 0.9rem;
    width: 100%;
}

/* Dashboard Cards Fixes */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--modern-radius);
    box-shadow: var(--shadow-premium);
    margin-bottom: 2rem;
    overflow: hidden;
}

.stat-card {
    padding: 1.75rem;
    color: white;
    border-radius: var(--modern-radius);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    z-index: 1;
}

.stat-card .h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.card-gradient-primary {
    background: linear-gradient(135deg, #6366f1, #a855f7);
}

.card-gradient-success {
    background: linear-gradient(135deg, #10b981, #3b82f6);
}

.card-gradient-danger {
    background: linear-gradient(135deg, #ef4444, #f97316);
}

.card-gradient-warning {
    background: linear-gradient(135deg, #f59e0b, #eab308);
}

/* Quick Actions spacing */
.quick-action-btn {
    background: white !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 1.5rem !important;
    padding: 1.5rem 1rem !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
    text-decoration: none !important;
}

.quick-action-btn:hover {
    transform: translateY(-5px) scale(1.05) !important;
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 20px 25px -5px var(--primary-glow) !important;
}

.quick-action-btn:hover i,
.quick-action-btn:hover .small {
    color: white !important;
}

/* Responsive & Modern Mobile UI */
@media (max-width: 992px) {
    #sidebar-wrapper {
        position: fixed;
        left: calc(-1 * var(--sidebar-width)) !important;
        top: 0;
        bottom: 0;
        margin-left: 0 !important;
        transition: left 0.3s ease;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        height: 100vh;
        z-index: 1060;
    }

    #wrapper.toggled #sidebar-wrapper {
        left: 0 !important;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    #page-content-wrapper {
        padding: 1rem;
        width: 100%;
        overflow-x: hidden;
    }

    #menu-toggle {
        z-index: 1100 !important;
        position: relative;
        pointer-events: auto !important;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1050;
        display: none;
    }

    #wrapper.toggled .sidebar-overlay {
        display: block;
    }
}