:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --sidebar-width: 250px;
    --header-height: 60px;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f6f9;
    font-size: 0.9rem;
}

/* Sidebar Styles */
.sidebar {
    height: 100vh;
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--dark-color);
    padding-top: var(--header-height);
    transition: all 0.3s;
    z-index: 1000;
    overflow-y: auto; /* Enable scrolling */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* Sidebar Dropdown Styles */
.sidebar-dropdown-btn {
    padding: 10px 20px;
    text-decoration: none;
    font-size: 1rem;
    color: #b0b0b0;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    outline: none;
}
.sidebar-dropdown-btn:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}
.sidebar-dropdown-container {
    display: none;
    background-color: #2c3034;
    padding-left: 20px;
}
.sidebar-dropdown-btn.active + .sidebar-dropdown-container {
    display: block;
}
.fa-caret-down {
    float: right;
    padding-right: 8px;
}


/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar a {
    padding: 10px 20px;
    text-decoration: none;
    font-size: 1rem;
    color: #b0b0b0;
    display: block;
    transition: 0.3s;
    white-space: nowrap; /* Prevent text wrapping when collapsed */
    overflow: hidden;
}

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

.sidebar .brand {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding-left: 20px;
    background-color: #1a1e21;
    color: #fff;
    font-size: 1.25rem;
    font-weight: bold;
    text-decoration: none;
    border-bottom: 1px solid #333;
    z-index: 1001; /* Keep brand above scroll content */
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 0; /* Hide completely or use 70px for icon mode */
    overflow-x: hidden;
}

/* Content Area Adjustment */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 20px;
    padding-top: calc(var(--header-height) + 20px);
    transition: all 0.3s;
}

.main-content.expanded {
    margin-left: 0;
}

/* Header Adjustment */
.main-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: var(--header-height);
    background-color: #fff;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 999;
    transition: all 0.3s;
}

.main-header.expanded {
    left: 0;
    width: 100%;
}

/* Enhanced Card Styling */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.07);
    transition: transform 0.2s;
    margin-bottom: 1.5rem;
    background: #fff;
}

.card:hover {
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #edf2f9;
    padding: 1.25rem 1.5rem;
    font-weight: 700;
    color: #1e293b;
    border-radius: 0.75rem 0.75rem 0 0 !important;
}

.card-body {
    padding: 1.5rem;
    overflow-x: auto;
}

/* Enhanced Table Styling */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    vertical-align: middle;
    border-color: #dee2e6;
    background-color: #fff;
}

.table thead th {
    background-color: #343a40; /* Dark header for professional look */
    color: #fff;
    border-bottom: 2px solid #dee2e6;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody td {
    padding: 12px 15px;
    font-size: 0.95rem;
    border-bottom: 1px solid #f2f2f2;
    vertical-align: middle;
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover > tbody > tr:hover > * {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Mobile Responsiveness for Sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 1040;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        padding-top: calc(var(--header-height) + 10px);
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .main-header {
        left: 0;
        width: 100%;
    }

    /* Better touch targets */
    .btn, .form-control, .page-link {
        min-height: 44px;
    }
    
    .table thead th, .table tbody td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

/* Spacing Utilities */
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* Form Enhancements */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control:focus, .form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* Action Buttons in Tables */
.btn-action {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    margin: 0 2px;
}
