/* Mobile-friendly styles for CRM2
 * These styles only apply to screens smaller than 768px
 * and don't affect the desktop experience
 */

@media (max-width: 767px) {
    /* Layout adjustments */
    .layout {
        grid-template-areas:
            "topnav"
            "main";
        grid-template-columns: 1fr;
        grid-template-rows: 52px 1fr;
        overflow-x: hidden;
    }

    /* Hide sidebar on mobile by default */
    .sidenav {
        position: fixed;
        left: -100%;
        top: 52px;
        bottom: 0;
        width: 80%;
        max-width: 300px;
        z-index: 1000;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    /* Show sidebar when active */
    .sidenav.active {
        left: 0;
    }

    /* Add hamburger menu button */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        padding: 0 15px;
    }

    /* Hide logo text on mobile */
    .logo span {
        display: none;
    }

    /* Adjust logo size */
    .logo {
        width: auto;
        padding: 6px 10px;
    }

    /* Adjust search bar */
    .search-bar {
        padding-left: 10px;
        max-width: calc(100% - 120px);
    }

    /* Main content adjustments */
    .main-content {
        grid-template-columns: 1fr;
        overflow-x: auto;
    }

    /* Page header adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px;
        gap: 10px;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }

    /* Table container adjustments */
    .table-container {
        overflow-x: auto;
        width: 100%;
    }

    /* Allow horizontal scrolling for the table */
    .table-container > div {
        overflow-x: auto !important;
        overflow-y: auto !important;
        width: 100%;
        max-width: 100vw;
    }

    /* Keep the table structure intact but allow scrolling */
    .member-table {
        min-width: 800px; /* Ensure table maintains minimum width */
    }

    /* Adjust pagination for mobile */
    .pagination-container {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    /* User dropdown adjustments */
    .user-actions {
        padding: 0 10px;
    }

    .user-dropdown-button {
        padding: 8px;
    }

    .user-dropdown-button span {
        display: none;
    }

    /* Add overlay for when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 52px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }
}