:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --dark-color: #2e353f;
    --light-bg: #f8f9fc;
    --card-bg: #ffffff;
    --text-color: #5a5c69;
    --heading-color: #2e353f;
    --sidebar-width: 250px;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--light-bg);
    color: var(--text-color);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--heading-color);
    font-weight: 600;
}

/* Wrapper & Sidebar */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    transition: all 0.3s;
}

#sidebar-wrapper {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--dark-color) !important;
    min-height: 100vh;
    transition: all 0.3s;
    box-shadow: 4px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;

    /* Mobile First: Hidden by default */
    margin-left: calc(-1 * var(--sidebar-width));
    position: fixed; /* Fixed on mobile to float over */
    height: 100%;
}

#sidebar-wrapper .sidebar-heading {
    padding: 1.5rem;
    font-size: 1.5rem;
    color: #fff;
    font-weight: 700;
    text-align: center;
    background: rgba(0,0,0,0.1);
}

#sidebar-wrapper .list-group-item {
    background-color: transparent;
    color: rgba(255,255,255,0.7);
    border: none;
    padding: 1rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

#sidebar-wrapper .list-group-item:hover,
#sidebar-wrapper .list-group-item.active {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border-left: 4px solid var(--primary-color);
    padding-left: calc(1.5rem - 4px);
}

#page-content-wrapper {
    width: 100%;
    padding: 0;
    transition: all 0.3s;
}

/* Sidebar Links */
.sidebar-link {
    display: block;
    padding: 1rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #fff;
    background-color: rgba(255,255,255,0.1);
    border-left-color: var(--primary-color);
}

/* Toggled States */

/* Mobile: When toggled, show sidebar */
#wrapper.toggled #sidebar-wrapper {
    margin-left: 0;
}

/* Desktop Styles */
@media (min-width: 768px) {
    #sidebar-wrapper {
        /* Desktop: Visible by default */
        margin-left: 0;
        position: relative; /* Relative on desktop to push content */
    }

    #page-content-wrapper {
        width: 100%;
    }

    /* Desktop: When toggled, hide sidebar */
    #wrapper.toggled #sidebar-wrapper {
        margin-left: calc(-1 * var(--sidebar-width));
    }
}

/* Navbar */
.navbar {
    background-color: #fff !important;
    box-shadow: 0 .15rem 1.75rem 0 rgba(58,59,69,.15) !important;
    padding: 0.8rem 1.5rem; /* Slightly smaller padding on mobile */
}

/* Cards & General UI */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58,59,69,.15);
    background-color: var(--card-bg);
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

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

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 700;
    color: var(--primary-color);
    border-top-left-radius: 0.75rem !important;
    border-top-right-radius: 0.75rem !important;
    padding: 1rem 1.25rem;
}

.btn {
    border-radius: 0.35rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover { background-color: #2e59d9; border-color: #2653d4; }

.table { color: var(--text-color); }
.table thead th {
    border-bottom: 2px solid #e3e6f0;
    color: var(--heading-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.badge { padding: 0.5em 0.75em; font-weight: 600; border-radius: 0.35rem; }

.form-control, .form-select {
    border-radius: 0.35rem;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d3e2;
}

.form-control:focus, .form-select:focus {
    border-color: #bac8f3;
    box-shadow: 0 0 0 0.2rem rgba(78,115,223,0.25);
}

/* KPI Cards Colors */
.bg-danger { background-color: var(--danger-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }

/* Menu Toggle Button Cursor */
#menu-toggle {
    cursor: pointer;
}
