/* Aikya PMS - Modern PWA Styles */

:root {
    --primary-color: #6f1d1b;
    --secondary-color: #bb9457;
    --accent-wine: #701516;
    --bg-color: #f8fafc;
    --bg-premium: #fdfaf5; /* AIKYA Premium Cream */
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-dark: #334155;
    --text-muted: #64748b;
    --border-radius-lg: 20px;
    --border-radius-md: 12px;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    
    /* Premium Badge Tints */
    --badge-direct-bg: #fef3c7;
    --badge-direct-text: #92400e;
    --badge-date-bg: #ffe4e6;
    --badge-date-text: #e11d48;
    --badge-room-bg: #e0f2fe;
    --badge-room-text: #0369a1;
    --badge-location-bg: #dcfce7;
    --badge-location-text: #166534;
    --badge-guests-bg: #f3e8ff;
    --badge-guests-text: #7e22ce;
}

/* Mobile-First Reset & Core Layout */
body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* Responsive Dashboard/Property Grid Layout */
.dashboard-grid, .property-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: calc(var(--spacing-unit) * 3) !important;
    padding: calc(var(--spacing-unit) * 2) !important;
}

/* Modern Card Component */
.pwa-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: calc(var(--spacing-unit) * 3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(226, 232, 240, 0.8);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pwa-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pwa-card-header {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.pwa-card-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.pwa-card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Touch-Friendly Interactive Elements - Only buttons, not all inputs */
.btn, button {
    min-height: 40px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Form selects - sensible min-height but NOT flex so form-switch toggles work */
.form-control, .form-select {
    min-height: 40px;
}

/* Fix: Bootstrap form-switch checkboxes must NOT be affected by global overrides */
.form-check-input {
    min-height: unset !important;
    display: inline-block !important;
    width: 1.8em;
    height: 1em;
    margin-top: 0.25em;
    border-radius: 2em !important;
    cursor: pointer;
}

/* Fix: nav-link alignment */
.nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
}

.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
    box-shadow: 0 4px 6px rgba(111, 29, 27, 0.2);
}

.btn-primary:active {
    transform: scale(0.97);
}

/* Form Styling */
.form-control, .form-select {
    border: 1.5px solid #e2e8f0;
    background-color: #ffffff;
    padding: 10px 16px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block; /* Override inline-flex */
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(187, 148, 87, 0.1);
    outline: none;
}

/* Desktop Specific Adjustments */
@media (min-width: 1024px) {
    .dashboard-grid {
        padding: calc(var(--spacing-unit) * 4);
        gap: calc(var(--spacing-unit) * 4);
    }
    
    .pwa-card {
        padding: calc(var(--spacing-unit) * 4);
    }
}

/* Mobile Specific Adjustments */
@media (max-width: 640px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        padding: calc(var(--spacing-unit) * 2);
    }
    
    .pwa-card {
        border-radius: 10px;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
}

/* PWA Utility Classes */
.mt-8 { margin-top: calc(var(--spacing-unit) * 1); }
.mt-16 { margin-top: calc(var(--spacing-unit) * 2); }
.p-16 { padding: calc(var(--spacing-unit) * 2); }
.rounded-lg { border-radius: var(--border-radius); }
.shadow-none { box-shadow: none; }

/* Horizontal scrolling fix */
/* Bottom Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: #ffffff;
    display: none; /* Desktop hidden */
    grid-template-columns: repeat(5, 1fr);
    box-shadow: 0 -2px 15px rgba(0,0,0,0.08);
    z-index: 1030; /* Must be below Bootstrap modal backdrop (1040) and modal (1055) */
    border-top: 1px solid #e2e8f0;
}


.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    gap: 4px;
    transition: color 0.2s;
}

.bottom-nav-item i {
    font-size: 20px;
}

.bottom-nav-item.active {
    color: var(--primary-color);
}

.bottom-nav-item:active {
    background-color: #f1f5f9;
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: none; /* Desktop hidden */
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(111, 29, 27, 0.4);
    z-index: 9999;
    font-size: 24px;
    cursor: pointer;
    border: none;
}

/* High-Fidelity Premium Card (AIKYA Redesign) */
.mobile-cards-view {
    background: var(--bg-premium);
    padding: 10px 0;
}

