/* ==========================================================================
   HMS AVAILABILITY LEDGER - PREMIUM SaaS DESIGN
   ========================================================================== */

/* 1. SCROLL CONTAINER - The window that holds the ledger */
.hms-availability-scroll-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: #fff;
    position: relative;
}

/* 2. THE GRID STRUCTURE */
.hms-avail-grid {
    border-collapse: separate !important;
    border-spacing: 0 8px !important; /* CRITICAL: Adds 8px gap between rows */
    width: max-content !important;
    background: transparent !important; /* Transparent so gaps show the background */
}

/* 3. FROZEN ROOM TYPE COLUMN (High Priority Fix) */
.hms-avail-grid th:first-child,
.hms-avail-grid td:first-child {
    position: -webkit-sticky !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 100 !important; /* Layers it above the scrolling dates */
    
    /* Solid background is CRITICAL to hide dates behind it */
    background-color: #ffffff !important; 
    
    /* Dimensions to prevent collapsing */
    min-width: 200px !important;
    width: 200px !important;
    
    /* Aesthetics */
    padding: 15px 20px !important;
    border-right: 2px solid #e2e8f0 !important;
    box-shadow: 6px 0 10px -5px rgba(0,0,0,0.1) !important;
    text-align: left !important;
}

/* Header Column specifically */
.hms-avail-grid thead th:first-child {
    background-color: #f8fafc !important;
    z-index: 110 !important; /* Stays above body frozen cells */
}

/* 4. DATE CELLS STYLING */
.hms-avail-grid thead th {
    background: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-right: 1px solid #f1f5f9 !important;
    color: #64748b !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    padding: 12px !important;
    min-width: 50px;
}

.hms-avail-cell {
    position: relative !important;
    padding: 8px !important;
    cursor: pointer !important;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}

/* 5. STOCK PILLS (SaaS Style) */
.hms-avail-input {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    width: 100% !important;
    height: 36px !important;
    text-align: center;
    border-radius: 6px;
    border: none !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) !important;
}

