:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --sidebar-bg: #1e293b;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --body-bg: #f1f5f9;
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--body-bg);
    color: #334155;
    overflow: hidden; /* Prevent body scroll, handle in containers */
}

/* Sidebar Styling */
.sidebar { 
    width: 260px;
    height: 100vh;
    background-color: var(--sidebar-bg); 
    color: white; 
    box-shadow: 4px 0 24px rgba(0,0,0,0.05);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar .brand-section {
    padding: 20px;
    background: rgba(0,0,0,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar .nav-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    flex-grow: 1;
}

.sidebar .nav-link { 
    color: #94a3b8; 
    padding: 10px 24px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    display: flex;
    align-items: center;
}

.sidebar .collapse .nav-link {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
    font-size: 0.9rem;
}

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

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

.sidebar .nav-link:not(.collapsed) {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.sidebar .nav-link i {
    margin-right: 12px;
    font-size: 1.1rem;
    min-width: 24px; /* Ensure icon alignment */
    text-align: center;
}

/* Sidebar Submenu */
.sidebar .nav-link.collapsed .bi-chevron-down {
    transform: rotate(-90deg);
}

.sidebar .bi-chevron-down {
    transition: transform 0.2s ease;
    margin-left: auto; /* Push chevron to right */
    margin-right: 0 !important;
}

.sidebar .nav-link.text-muted {
    color: #64748b !important;
}

.sidebar .nav-link.text-light {
    color: #cbd5e1 !important;
}

/* Main Content */
.main-wrapper {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.content-wrapper { 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--body-bg);
    transition: margin-left 0.3s ease;
}

.top-navbar {
    background: white;
    padding: 16px 32px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    flex-shrink: 0;
}

.page-content {
    padding: 32px;
    overflow-y: auto;
    flex-grow: 1;
}

/* Cards */
.card { 
    border: none; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); 
    border-radius: 12px;
    background: white;
    margin-bottom: 24px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.card-header {
    background: white;
    border-bottom: 1px solid #f1f5f9;
    padding: 20px 24px;
    font-weight: 600;
    border-radius: 12px 12px 0 0 !important;
}

.card-body {
    padding: 24px;
}

/* Dashboard Specifics */
.summary-card {
    transition: transform 0.2s;
}

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

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom-width: 1px;
    background-color: #f8fafc;
    padding: 12px 16px;
    border-top: none;
}

.table td {
    vertical-align: middle;
    color: #334155;
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    padding: 0.5em 0.75em;
    font-weight: 600;
    border-radius: 6px;
}

/* Subtle Backgrounds (Bootstrap 5.3 Polyfill) */
.bg-primary-subtle { background-color: #e0e7ff; color: #3730a3; }
.bg-success-subtle { background-color: #dcfce7; color: #166534; }
.bg-warning-subtle { background-color: #fef9c3; color: #854d0e; }
.bg-danger-subtle { background-color: #fee2e2; color: #991b1b; }
.bg-info-subtle { background-color: #cffafe; color: #155e75; }
.bg-secondary-subtle { background-color: #f1f5f9; color: #475569; }

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        height: 100%;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .top-navbar {
        padding: 16px;
    }
    
    .page-content {
        padding: 16px;
    }
    
    /* Overlay when sidebar is open on mobile */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    
    .sidebar.show + .sidebar-overlay {
        display: block;
    }
}