.mobile-booking-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(0,0,0,0.03);
    display: none; 
    position: relative;
    border-left: none; /* Removed the previous border left */
}

.mbc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    margin-bottom: 12px;
}

.mbc-label-date {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.mbc-date-val {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--accent-wine);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mbc-id {
    flex-shrink: 0;
    font-size: 0.72rem;
    max-width: 48%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    background: #f8fafc;
    border-radius: 12px;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
}

.mbc-id:hover {
    background: #f1f5f9;
}

.mbc-contact-section {
    margin-bottom: 15px;
}

.mbc-guest {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.mbc-phone {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mbc-requirements {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.mbc-pill {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.pill-direct { background: var(--badge-direct-bg); color: var(--badge-direct-text); }
.pill-date { background: var(--badge-date-bg); color: var(--badge-date-text); }
.pill-room { background: var(--badge-room-bg); color: var(--badge-room-text); }
.pill-location { background: var(--badge-location-bg); color: var(--badge-location-text); }
.pill-guests { background: var(--badge-guests-bg); color: var(--badge-guests-text); }

.mbc-message-box {
    padding-top: 15px;
    border-top: 1px dashed #e2e8f0;
    margin-bottom: 15px;
}

.mbc-msg-label {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.mbc-msg-val {
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.4;
}

.mbc-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #f1f5f9;
}

.mbc-status-dropdown {
    border-radius: 20px !important;
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    padding: 0 15px !important;
    font-size: 0.85rem !important;
    height: 36px !important;
    color: #166534 !important;
    font-weight: 700 !important;
}

.mbc-actions {
    display: flex;
    gap: 15px;
}

.mbc-action-btn {
    font-size: 1.2rem;
    color: #3b82f6;
    cursor: pointer;
    transition: transform 0.2s;
}

.mbc-action-btn:active { transform: scale(0.9); }

/* Enquiry toolbar date range layout */
.enquiry-date-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.enquiry-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}
.enquiry-date-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.enquiry-date-input {
    width: auto;
    min-width: 150px;
    max-width: 200px;
}
.enquiry-stay-sort {
    width: auto;
    min-width: 160px;
}

/* Horizontal Scheduler Grid */
.scheduler-container {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.scheduler-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.scheduler-table th, .scheduler-table td {
    border: 1px solid #f1f5f9;
    padding: 10px;
    min-width: 60px;
    text-align: center;
}

.scheduler-sticky-col {
    position: sticky;
    left: 0;
    background: #f8fafc;
    z-index: 10;
    font-weight: 700;
    border-right: 2px solid #e2e8f0 !important;
    text-align: left !important;
    width: 100px;
    font-size: 0.85rem;
}

.scheduler-date-header {
    background: white;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.scheduler-date-val {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-dark);
}

.scheduler-booking-bar {
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 6px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #166534;
    padding: 0 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scheduler-booking-bar.balance-pending {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

/* Side Drawer & Hamburger Styles (Consolidated) */
.pms-hamburger {
    width: 48px;
    height: 48px;
    display: none; /* Hidden by default, shown in pms-header for desktop */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 1.8rem;
    border-radius: 50%;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.1);
    margin-right: 15px;
    z-index: 1051;
}

.pms-hamburger:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.tools-drawer {
    position: fixed;
    background: white;
    z-index: 10005;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.tools-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10004;
    display: none;
    backdrop-filter: blur(4px);
}

/* Mobile Quick Access (Bottom-Sheet) */
@media (max-width: 768px) {
    .tools-drawer {
        bottom: -100%;
        left: 0;
        width: 100%;
        height: auto;
        min-height: 400px;
        max-height: 80vh;
        border-radius: 24px 24px 0 0;
        padding: 24px 20px 80px;
        box-shadow: 0 -10px 25px rgba(0,0,0,0.1);
    }

    .tools-drawer.open {
        bottom: 0;
        left: 0; /* Override desktop left */
    }

    .tools-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .tool-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        text-align: center;
        font-size: 0.8rem;
        color: var(--text-dark);
        text-decoration: none;
        padding: 10px;
        border-radius: 12px;
        transition: background 0.2s;
    }

    .tool-icon {
        width: 56px;
        height: 56px;
        background: #f1f5f9;
        border-radius: 16px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.6rem;
        color: var(--primary-color);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }
}

/* Desktop Sidebar (Admin Menu) */
@media (min-width: 769px) {
    .pms-hamburger {
        display: flex;
    }

    .tools-drawer {
        top: 0;
        left: -350px;
        width: 320px;
        height: 100%;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
        padding: 0;
    }

    .tools-drawer.open {
        left: 0;
    }

    .drawer-header {
        padding: 24px 20px;
        background: linear-gradient(135deg, #6f1d1b 0%, #432818 100%);
        color: white;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-radius: 0;
    }

    .drawer-content {
        padding: 15px;
        overflow-y: auto;
        flex-grow: 1;
    }

    .tool-item {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 12px 16px;
        color: #4b5563;
        text-decoration: none;
        border-radius: 12px;
        margin-bottom: 6px;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        font-weight: 500;
        border: 1px solid transparent;
    }

    .tool-item:hover {
        background: #f8fafc;
        color: var(--primary-color);
        transform: translateX(5px);
        border-color: #f1f5f9;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    .tool-item .tool-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        background: #f1f5f9;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        transition: all 0.2s;
    }

    .tool-item:hover .tool-icon {
        background: white;
        transform: scale(1.05);
    }
}

/* Row Highlighting (Applies to ALL screen sizes) */
.highlight-row {
    background-color: #fef08a !important;
}
.highlight-row td {
    border-top: 2px solid #2563eb !important;
    border-bottom: 2px solid #2563eb !important;
}
.highlight-row td:not([style*="background-color"]) {
    background-color: #fef08a !important;
}
#upcomingMonthlyGrid .highlight-row .sticky-col,
#upcomingMonthlyGrid .highlight-row .sticky-col-2 {
    background-color: #fde047 !important;
}

/* Mobile Overrides */
@media (max-width: 768px) {
    body {
        padding-bottom: 70px; /* Space for bottom nav */
    }
    
    .bottom-nav, .fab {
        display: grid;
    }
    
    .fab {
        display: flex;
    }
    
    /* Hide desktop table elements on mobile if we show cards */
    .mobile-hide {
        display: none !important;
    }
    
    /* Reveal mobile cards in lists */
    .mobile-cards-view .mobile-booking-card {
        display: block;
    }
    
    .mobile-cards-view .table-responsive {
        display: none !important;
    }

    /* ====== PADDING FIXES ====== */
    /* Consistent page/card padding */
    .card.p-3 { padding: 8px 0 !important; border: none; box-shadow: none; border-radius: 0; }
    .enquiry-toolbar-card.card.p-3 {
        padding: 10px 12px !important;
        border: none !important;
        border-left: 4px solid #701516 !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        background: #fff;
    }
    .enquiry-date-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .enquiry-date-row {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    .enquiry-date-label {
        grid-column: 1 / -1;
    }
    .enquiry-date-input {
        min-width: 0;
        max-width: none;
        width: 100%;
    }
    .enquiry-date-actions {
        width: 100%;
    }
    .enquiry-stay-sort {
        flex: 1 1 auto;
        min-width: 0;
    }
    .mobile-cards-view { padding: 0 8px 0; background: #f8fafc; }
    #mobileEnquiriesList.mobile-cards-view {
        padding: 0 8px 72px !important;
    }
    .mobile-booking-card {
        margin-bottom: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    }
    .mbc-header { margin-bottom: 8px; }
    .mbc-contact-section { margin-bottom: 8px; }
    .mbc-guest { font-size: 1rem; }
    .mbc-phone { font-size: 0.85rem; }
    .mbc-requirements {
        gap: 6px;
        margin-bottom: 8px;
    }
    .mbc-pill {
        padding: 4px 8px;
        font-size: 0.68rem;
        border-radius: 6px;
        gap: 4px;
    }
    .mbc-message-box {
        padding-top: 8px;
        margin-bottom: 8px;
    }
    .mbc-msg-val { font-size: 0.85rem; }
    .mbc-footer {
        padding-top: 8px;
    }
    
    /* Bottom-Sheet Modals on Mobile */
    .modal {
        padding: 0 !important;
        overflow-x: hidden !important;
    }
    .modal-dialog { 
        margin: 0 auto !important; 
        display: flex !important; 
        align-items: flex-end !important; 
        justify-content: center !important;
        min-height: 100% !important; 
        max-width: 100% !important;
        width: 100% !important;
        pointer-events: none;
    }
    .modal-dialog > .modal-content,
    .modal-content { 
        pointer-events: auto;
        border-radius: 20px 20px 0 0 !important; 
        min-height: auto; 
        max-height: 88vh !important; 
        max-height: 88dvh !important;
        border: none !important; 
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important; 
        padding-bottom: 0 !important;
        width: 100% !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25) !important;
    }
    
    .modal-header {
        border-radius: 20px 20px 0 0 !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        padding: 12px 16px !important;
    }

    .modal-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        padding: 12px 14px !important;
    }

    .modal-footer {
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        background: #f8fafc !important;
        border-top: 1px solid #e2e8f0 !important;
    }

    /* Custom overlay modals (.edit-modal-overlay, .edit-modal) on Mobile */
    .edit-modal-overlay {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .edit-modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 88vh !important;
        max-height: 88dvh !important;
        border-radius: 20px 20px 0 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        margin: 0 !important;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25) !important;
    }
    .edit-modal-header {
        flex-shrink: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        padding: 12px 16px !important;
    }
    .edit-modal-tabs {
        flex-shrink: 0 !important;
    }
    .edit-modal-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain !important;
        padding: 12px 14px !important;
    }
    .edit-modal-footer {
        flex-shrink: 0 !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Specific modal fine-tuning for Send Payment QR & Photos */
    #enquiryPaymentSenderModal .modal-body {
        max-height: calc(88dvh - 110px) !important;
    }
    #enquiryPaymentSenderModal #enqPaymentPreviewQrImg {
        max-height: 120px !important;
    }
    #enquiryPaymentSenderModal .bg-\[\#efeae2\],
    #enquiryPhotosSenderModal .bg-\[\#efeae2\] {
        max-height: 240px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #enquiryPhotosSenderModal .modal-body {
        max-height: calc(88dvh - 110px) !important;
    }

    /* Enquiries Card Actions on Mobile */
    .mbc-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }
    .mbc-action-btn {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: #f1f5f9;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
        cursor: pointer;
        transition: transform 0.15s ease, background-color 0.15s ease;
    }
    .mbc-action-btn:active {
        transform: scale(0.92);
        background: #e2e8f0;
    }
    .mbc-status-select {
        height: 34px !important;
        font-size: 0.8rem !important;
        padding: 4px 8px !important;
        max-width: 120px;
        font-weight: 600;
    }

    
    /* Search bar mobile sizing */
    .mobile-search-bar {
        margin: 8px 12px 12px;
        padding: 10px 14px;
    }
    
    /* ====== HIDE DESKTOP FILTER UI ON MOBILE ====== */
    /* Show the filter row but heavily compress it so Date Range fits neatly */
    #allbookingsContent .card.p-3 {
        padding: 10px 12px 4px !important;
        background: transparent !important;
        border: none;
        box-shadow: none;
    }
    #allbookingsContent .d-flex.justify-content-between.align-items-center.mb-3 {
        margin-bottom: 4px !important;
        gap: 6px;
    }
    #allbookingsContent .d-flex.justify-content-between.align-items-center.mb-3 h5 {
        font-size: 1.05rem;
        margin: 0;
    }
    #allbookingsContent .d-flex.justify-content-between.align-items-center.mb-3 .btn {
        border-radius: 20px;
        height: 32px;
        font-size: 0.72rem;
        padding: 0 10px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #allbookingsContent .row.mb-3.g-2 {
        display: flex !important;
        flex-wrap: nowrap !important;
        margin: 0 0 8px 0 !important;
        padding: 0 8px !important;
        background: transparent !important; /* Remove the grey shadow box */
        box-shadow: none !important;
        align-items: center !important;
    }
    #allbookingsContent .row.mb-3.g-2 > div:nth-child(1),
    #allbookingsContent .row.mb-3.g-2 > div:nth-child(2) {
        display: none !important;
    }
    
    /* Force the Date Range, Reset, and Count Badge to fit on one line */
    #allbookingsContent .row.mb-3.g-2 > div:nth-child(3) {
        flex: 0 0 65% !important;
        max-width: 65% !important;
        padding-right: 4px;
    }
    #allbookingsContent .row.mb-3.g-2 > div:nth-child(4) {
        flex: 0 0 10% !important;
        max-width: 10% !important;
        padding: 0 4px;
    }
    #allbookingsContent .row.mb-3.g-2 > div:nth-child(5) {
        flex: 0 0 25% !important;
        max-width: 25% !important;
        text-align: right !important;
        padding-left: 4px;
    }
    
    #allbookingsContent .row.mb-3.g-2 .form-label {
        display: none !important; /* Hide 'Custom Date Range' label to align cleanly with buttons */
    }
    
    #allbookingsContent .row.mb-3.g-2 .input-group-sm input,
    #allbookingsContent .row.mb-3.g-2 .input-group-text {
        height: 34px !important;
        font-size: 0.78rem !important;
        padding: 4px 8px;
    }
    
    #bookingsCountBadge {
        font-size: 0.65rem !important;
        padding: 4px 6px !important;
        width: 100%;
        display: block;
        text-align: center;
    }
    
    /* Show the mobile search bar */
    .mobile-search-bar { 
        display: flex !important; 
        align-items: center;
        background: #f1f5f9 !important;
        border-radius: 50px !important;
        border: 1px solid #e2e8f0;
        height: 44px;
        padding: 0 16px !important;
        margin: 8px 12px 16px !important;
    }

    /* Fix search bar input - remove tall min-height */
    .mobile-search-bar input {
        height: 100% !important;
        min-height: unset !important;
        border: none !important;
        flex: 1;
        padding: 0 0 0 8px !important;
        font-size: 0.95rem;
        background: transparent !important;
        outline: none;
    }
    
    .mobile-search-bar i {
        color: #64748b;
        font-size: 1.1rem;
    }
    
    /* Monthly Booking Grid Header Mobile Compression */
    #upcomingGridContent .card.p-3 {
        padding: 8px 10px 4px !important;
    }
    .grid-top-header {
        align-items: flex-start !important;
    }
    .grid-top-header .grid-title {
        font-size: 1.05rem !important;
        width: 100%;
        text-align: left;
    }
    .grid-controls {
        width: 100%;
        justify-content: flex-end;
    }
    .grid-switch {
        margin: 0 !important;
    }
    .grid-date-range {
        width: 100% !important;
        margin-bottom: 4px;
    }
    .grid-date-range input, .grid-date-range span {
        height: 32px !important;
        font-size: 0.75rem !important;
        padding: 4px 6px;
    }
    .grid-action-btns {
        width: 100% !important;
        justify-content: flex-end !important;
        margin-top: 0 !important;
    }
    .grid-action-btns .btn {
        font-size: 0.72rem;
        height: 32px;
        display: flex;
        align-items: center;
    }
    
    /* Monthly Grid Legend Compression */
    .grid-legend {
        gap: 6px !important;
        font-size: 0.65rem !important;
        margin-bottom: 8px !important;
    }
    .grid-legend i {
        display: none; /* Hide icons in legend on mobile to save space */
    }
    
    /* ====== GRID FIXES ====== */
    /* Make the upcoming grid compact and readable */
    #upcomingGrid .grid-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 75vh;
    }

    #upcomingGrid .grid-table th,
    #upcomingGrid .grid-table td,
    #upcomingMonthlyGrid th,
    #upcomingMonthlyGrid td {
        font-size: 0.65rem !important;
        padding: 3px 4px !important;
    }

    /* Shrink the Guest column width on mobile */
    #upcomingMonthlyGrid td:nth-child(3n),
    #upcomingMonthlyGrid th[width="200"] {
        max-width: 80px !important;
        min-width: 60px !important;
        width: 60px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Sticky date/day cols in grid */
    #upcomingMonthlyGrid .sticky-col {
        position: sticky !important;
        left: 0;
        background: #f8fafc !important;
        z-index: 5;
        min-width: 28px !important;
        width: 28px !important;
        font-size: 0.65rem !important;
    }

    #upcomingMonthlyGrid .sticky-col-2 {
        position: sticky !important;
        left: 28px;
        background: #f8fafc !important;
        z-index: 5;
        min-width: 26px !important;
        width: 26px !important;
        font-size: 0.65rem !important;
    }
    
    /* Grid header – compact property names */
    #upcomingMonthlyGrid .prop-header-group {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* NOG column - small */
    #upcomingMonthlyGrid [width="40"],
    #upcomingMonthlyGrid th.prop-sep {
        min-width: 20px !important;
        width: 22px !important;
        font-size: 0.6rem !important;
    }

    /* Amount column */
    #upcomingMonthlyGrid [width="80"] {
        min-width: 40px !important;
        width: 44px !important;
        font-size: 0.6rem !important;
    }

    /* Grid top controls – allow vertical stacking and compact inputs */
    #upcomingGrid .card .d-flex.justify-content-between.align-items-center.mb-3 > div {
        flex-wrap: wrap;
        gap: 6px !important;
    }

    #upcomingGrid .input-group-sm {
        max-width: 140px;
    }

    #upcomingGrid .input-group-sm input.form-control {
        min-width: unset;
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* ====== HEADER FIXES ====== */
    /* Hide the top desktop header entirely on mobile to save vertical space */
    .header-banner {
        display: none !important;
    }

    /* ====== USER MANAGEMENT TOGGLES ====== */
    /* Ensure permission toggles are touch-friendly without overlapping */
    #userTable .form-check.form-switch {
        min-height: auto;
        padding-left: 2rem;
    }

    #userTable .form-check-input {
        width: 1.8em;
        height: 1em;
        min-height: unset !important;
    }

    /* Stack permission grid on mobile */
    #userTable .col-4 {
        width: 50%;
        flex: 0 0 50%;
    }

    /* User table horizontal scroll on mobile */
    #userMgmt .table-responsive {
        overflow-x: auto;
    }
}

