:root {
    --primary: #1e40af;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text: #0f172a;
    --border: #e2e8f0;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
}

/* Global Reset to eliminate default browser gaps */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text);
    box-sizing: border-box;
    overflow-x: hidden;
}

*, *:before, *:after {
    box-sizing: inherit;
}

/* Fixed Sidebar */
#sidebar {
    width: 240px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background: #0f172a;
    color: #fff;
    padding-top: 20px;
    z-index: 1000;
    overflow-y: auto;
}

#sidebar .brand {
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
}

#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar ul li a {
    display: block;
    color: #94a3b8;
    padding: 12px 20px;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

#sidebar ul li a:hover {
    background: #1e293b;
    color: #fff;
}

/* Main Content Area (Pushed right to clear the fixed sidebar) */
#main-content {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - 240px);
}

/* Topbar */
.topbar {
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 0 25px;
    border-bottom: 1px solid var(--border);
    width: 100%;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Page Container & Cards */
.container {
    max-width: 100%;
    padding: 25px;
    flex: 1;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card .title {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
}

.card .value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 5px;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f1f5f9;
    font-weight: 600;
}

/* Forms & Buttons */
.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.85rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-control {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    background: #e2e8f0;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

/* ==========================================
   RESPONSIVE MEDIA QUERIES (Mobile & Tablets)
   ========================================== */

@media (max-width: 768px) {
    /* On smaller screens, make the sidebar slide off-screen or hide/stack */
    #sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    /* When sidebar is hidden, main content takes full width */
    #main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* Adjust topbar padding for smaller screens */
    .topbar {
        padding: 0 15px;
    }

    .topbar .user-profile span {
        display: none; /* Hide welcome text on very small screens to save space */
    }

    /* Make container padding tighter on mobile */
    .container {
        padding: 15px;
    }

    /* Stack grid cards into a single column */
    .card-grid {
        grid-template-columns: 1fr !important;
    }
}