.hms-avail-ok { background-color: #f0fdf4 !important; border: 1px solid #bbf7d0 !important; color: #166534 !important; }
.hms-avail-low { background-color: #fffbeb !important; border: 1px solid #fde68a !important; color: #92400e !important; }
.hms-avail-soldout { background-color: #fef2f2 !important; border: 1px solid #fecaca !important; color: #991b1b !important; opacity: 1 !important; }

/* 6. HOVER ADD-BOOKING INTERACTION */
.hms-add-booking-indicator {
    display: none;
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: var(--hms-primary);
    color: white;
    width: 32px; height: 32px;
    border-radius: 8px;
    text-align: center;
    line-height: 32px;
    font-size: 20px;
    z-index: 60;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.hms-avail-cell:hover .hms-add-booking-indicator { display: block !important; }
.hms-avail-cell:hover .hms-avail-input { opacity: 0 !important; }

/* 7. GUEST DETAILS TAG (🛒) */
.wc-booked-tag {
    position: absolute !important;
    top: -6px; right: -6px;
    z-index: 50 !important;
    background: #0f172a !important;
    color: white !important;
    width: 24px; height: 24px;
    border-radius: 8px !important;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    border: 2px solid #fff;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2);
}

/* 8. MANUAL BOOKING MODAL TABLES (Separated Card Rows) */
.hms-manual-room-table {
    width: 100%;
    border-collapse: separate !important;
    border-spacing: 0 10px !important;
    background: transparent !important;
}

.hms-manual-room-table tbody tr {
    background: #fff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.hms-manual-room-table td {
    padding: 15px !important;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

/* Disable row transform to prevent sticky breakage */
.hms-avail-grid tbody tr { transform: none !important; }

/* 9. LEDGER SPECIFIC SCROLLBAR */
/* 9. PREMIUM FLUID SCROLLING */
.hms-availability-scroll-container {
    cursor: grab; /* Shows the 'hand' icon so users know they can pull it */
    user-select: none; /* Prevents accidental text highlighting while dragging */
    scrollbar-width: none; /* Hides scrollbar for Firefox */
}

.hms-availability-scroll-container:active {
    cursor: grabbing; /* Shows 'closed hand' when clicking */
}

/* Hide scrollbar for Chrome/Safari but keep functionality */
.hms-availability-scroll-container::-webkit-scrollbar {
    display: none; 
}
.hms-availability-scroll-container::-webkit-scrollbar-track { background: #f8fafc; border-radius: 0 0 12px 12px; }
.hms-availability-scroll-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
.hms-availability-scroll-container::-webkit-scrollbar-thumb:hover { background: var(--hms-primary); }


.hms-table tbody td{
    background: #ffffff !important;
    vertical-align: middle;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    width: 100px;
}



/* FORCE SOLID BACKGROUND TO BLOCK GHOSTS */
.hms-modal-content {
    background: #ffffff !important;
    opacity: 1 !important;
    z-index: 99999999 !important; /* Ensure it is the top-most layer */
    box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* Ensure the overlay itself is the only thing dark */
.hms-modal-overlay.active {
    display: flex !important;
    background: rgba(0, 0, 0, 0.75) !important; /* Solid dark overlay */
    backdrop-filter: blur(5px) !important; /* Blurs the ghosts in the background */
    z-index: 9999999 !important;
}

/* Specific styling for the guest info rows to match premium design */
.hms-guest-info-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Ensure the email ghost NEVER shows on this tab */
.hms-email-overlay {
    display: none !important;
}

/* Make the Guest Modal content solid white */
#hms-booking-modal .hms-modal-content {
    background: #ffffff !important;
    opacity: 1 !important;
    z-index: 9999999 !important;
}

/* 2. The Inner Mode Wrappers MUST take up available space and stop expanding */
#hms-modal-view-mode[style*="display: block"],
#hms-modal-view-mode[style*="display: flex"],
#hms-modal-edit-mode[style*="display: block"],
#hms-modal-edit-mode[style*="display: flex"] {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important; 
    min-height: 0 !important; 
    height: 100% !important;
}




/* 3. The Header & Footer MUST NEVER shrink */
.modal-top, .hms-modal-footer {
    flex-shrink: 0 !important;
}

/* 4. The Body is the ONLY part allowed to scroll */
.hms-modal-body-scroll {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    /*min-height: 0 !important; */
    height: auto;
    max-height: 65vh;
}


/* =========================================================
   FORCE BUTTON VISIBILITY STATES
   ========================================================= */
#hms-finish-btn[style*="display: none"],
#hms-finish-btn[style*="display:none"],
#hms-manual-setup-actions[style*="display: none"],
#hms-manual-setup-actions[style*="display:none"] {
    display: none !important;
}





/* =========================================================
   PREMIUM SHIMMER SKELETON LOADER
   ========================================================= */
.hms-skeleton-box {
    background-color: #e2e8f0; /* Soft slate background */
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

/* The light beam element */
.hms-skeleton-box::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.5) 20%,
        rgba(255, 255, 255, 0.8) 60%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: hms-shimmer-wave 1.5s infinite;
}

@keyframes hms-shimmer-wave {
    100% {
        transform: translateX(100%);
    }
}




#hms-booking-modal {
    z-index: 99999999 !important;
}

#hms-email-modal,
#hms-radar-modal {
    z-index: 9999999 !important;
}


.hms-focused-manual-room td {
    background: #ecfdf5 !important;
    border-top: 1px solid #34d399 !important;
    border-bottom: 1px solid #34d399 !important;
    box-shadow: inset 4px 0 0 var(--hms-primary);
}

.hms-focused-manual-room td:first-child strong::after {
    content: "Selected";
    display: inline-block;
    margin-left: 10px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}