/* ================================================================
   RESPONSIVE MOBILE STYLES - Agency Management System
   ================================================================ */

/* ---- Sidebar Toggle Button (hidden on desktop) ---- */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 2000;
    background: #1e293b;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}
.sidebar-toggle:hover { background: #334155; }
[dir="rtl"] .sidebar-toggle { left: auto; right: 15px; }

/* ---- Mobile Overlay ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ================================================================
   MOBILE BREAKPOINT: max-width 767px
   ================================================================ */
@media (max-width: 767.98px) {

    /* ---- Show toggle button ---- */
    .sidebar-toggle { display: block; }

    /* ---- Sidebar ---- */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        z-index: 1500;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    [dir="rtl"] .sidebar {
        left: auto;
        right: -280px;
        transition: right 0.3s ease;
    }
    .sidebar.active { left: 0; }
    [dir="rtl"] .sidebar.active { left: auto; right: 0; }

    .sidebar .brand { padding: 20px; font-size: 1.2rem; }
    .sidebar a { padding: 12px 16px; font-size: 0.85rem; margin: 3px 8px; }

    /* ---- Main Content ---- */
    .main-content {
        padding: 60px 12px 20px !important;
        margin-left: 0 !important;
    }
    [dir="rtl"] .main-content { margin-right: 0 !important; }

    /* ---- Top Bar ---- */
    .top-bar {
        padding: 12px 15px !important;
        border-radius: 14px !important;
        margin-bottom: 15px !important;
        flex-wrap: wrap;
        gap: 10px;
    }
    .top-bar h5 { font-size: 0.95rem; }

    /* ---- Cards ---- */
    .card.shadow-luxury,
    .card.shadow-sm {
        border-radius: 16px !important;
        margin-bottom: 15px !important;
        overflow: visible;
    }
    .card-body { padding: 15px !important; overflow-x: auto; }
    .card-body.p-5 { padding: 15px !important; }
    .card-body.p-4 { padding: 12px !important; }
    .card-body.p-3 { padding: 10px !important; }

    /* ---- Tables: horizontal scroll + compact ---- */
    .table-responsive { border-radius: 12px; }
    .card-body { overflow-x: auto; }
    table.table { min-width: 500px; white-space: nowrap; }
    .table thead th { padding: 8px 8px !important; font-size: 0.65rem !important; white-space: nowrap; }
    .table tbody td { padding: 8px 8px !important; font-size: 0.78rem !important; white-space: nowrap; }
    .table { font-size: 0.75rem; }
    @media (max-width: 500px) {
        .table .d-none-mobile { display: none !important; }
        table.table { min-width: 400px; }
        .table-container {
            overflow: auto;
        }
    }

    /* ---- Forms ---- */
    .form-control, .form-select, input[type="text"], input[type="email"],
    input[type="password"], input[type="url"], input[type="date"],
    input[type="number"], textarea {
        font-size: 14px !important;
        padding: 8px 12px !important;
        border-radius: 10px !important;
    }
    .form-label { font-size: 0.8rem !important; margin-bottom: 4px !important; }
    .input-group-text { padding: 8px 10px !important; font-size: 0.85rem !important; }

    /* ---- Buttons ---- */
    .btn { font-size: 0.82rem !important; padding: 6px 12px !important; border-radius: 10px !important; }
    .btn-sm { font-size: 0.75rem !important; padding: 4px 8px !important; }
    .btn-lg { font-size: 0.9rem !important; padding: 10px 16px !important; }
    .w-100 { width: 100% !important; }

    /* ---- Headings ---- */
    h2 { font-size: 1.1rem !important; }
    h3 { font-size: 1rem !important; }
    h4 { font-size: 0.95rem !important; }
    h5 { font-size: 0.9rem !important; }

    /* ---- Row / Grid ---- */
    .row { margin-left: -8px; margin-right: -8px; }
    .row > [class*="col-"] { padding-left: 8px; padding-right: 8px; }
    .row.justify-content-between { margin-bottom: 10px !important; }

    /* ---- Badges ---- */
    .badge { font-size: 0.65rem !important; padding: 3px 6px !important; }

    /* ---- Rounded corners smaller ---- */
    .rounded-3xl { border-radius: 16px !important; }
    .rounded-2xl { border-radius: 12px !important; }

    /* ---- Margin / Spacing ---- */
    .mb-4 { margin-bottom: 1rem !important; }
    .mb-3 { margin-bottom: 0.75rem !important; }
    .mt-8 { margin-top: 1.5rem !important; }
    .p-5 { padding: 1rem !important; }
    .gap-3 { gap: 0.5rem !important; }
    .gap-2 { gap: 0.3rem !important; }

    /* ---- Flex wrap ---- */
    .d-flex { flex-wrap: wrap; }
    .justify-content-between { gap: 8px; }

    /* ---- Notification dropdown ---- */
    .notification-dropdown {
        position: fixed !important;
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-height: 70vh;
        overflow-y: auto;
    }

    /* ---- Modal (child task) ---- */
    .modal-content {
        max-width: 95% !important;
        padding: 16px !important;
    }

    /* ---- Page header row ---- */
    .row.justify-content-between.align-items-center.mb-4 {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }
    .row.justify-content-between.align-items-center.mb-4 > .col-auto {
        width: 100%;
    }
    .row.justify-content-between.align-items-center.mb-4 > .col-auto.d-flex {
        justify-content: space-between;
    }

    /* ---- Grid cols 2 ---- */
    .grid-cols-2 { grid-template-columns: 1fr !important; gap: 12px !important; }

    /* ---- Stats / Dashboard cards ---- */
    .text-center.py-4 { padding: 12px !important; }

    /* ---- Child tasks table ---- */
    .badge.bg-warning-100 { font-size: 0.6rem !important; }

    /* ---- Deliverable items ---- */
    .list-unstyled li { font-size: 0.8rem !important; padding: 4px 0 !important; }

    /* ---- Sidebar nav badge (count) ---- */
    .sidebar .badge {
        font-size: 0.6rem !important;
        padding: 2px 5px !important;
    }

    /* ---- Filters / Search ---- */
    .form-select, select.form-control {
        font-size: 13px !important;
        padding: 6px 10px !important;
    }

    /* ---- Pagination ---- */
    .pagination { flex-wrap: wrap; gap: 4px; }
    .page-link { padding: 6px 10px !important; font-size: 0.8rem !important; }
}

/* ================================================================
   SMALL PHONES: max-width 400px
   ================================================================ */
@media (max-width: 400px) {
    .main-content { padding: 55px 8px 15px !important; }
    .card-body { padding: 10px !important; }
    .card-body.p-5 { padding: 10px !important; }
    .top-bar { padding: 10px !important; }
    .btn { font-size: 0.78rem !important; padding: 5px 8px !important; }
    h2 { font-size: 0.95rem !important; }
    .table thead th { font-size: 0.6rem !important; padding: 8px 6px !important; }
    .table tbody td { padding: 8px 6px !important; font-size: 0.75rem !important; }
}
