/* Mobile Responsiveness */
.mobile-header-bar {
    display: none;
}

@media (max-width: 768px) {

    /* Mobile Header Bar - Visible */
    .mobile-header-bar {
        display: flex;
        align-items: center;
        padding-bottom: 15px;
        margin-bottom: 15px;
        border-bottom: 1px solid var(--border);
    }

    .mobile-header-bar h2 {
        font-size: 1.2rem;
        margin-left: 10px;
        color: var(--primary);
    }

    /* 1. Sidebar starts hidden (off-canvas) */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 250px;
        /* Slight adjustment */
    }

    /* Active class to slide it in */
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }

    /* 2. Main content takes full width */
    .main-content {
        margin-left: 0;
        padding: 15px;
        /* Reduce padding */
    }

    /* 3. Header adjustments for Toggle Button */
    .page-header {
        flex-direction: row;
        /* Keep row */
        align-items: center;
        gap: 15px;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 1.25rem;
    }

    /* Toggle Button (Visible only on mobile) */
    .sidebar-toggle {
        display: block !important;
        /* Force show */
        font-size: 1.5rem;
        cursor: pointer;
        color: var(--dark);
        background: none;
        border: none;
        padding: 5px;
    }

    /* 4. Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* 5. Stats Grid - Single Column */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .stat-card {
        margin-bottom: 0;
        /* grid gap handles it */
    }

    /* 6. Form Rows - Stack vertically */
    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .form-group.half,
    .form-group.third {
        width: 100%;
        flex: 1 1 100%;
    }

    /* 7. Tables - Horizontal Scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 20px;
        border: 1px solid var(--border);
        /* Visual hint */
        border-radius: 6px;
    }

    .data-table,
    .simple-table {
        min-width: 600px;
        /* Force scroll */
    }

    /* 8. Modals */
    .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 85vh;
        padding: 20px;
    }

    /* 9. Login Wrapper */
    .auth-box {
        width: 90%;
        padding: 25px;
    }
}

/* Ensure Toggle is hidden on Desktop */
.sidebar-toggle {
    display: none;
}