/* Responsive Design for Business Management System */

/* =======================================
   Tablet and Medium Screens (Max 1199px)
   ======================================= */
@media (max-width: 1199.98px) {

    /* Slightly compact sidebar for narrower screens */
    :root {
        --sidebar-width: 260px;
    }

    .search-form {
        width: 300px;
    }
}

/* =======================================
   Mobile and Tablets (Max 991px)
   ======================================= */
@media (max-width: 991.98px) {

    /* Sidebar hidden by default on mobile */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease-in-out;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    /* Main content expands to full width */
    .main-content {
        margin-left: 0;
        padding: 0 1rem 1rem 1rem;
    }

    /* Header Adjustments */
    .main-header {
        position: sticky;
        top: 0;
        z-index: 998;
        background: var(--bg-color);
        /* Match body bg to hide scroll content */
        padding-top: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Show toggle button which is hidden by default on desktop if any */
    .toggle-sidebar {
        display: block !important;
        font-size: 1.5rem;
        color: var(--text-primary);
        background: white;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: var(--shadow-card);
        border: none;
    }

    /* Hide full search form on smaller tablets/mobile to save space */
    .search-form {
        display: none;
    }

    /* If you want a mobile search icon instead, you'd toggle a search bar. 
       For now, we just hide the big bar. */

    .header-actions {
        gap: 12px;
    }

    /* Smaller user profile to just show avatar */
    .user-profile-header {
        padding: 0.25rem;
        border-radius: 50%;
        width: 44px;
        height: 44px;
        justify-content: center;
    }

    .user-profile-header .user-info,
    .user-profile-header i {
        display: none;
    }

    .user-avatar {
        margin: 0;
        width: 100%;
        height: 100%;
    }

    /* Stack stats cards */
    .row.g-4 {
        --bs-gutter-y: 1.5rem;
    }
}

/* =======================================
   Small Mobile Phones (Max 575px)
   ======================================= */
@media (max-width: 575.98px) {

    /* Header layout for very small screens */
    .main-header {
        padding: 0.5rem 0.5rem 0.5rem 0.5rem;
    }

    .header-actions {
        gap: 8px;
    }

    .header-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* Card padding reduction */
    .card {
        padding: 1rem;
        border-radius: 16px;
    }

    .card-title {
        font-size: 1.1rem;
    }

    /* Font size adjustments */
    body {
        font-size: 0.9rem;
    }

    h1.page-title {
        font-size: 1.3rem;
    }

    /* Tables need to scroll */
    .table-responsive {
        border-radius: 12px;
        border: 1px solid #eee;
    }

    .table th,
    .table td {
        white-space: nowrap;
        padding: 0.75rem;
    }

    /* Buttons full width on mobile actions */
    .header-actions .dropdown-menu {
        position: fixed !important;
        top: 70px !important;
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        width: auto !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        border: none;
        border-radius: 16px;
    }
}

/* =======================================
   Specific Mobile Fixes
   ======================================= */
/* Ensure toggle button is visible */
.toggle-sidebar {
    display: none;
    /* Hidden on desktop */
}

@media (max-width: 991.98px) {
    .toggle-sidebar {
        display: flex;
    }
}