/* Fali.ai CRM - Dedicated Mobile Styles */

@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* --- Sidebar Mobile --- */
    .sidebar {
        position: fixed !important;
        left: -285px !important;
        top: 0 !important;
        bottom: 0 !important;
        z-index: 2000 !important;
        width: 280px !important;
        display: flex !important;
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    }

    .sidebar.active {
        left: 0 !important;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(2px);
        z-index: 999;
    }

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

    /* --- Main View --- */
    .main-view {
        width: 100%;
        height: auto;
        min-height: 100vh;
    }

    .top-bar {
        padding: 0 1rem;
        height: 60px;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        background: white !important;
        z-index: 1500 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }

    .search-container {
        display: none; /* Hide search on small screens to save space */
    }

    /* --- Toggle Button --- */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: #f1f5f9;
        border-radius: 10px;
        border: none;
        cursor: pointer;
        color: var(--primary);
        font-size: 1.25rem;
        z-index: 1600 !important;
    }

    /* --- Content Area --- */
    .content-area {
        padding: 1rem;
        margin-top: 60px; /* Offset for fixed top bar */
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    /* --- Tables Responsiveness --- */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem; /* Full width scroll on mobile */
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    table {
        min-width: 600px; /* Force internal scroll for better data visibility */
    }

    th, td {
        padding: 0.75rem;
        font-size: 0.875rem;
    }

    /* --- Modals --- */
    .modal-content {
        padding: 1.5rem;
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* --- CRM Switcher --- */
    .crm-switcher {
        display: none; /* Usually hidden on mobile top-bar */
    }

    .dashboard-grid-1-1, .dashboard-grid-2-1 {
        grid-template-columns: 1fr;
    }

    /* --- RTL Mobile Overrides --- */
    [dir="rtl"] .sidebar {
        left: auto !important;
        right: -285px !important;
        transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        box-shadow: -10px 0 30px rgba(0,0,0,0.2);
    }

    [dir="rtl"] .sidebar.active {
        right: 0 !important;
    }

    [dir="rtl"] .top-bar {
        left: auto !important;
        right: 0 !important;
    }
}

/* Hide toggle btn on desktop */
.mobile-menu-btn {
    display: none;
}