/* Global grid guest name - truncate overflow */
.grid-guest-name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    font-size: 0.8rem;
    color: #1e293b;
}

.grid-guest-name:hover {
    text-decoration: underline;
    color: #6f1d1b;
}

/* Make the grid table wrapper respect the viewport width */
.grid-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* Modal and Search List Mobile Fixes */
@media (max-width: 576px) {
    .edit-modal-footer .d-flex {
        flex-direction: column !important;
        gap: 12px !important;
    }
    .edit-modal-footer div.d-flex {
        flex-direction: row !important; /* Keep Save/Delete side by side but full width */
        width: 100% !important;
        gap: 8px !important;
    }
    .edit-modal-footer div.d-flex .btn {
        flex: 1;
    }
}

#mobileSearchResultsList {
    padding-top: 10px;
    padding-bottom: 20px;
}

/* Premium Booking Preview Enhancements (Mobile) */
@media (max-width: 768px) {
    #bookingPreviewModal .modal-content {
        padding: 0;
        overflow-x: hidden;
    }
    #bookingPreviewModal .modal-body {
        padding: 1.25rem 1rem;
    }
    #previewExtraChargesCard {
        margin: 1rem -1rem; 
        border-radius: 0;
        border-left: none;
        border-right: none;
        box-shadow: none;
        background: #fff;
    }
    #previewExtraChargesCard .card-header {
        background: #fdf2f8 !important;
        border-bottom: 1px solid #fce7f3;
        padding: 12px 16px;
    }
    #previewExtraChargesList tr td {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    #addChargePreviewFormSection {
        padding: 1.25rem;
        background: #fff5f8;
        border-top: 1px dashed #f9a8d4;
        margin: 0;
    }
    /* Better spacing for bottom sheet inputs - compact and touch friendly */
    .modal-content select, 
    .modal-content input, 
    .modal-content textarea,
    .edit-modal select,
    .edit-modal input,
    .edit-modal textarea {
        font-size: 14px !important; 
        padding: 8px 12px !important;
        min-height: 38px;
    }
    .modal-content .form-select-sm,
    .modal-content .form-control-sm,
    .edit-modal .form-select-sm,
    .edit-modal .form-control-sm {
        padding: 6px 10px !important;
        font-size: 13px !important;
        min-height: 34px;
    }
}
