/**
 * RoomGrid Scheduler Frontend CSS
 * Version 4.6.20 - In sync with plugin; see assets/css/frontend-changelog.md
 */

/* RoomGrid Scheduler front-end styles */
.modal-backdrop {
    z-index: 100000 !important;
}

.modal-backdrop.show {
    opacity: 0.5 !important;
}

.modal {
    z-index: 100001 !important;
}

/* Customer view privacy styling */
.bookedroomtime.customer-view {
    cursor: default !important;
}

.bookedroomtime.customer-view:hover {
    background-color: #dc3545 !important;
    transform: none !important;
}

.bookedroomtime.customer-view span {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
}

/* Hide WordPress footer on RoomGrid pages */
body.roomgrid-page #wpfooter,
#wpfooter {
    display: none !important;
}

/* Additional footer hiding for admin pages */
.roomgrid-admin #wpfooter,
.toplevel_page_roomgrid_scheduler #wpfooter,
.roomgrid_page_roomgrid_settings #wpfooter,
.roomgrid_page_roomgrid_email #wpfooter,
.roomgrid_page_roomgrid_bookings #wpfooter {
    display: none !important;
}

/* Plugin-specific modals - sit above WordPress Admin Bar */
#roomgridModal,
#edit-reservation-modal,
#admin-booking-modal {
    z-index: 100001 !important;
}

/* Enhanced Modal Backdrop with Blur */
.modal-backdrop.show {
    opacity: 0.6 !important;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Modern Modal Styles - Perfect Centering */
#roomgridModal .modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 2rem);
    margin: 1rem auto;
    max-width: 90vw;
    width: auto;
}

#roomgridModal .modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.98);
    max-width: 600px;
    width: 100%;
    transform: scale(0.95);
    transition: all 0.3s ease;
}

#roomgridModal.show .modal-content {
    transform: scale(1);
}

#roomgridModal .modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: relative;
}

#roomgridModal .modal-header .modal-title {
    font-weight: 600;
    font-size: 1.25rem;
    margin: 0;
    color: white;
}

#roomgridModal .modal-header .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

#roomgridModal .modal-header .btn-close:hover {
    opacity: 1;
}

#roomgridModal .modal-body {
    color: var(--text-color) !important;
    background-color: #ffffff !important;
    padding: var(--spacing-lg);
    line-height: var(--line-height);
}

#roomgridModal .modal-footer {
    background-color: #f8fafc !important;
    border-top: 1px solid #e5e7eb;
    padding: var(--spacing-lg);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

#roomgridModal .form-label,
#roomgridModal .form-control,
#roomgridModal .btn,
#roomgridModal .modal-title,
#roomgridModal #roomgrid-selection-summary {
    color: var(--text-color) !important;
}

#roomgridModal .form-control {
    background-color: #ffffff !important;
    border: 2px solid #e5e7eb !important;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.2s ease;
}

#roomgridModal .form-control:focus {
    border-color: var(--primary-color) !important;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
    transform: translateY(-1px);
}

#roomgridModal .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
}

#roomgridModal .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.4);
}

#roomgridModal .btn-secondary {
    background: #f3f4f6;
    color: var(--text-color);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

#roomgridModal .btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

#roomgridModal #roomgrid-selection-summary {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 1rem;
}

#roomgridModal .selection-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

#roomgridModal .selection-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

#roomgridModal .selection-item strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Responsive adjustments - Mobile First */
@media (max-width: 767px) {
    #roomgridModal .modal-dialog {
        min-height: 100vh;
        margin: 0;
        max-width: 100vw;
        padding: 0;
    }
    
    #roomgridModal .modal-content {
        border-radius: 0;
        min-height: 100vh;
        max-width: 100vw;
        margin: 0;
        transform: scale(1);
    }
    
    #roomgridModal .modal-header,
    #roomgridModal .modal-body,
    #roomgridModal .modal-footer {
        padding: 1rem;
    }
    
    #roomgridModal .modal-header {
        border-radius: 0;
        padding: 1.25rem 1rem;
    }
    
    #roomgridModal .modal-footer {
        border-radius: 0;
        padding-bottom: 2rem; /* Extra padding for mobile */
    }
    
    #roomgridModal .form-control {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    #roomgridModal .btn {
        padding: 0.875rem 1.25rem;
        font-size: 16px;
    }
    
    #roomgridModal .modal-title {
        font-size: 1.125rem;
    }
}

@media (max-width: 480px) {
    #roomgridModal .modal-header,
    #roomgridModal .modal-body,
    #roomgridModal .modal-footer {
        padding: 0.75rem;
    }
    
    #roomgridModal .form-control {
        padding: 0.75rem 0.875rem;
    }
    
    #roomgridModal .btn {
        padding: 0.75rem 1rem;
        font-size: 15px;
    }
}

/* Responsive grid container */
.roomgrid-wrapper {
    overflow: visible !important;
    padding-top: 2rem;
}

/* Add breathing room for Book button container */
.roomgrid-wrapper .d-flex.justify-content-between {
    margin-top: 1rem;
}

.roomgrid-table {
    width: 100%;
}

/* Admin grid desktop optimizations - only on non-mobile devices */
@media (min-width: 1200px) and (pointer: fine) {
    .roomgrid-admin-full-width {
        overflow-x: auto; /* Allow horizontal scroll if needed on smaller laptops */
        max-width: 100% !important;
        width: 100% !important;
    }
    .roomgrid-admin .roomgrid-table {
        width: 100%;
        min-width: 1000px; /* Ensure table is wide enough for all rooms */
        table-layout: fixed !important; /* Fixed layout for consistent column widths */
    }
    .roomgrid-admin .roomgrid-table th,
    .roomgrid-admin .roomgrid-table td {
        min-width: 120px; /* Prevent text wrapping */
        max-width: 200px; /* Prevent excessive stretching */
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden; /* Hide overflow */
        text-overflow: ellipsis; /* Show ellipsis for long text */
    }
}

@media (min-width: 1400px) and (pointer: fine) {
    .roomgrid-admin-full-width {
        padding: 0;
        margin: 0 -15px;
        overflow-x: auto; /* Allow horizontal scroll if needed */
    }
    .roomgrid-admin .roomgrid-table {
        font-size: 15px;
        width: 100%;
        min-width: 1200px; /* Ensure table is wide enough for all rooms */
        table-layout: fixed !important; /* Fixed layout for consistent column widths */
    }
    .roomgrid-admin .roomgrid-table th,
    .roomgrid-admin .roomgrid-table td {
        min-width: 140px;
        max-width: 250px; /* Prevent excessive stretching */
        white-space: nowrap; /* Prevent text wrapping */
        overflow: hidden; /* Hide overflow */
        text-overflow: ellipsis; /* Show ellipsis for long text */
    }
}

/* Mobile-friendly touch targets */
@media (max-width: 767px) {
    .roomgrid-table td.bookedroomtime {
        min-width: 120px;
        min-height: 60px;
        padding: 12px 8px;
        font-size: 14px;
    }

    .roomgrid-table th {
        font-size: 14px;
        padding: 12px 8px;
    }

    .roomgrid-wrapper h3 {
        font-size: 20px;
    }

    .btn {
        padding: 12px 16px;
        font-size: 16px;
    }
}

.roomgrid-wrapper h3 {
    font-weight: 600;
}

.roomgrid-table th,
.roomgrid-table td {
    text-align: center;
    vertical-align: middle;
}

/* Time column header - consistent styling */
.roomgrid-table th:nth-child(1) {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    color: #495057 !important;
    font-weight: 700 !important;
}

/* Admin grid Time column header - proper styling */
.roomgrid-admin .roomgrid-table th:nth-child(1),
.roomgrid-admin .modern-table th:nth-child(1) {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    color: #495057 !important;
    font-weight: 700 !important;
}

.roomgrid-table td.bookedroomtime {
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    min-width: 110px;
    min-height: 52px;
    padding: 8px 4px;
}

.roomgrid-table td.bookedroomtime.available {
    background: #ffffff;
}

/* Room-specific selected styles */
.roomgrid-table td.bookedroomtime.selected[data-room="1"] {
    background: var(--room-1-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-1-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="2"] {
    background: var(--room-2-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-2-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="3"] {
    background: var(--room-3-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-3-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="4"] {
    background: var(--room-4-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-4-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="5"] {
    background: var(--room-5-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-5-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="6"] {
    background: var(--room-6-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-6-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="7"] {
    background: var(--room-7-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-7-dark) !important;
}

.roomgrid-table td.bookedroomtime.selected[data-room="8"] {
    background: var(--room-8-primary) !important;
    color: #ffffff !important;
    border-color: var(--room-8-dark) !important;
}

.roomgrid-table td.bookedroomtime.reserved {
    background: #e0e0e0;
    color: #6c757d;
    cursor: not-allowed;
}

.roomgrid-table td.bookedroomtime.closed {
    background-color: #6c757d !important; /* Grey */
    color: #ffffff !important;
    cursor: not-allowed !important;
    pointer-events: none !important; /* strictly prevents clicking */
    opacity: 0.6;
    border: 1px solid #495057 !important;
}

/* CRITICAL FIX: Higher specificity rules to prevent overrides */
.roomgrid-table tbody td.bookedroomtime.closed {
    background-color: #6c757d !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.6 !important;
    border: 1px solid #495057 !important;
}

/* CRITICAL FIX: Modern table override prevention */
.modern-table tbody td.bookedroomtime.closed {
    background-color: #6c757d !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.6 !important;
    border: 1px solid #495057 !important;
}

/* CRITICAL FIX: Admin table override prevention */
.roomgrid-admin .modern-table tbody td.bookedroomtime.closed {
    background-color: #6c757d !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.6 !important;
    border: 1px solid #495057 !important;
}

/* CRITICAL FIX: Holiday-blocked attribute protection */
.bookedroomtime.closed[data-holiday-blocked="true"] {
    background-color: #6c757d !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.6 !important;
    border: 1px solid #495057 !important;
}

.bookedroomtime.closed:hover {
    background-color: #5a6268 !important;
}

#roomgrid-selection-summary ul {
    padding-left: 18px;
}

.roomgrid-admin .card {
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Admin responsiveness */
@media (max-width: 767px) {
    .roomgrid-admin .wrap {
        padding: 10px;
    }

    .roomgrid-admin .card {
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .roomgrid-admin .table-responsive {
        font-size: 14px;
    }

    .roomgrid-admin .btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    .roomgrid-admin h1 {
        font-size: 24px;
    }

    .roomgrid-admin .h4 {
        font-size: 18px;
    }
}

/* Input group alignment for date picker */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    flex: 1;
    height: 48px;
    min-height: 48px;
    padding: 12px 16px;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    font-size: 16px;
    line-height: 1.5;
}

/* Date picker text color visibility fix */
#roomgrid-date-picker,
#admin-date-picker {
    color: #212529 !important;
    background-color: #ffffff !important;
    height: 48px !important;
    min-height: 48px !important;
}

.input-group .form-control:focus {
    color: #212529 !important;
    background-color: #ffffff !important;
}

.input-group .btn {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    height: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
}

.input-group .btn i {
    font-size: 18px;
}

/* Input group text span alignment */
.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-right: none;
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
    font-size: 18px;
    color: #6c757d;
}

/* Ensure perfect alignment for all input group components */
.input-group .form-control,
.input-group .btn,
.input-group-text {
    box-sizing: border-box;
    margin: 0;
}

/* Calendar container centering */
#roomgrid-calendar-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding-bottom: 3rem;
    margin-bottom: 2rem;
}

/* Calendar styles - CRITICAL FIXES for visibility and positioning */
#roomgrid-calendar {
    max-width: 400px;
    margin: 0 auto; /* Center the calendar */
    width: 100%;
    position: relative !important; /* CRITICAL: Ensure positioning context */
    z-index: 1 !important; /* CRITICAL: Ensure proper stacking */
    display: block !important; /* Ensure container is visible */
}

#roomgrid-calendar .flatpickr-calendar {
    width: 100% !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    position: relative !important; /* CRITICAL: Override absolute positioning */
    top: 0 !important; /* CRITICAL: Position at top of container */
    left: 0 !important; /* CRITICAL: Position at left of container */
    transform: none !important; /* CRITICAL: Override transforms */
    opacity: 1 !important; /* CRITICAL: Ensure visibility */
    visibility: visible !important; /* CRITICAL: Ensure visibility */
    display: block !important; /* CRITICAL: Ensure display */
    margin: 0 !important; /* Remove any margins */
    padding: 0 !important; /* Remove any padding */
}

#roomgrid-calendar .flatpickr-day.selected {
    background: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
    color: #fff !important;
}

#roomgrid-calendar .flatpickr-day.disabled {
    color: #ccc !important;
    cursor: not-allowed !important;
}

/* Full-width admin layout */
.roomgrid-admin-full-width {
    width: 100% !important;
    max-width: none !important;
    display: block !important;
}

.roomgrid-admin-full-width .roomgrid-table {
    font-size: 15px;
}

/* Holiday manager styles */
.holiday-item {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modern Design System */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
    --line-height: 1.6;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
}

/* Base Styles */
.roomgrid-wrapper {
    font-family: var(--font-family);
    line-height: var(--line-height);
    color: var(--text-color);
    background-color: var(--background-color);
}

/* Modern Table Styles */
.modern-table {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: white;
    border: 1px solid var(--border-color);
}

/* Admin Card Full Width Fix */
.roomgrid-admin .card {
    width: 100%;
    max-width: none;
}

.modern-table thead th {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    font-weight: 600;
    border: none;
    padding: var(--spacing-md);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.modern-table tbody td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.modern-table tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.02);
}

.time-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.status-indicator {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bookedroomtime .status-indicator {
    background: var(--success-color);
    color: white;
}

.bookedroomtime.reserved .status-indicator {
    background: var(--danger-color);
    color: white;
}

/* Modern Modal Styles */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    border: none;
    padding: var(--spacing-lg);
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
}

.modal-body {
    padding: var(--spacing-lg);
    background: white;
}

.modal-footer {
    border: none;
    padding: var(--spacing-lg);
    background: var(--background-color);
}

/* Modern Form Controls */
.form-control {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem var(--spacing-md);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    transition: all 0.15s ease-in-out;
    min-height: 44px;
}

/* Modal Input Width Fixes */
#roomgridModal .form-control,
#roomgridModal .form-control-lg,
#admin-booking-modal .form-control,
#admin-booking-modal .form-control-lg {
    width: 100% !important;
    max-width: none !important;
}

#roomgridModal .form-control:focus,
#admin-booking-modal .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

/* Modern Buttons */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.75rem var(--spacing-lg);
    min-height: 44px;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background-color);
    border-color: var(--text-muted);
}

.btn-outline-danger {
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* Selection Summary Styles */
.selection-list {
    max-height: 300px;
    overflow-y: auto;
}

.selection-item {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.selection-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.selection-item strong {
    color: var(--primary-color);
}

/* Calendar Styles */
#roomgrid-calendar {
    max-width: 400px;
    margin: 0 auto;
}

#roomgrid-calendar .flatpickr-calendar {
    width: 100%;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

#roomgrid-calendar .flatpickr-day.selected {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

#roomgrid-calendar .flatpickr-day.disabled,
#roomgrid-calendar .flatpickr-day.flatpickr-disabled {
    color: var(--text-muted) !important;
    cursor: not-allowed !important;
    background-color: #f8f9fa !important;
    text-decoration: line-through !important;
    opacity: 0.6 !important;
}

#roomgrid-calendar .flatpickr-day.disabled:hover,
#roomgrid-calendar .flatpickr-day.flatpickr-disabled:hover {
    background-color: #e9ecef !important;
    cursor: not-allowed !important;
}

/* Enhanced Room Metadata Badges */
#roomgrid-selection-summary .badge,
#admin-booking-modal .badge,
#edit-reservation-modal .badge,
.roomgrid-selection-summary .badge {
    font-size: 1rem !important;
    padding: 0.75rem 1rem !important;
    font-weight: 600 !important;
    border-radius: var(--radius-sm) !important;
    margin: 0.25rem 0.25rem 0.25rem 0 !important;
    display: inline-block !important;
}

#roomgrid-selection-summary .badge.bg-secondary,
#admin-booking-modal .badge.bg-secondary,
#edit-reservation-modal .badge.bg-secondary {
    background-color: #6c757d !important;
    color: #ffffff !important;
    border: 1px solid #5a6268 !important;
}

#roomgrid-selection-summary .badge.bg-primary,
#admin-booking-modal .badge.bg-primary,
#edit-reservation-modal .badge.bg-primary {
    background-color: #0d6efd !important;
    color: #ffffff !important;
    border: 1px solid #0b5ed7 !important;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.3) !important;
}

/* Business day highlight for Flatpickr calendar */
#roomgrid-calendar .flatpickr-day.business-day-highlight {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    border-color: #28a745 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3) !important;
    position: relative !important;
}

#roomgrid-calendar .flatpickr-day.business-day-highlight::after {
    content: "Business Today";
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    background: rgba(40, 167, 69, 0.9);
    color: white;
    padding: 1px 3px;
    border-radius: 2px;
    white-space: nowrap;
    z-index: 10;
}

/* Simplified business day highlight rule */
#roomgrid-calendar .flatpickr-day.business-day-highlight {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #ffffff !important;
    font-weight: bold;
}

/* Full-width admin layout */
.roomgrid-admin-full-width {
    width: 100% !important;
    max-width: none !important;
    display: block !important;
}

.roomgrid-admin-full-width .roomgrid-table {
    font-size: 15px;
}

/* Responsive Design */
@media (max-width: 767px) {
    .modal-dialog {
        margin: var(--spacing-sm);
        max-width: calc(100% - 2rem);
    }
    
    /* Header Controls Mobile Optimization */
    .bg-light.p-3 {
        padding: 1rem !important;
    }
    
    /* Ensure button groups are visible on mobile */
    .btn-group {
        display: flex !important;
        width: auto !important;
        flex-wrap: nowrap !important;
        min-height: 44px !important;
    }
    
    .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
        min-width: 80px !important; /* Fixed minimum width */
        min-height: 44px !important; /* Touch target size */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        white-space: nowrap;
        position: relative !important;
    }
    
    /* Ensure icons are always visible with high contrast */
    .btn .dashicons {
        display: inline-block !important;
        font-size: 20px !important;
        width: 20px !important;
        height: 20px !important;
        margin: 0 2px !important;
        color: #000000 !important;
    }
    
    /* Force button text visibility */
    .btn span {
        display: inline-block !important;
        color: #000000 !important;
        font-weight: 500 !important;
    }
    
    /* Fix button text color contrast - explicit black colors for mobile */
    .btn-outline-primary {
        color: #000000 !important;
        border-color: #000000 !important;
        background-color: transparent !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .btn-outline-primary:hover {
        background-color: rgba(0, 0, 0, 0.1) !important;
        color: #000000 !important;
        border-color: #000000 !important;
    }
    
    .btn-outline-primary:active,
    .btn-outline-primary:focus {
        background-color: rgba(0, 0, 0, 0.2) !important;
        color: #000000 !important;
        border-color: #000000 !important;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2) !important;
    }
    
    .btn-secondary {
        color: #000000 !important;
        background-color: #f8f9fa !important;
        border-color: #000000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .btn-secondary:hover {
        background-color: rgba(0, 0, 0, 0.1) !important;
        color: #000000 !important;
        border-color: #000000 !important;
    }
    
    .btn-secondary:active,
    .btn-secondary:focus {
        background-color: rgba(0, 0, 0, 0.2) !important;
        color: #000000 !important;
        border-color: #000000 !important;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Ensure icons match text color in all states */
    .btn-outline-primary .dashicons,
    .btn-secondary .dashicons {
        color: inherit !important;
    }
    
    .btn-outline-primary:hover .dashicons,
    .btn-secondary:hover .dashicons {
        color: #000000 !important;
    }
    
    .btn-outline-primary:active .dashicons,
    .btn-outline-primary:focus .dashicons,
    .btn-secondary:active .dashicons,
    .btn-secondary:focus .dashicons {
        color: #000000 !important;
    }
    
    /* Input Group Mobile Fixes */
    .input-group {
        display: flex !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .input-group-text {
        padding: 0.5rem 0.75rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background-color: #fff !important;
        border: 1px solid #ced4da !important;
        border-right: none !important;
        min-width: 44px;
        flex-shrink: 0;
    }
    
    .input-group-text .dashicons {
        display: inline-block !important;
        font-size: 16px !important;
        width: 16px !important;
        height: 16px !important;
        color: #6c757d !important;
    }
    
    .input-group .form-control {
        border: 1px solid #ced4da !important;
        border-left: none !important;
        background-color: #fff !important;
        flex-grow: 1;
        min-width: 0; /* Allow flex shrinking */
    }
    
    /* Auto-Refresh pill mobile optimization */
    .bg-white.px-3.py-2.rounded.border {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem;
        display: flex !important;
        align-items: center !important;
        background-color: #fff !important;
        border: 1px solid #ced4da !important;
        min-width: 150px;
        flex-shrink: 0;
    }
    
    .refresh-countdown {
        font-size: 0.875rem !important;
        color: #0d6efd !important;
    }
    
    /* Sticky mobile book button */
    .mobile-sticky-book-button {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 0.5rem;
        border-top: 1px solid #dee2e6;
    }
    
    .mobile-sticky-book-button button:not(:disabled) {
        display: block !important;
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* Grid Table Mobile Optimization */
    .roomgrid-table {
        table-layout: fixed !important;
        min-width: 800px !important; /* Ensure horizontal scroll */
        font-size: 0.875rem;
    }
    
    .roomgrid-table th,
    .roomgrid-table td {
        padding: 0.5rem 0.25rem !important;
        font-size: 0.8rem;
        min-width: 75px;
        max-width: 90px;
    }
    
    /* Time column sticky styling */
    .roomgrid-table th:nth-child(1),
    .roomgrid-table td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 10;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
        color: #495057 !important;
        font-weight: 700 !important;
        min-width: 80px !important;
        max-width: 80px !important;
        box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    }
    
    /* Available/Reserved text mobile sizing */
    .roomgrid-table td.bookedroomtime .small {
        font-size: 0.7rem !important;
        line-height: 1.2;
    }
    
    /* Touch targets for mobile */
    .roomgrid-table td.bookedroomtime {
        min-height: 50px !important;
        min-width: 75px !important;
        padding: 0.5rem !important;
    }
    
    /* Flatpickr mobile optimization */
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 350px !important;
        margin: 0 auto !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    
    .flatpickr-calendar.inline {
        position: relative !important;
        top: auto !important;
        bottom: auto !important;
        margin: 1rem auto !important;
    }
    
    /* Table container mobile scrolling */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -15px;
        padding: 0 15px;
    }
    
    /* Room header mobile optimization */
    .roomgrid-table th:not(:first-child) {
        font-size: 0.75rem !important;
        padding: 0.5rem 0.25rem !important;
    }
}

/* Tablet optimizations (iPad and similar) */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Header controls tablet optimization */
    .bg-light.p-3 {
        padding: 1rem !important;
    }
    
    .d-flex.flex-wrap {
        gap: 1rem !important;
    }
    
    .btn-group {
        display: flex !important;
        flex-wrap: nowrap !important;
        min-width: 220px !important;
    }
    
    .btn-group .btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        min-width: 100px;
        min-height: 44px;
        white-space: nowrap;
    }
    
    /* Date picker tablet sizing */
    .input-group {
        max-width: 320px !important;
        min-width: 240px !important;
    }
    
    .input-group .form-control {
        font-size: 0.9rem;
        padding: 0.6rem 0.8rem;
    }
    
    .input-group-text {
        padding: 0.6rem 0.8rem !important;
    }
    
    /* Auto-refresh pill tablet sizing */
    .bg-white.px-3.py-2.rounded.border {
        padding: 0.6rem 1rem !important;
        font-size: 0.8rem;
        white-space: nowrap;
        min-width: 180px !important;
    }
    
    /* Refresh button tablet sizing */
    .btn.refresh-grid {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        min-width: 120px;
        min-height: 44px;
    }
    
    /* Container optimization for tablets */
    .roomgrid-container {
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: auto;
        display: block !important;
        width: 100% !important;
    }
    
    /* Parent container constraint removal */
    .wrap.roomgrid-admin {
        max-width: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        display: block !important;
        justify-content: flex-start !important;
        align-items: flex-start !important;
    }
    
    .roomgrid-admin-full-width {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
        overflow-x: auto;
        display: block !important;
    }
    
    .table-responsive.roomgrid-admin-full-width {
        padding: 0 !important;
        margin: 0 !important;
        max-width: none !important;
        width: 100% !important;
        overflow-x: auto;
        display: block !important;
    }
    
    /* Grid Table Tablet Optimization - Aggressive Full-Width */
    .roomgrid-table {
        table-layout: fixed !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: none !important;
        font-size: 0.9rem;
        margin: 0 !important;
        padding: 0 !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }
    
    /* Fix Admin Card Width Issues - Force Full Width */
    .roomgrid-admin .card {
        width: 100% !important;
        max-width: none !important;
        overflow: visible;
    }
    
    .roomgrid-admin .modern-table {
        width: 100% !important;
        max-width: none !important;
    }
    
    .roomgrid-admin .roomgrid-table {
        width: 100% !important;
        max-width: none !important;
    }
    
    /* Room Configuration Card Fix */
    .roomgrid-admin .card .card-body {
        overflow-x: auto;
        width: 100% !important;
    }
    
    /* Settings Page Card Fix */
    .roomgrid-admin .settings-card {
        width: 100% !important;
        max-width: none !important;
    }
    
    .roomgrid-table {
        display: table !important;
    }
    
    .roomgrid-table th,
    .roomgrid-table td {
        padding: 4px 2px !important;
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;
        text-align: center;
        vertical-align: middle;
        font-size: 0.8rem !important;
        word-wrap: break-word !important;
    }
    
    /* Force Time column percentage - override mobile constraints */
    .roomgrid-table th:nth-child(1),
    .roomgrid-table td:nth-child(1),
    .roomgrid-table th:first-child,
    .roomgrid-table td:first-child {
        width: 12% !important;
        min-width: auto !important;
        max-width: none !important;
        text-align: center !important;
        font-weight: 600;
        padding: 4px 2px !important;
        font-size: 0.8rem !important;
        word-wrap: break-word !important;
    }
    
    /* Force Room columns percentage - override mobile constraints */
    .roomgrid-table th:nth-child(n+2),
    .roomgrid-table td:nth-child(n+2),
    .roomgrid-table th:not(:first-child),
    .roomgrid-table td:not(:first-child) {
        width: 11% !important;
        min-width: auto !important;
        max-width: none !important;
        padding: 4px 2px !important;
        font-size: 0.8rem !important;
        word-wrap: break-word !important;
    }
    
    /* Reserved cells tablet optimization */
    .roomgrid-table td.bookedroomtime {
        min-height: 50px !important;
        font-size: 0.85rem !important;
        line-height: 1.2;
    }
    
    .roomgrid-table td.bookedroomtime.reserved {
        padding: 0.6rem 0.4rem !important;
    }
    
    /* Ensure Reserved text and customer names are legible and centered */
    .roomgrid-table td.bookedroomtime.reserved span {
        display: block !important;
        text-align: center !important;
        font-weight: 500 !important;
        line-height: 1.1 !important;
    }
    
    /* Pill visual grouping maintained on tablets */
    .roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-start,
    .roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-mid,
    .roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-end {
        box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15) !important;
    }
    
    .roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-start {
        border-radius: 6px 6px 0 0 !important;
    }
    
    .roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-end {
        border-radius: 0 0 6px 6px !important;
    }
    
    /* Ensure proper spacing on tablets */
    .gap-3 {
        gap: 1rem !important;
    }
    
    .mb-3 {
        margin-bottom: 1rem !important;
    }
}

/* iPhone XR and similar large mobile optimization (414px width) */
@media (max-width: 414px) {
    /* Header layout for iPhone XR */
    .bg-light.p-3 {
        padding: 0.75rem !important;
    }
    
    /* Ensure proper spacing on narrow screens */
    .gap-3 {
        gap: 0.5rem !important;
    }
    
    .mb-3 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Button group optimization for 414px */
    .btn-group {
        min-width: 180px !important;
        flex-wrap: wrap !important;
        min-height: 44px !important;
    }
    
    .btn-group .btn {
        min-width: 85px !important;
        min-height: 44px !important;
        font-size: 0.8rem;
        padding: 0.5rem 0.5rem;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Force icon visibility on iPhone XR */
    .btn-group .btn .dashicons {
        display: inline-block !important;
        font-size: 20px !important;
        width: 20px !important;
        height: 20px !important;
        color: #000000 !important;
        margin: 0 2px !important;
    }
    
    /* Force text visibility on iPhone XR */
    .btn-group .btn span {
        display: inline-block !important;
        color: #000000 !important;
        font-weight: 600 !important;
        font-size: 0.8rem !important;
    }
    
    /* Date picker optimization for 414px */
    .input-group {
        max-width: 200px !important;
    }
    
    .input-group .form-control {
        font-size: 0.875rem;
        padding: 0.5rem 0.5rem;
    }
    
    /* Refresh controls optimization */
    .bg-white.px-3.py-2.rounded.border {
        min-width: 140px !important;
        padding: 0.5rem 0.5rem !important;
        font-size: 0.7rem;
    }
    
    .btn.refresh-grid {
        min-width: 90px !important;
        min-height: 44px !important;
        font-size: 0.8rem;
        padding: 0.5rem 0.5rem;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Force refresh button icon and text */
    .btn.refresh-grid .dashicons {
        display: inline-block !important;
        font-size: 20px !important;
        width: 20px !important;
        height: 20px !important;
        color: #000000 !important;
        margin: 0 2px !important;
    }
    
    .btn.refresh-grid span {
        display: inline-block !important;
        color: #000000 !important;
        font-weight: 600 !important;
    }
    
    /* iPhone XR specific hover states */
    .btn-group .btn:hover,
    .btn.refresh-grid:hover {
        background-color: rgba(0, 0, 0, 0.1) !important;
        color: #000000 !important;
        border-color: #000000 !important;
    }
    
    .btn-group .btn:active,
    .btn-group .btn:focus,
    .btn.refresh-grid:active,
    .btn.refresh-grid:focus {
        background-color: rgba(0, 0, 0, 0.2) !important;
        color: #000000 !important;
        border-color: #000000 !important;
        box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Ensure icons remain visible in all states on iPhone XR */
    .btn-group .btn:hover .dashicons,
    .btn-group .btn:active .dashicons,
    .btn-group .btn:focus .dashicons,
    .btn.refresh-grid:hover .dashicons,
    .btn.refresh-grid:active .dashicons,
    .btn.refresh-grid:focus .dashicons {
        color: #000000 !important;
    }
}

/* Large mobile / small tablet */
@media (min-width: 576px) and (max-width: 767px) {
    .roomgrid-table {
        min-width: 850px !important;
    }
    
    .roomgrid-table th,
    .roomgrid-table td {
        min-width: 85px;
        max-width: 100px;
    }
    
    /* Header controls for large mobile */
    .btn-group .btn {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    .input-group {
        max-width: 250px !important;
    }
}

/* Additional responsive styles */
.modern-table {
    font-size: 0.875rem;
}

.modal-header,
.modal-body,
.modal-footer {
    padding: var(--spacing-md);
}

/* Admin grid sticky header */
.roomgrid-admin-full-width .table-responsive {
    max-height: 80vh;
    /* Overflow handled in mobile media query to prevent conflicts */
}

.roomgrid-admin-full-width thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}

/* Allow Admins to click reserved slots for editing */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved {
    cursor: pointer !important;
    position: relative;
}

.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved:hover {
    opacity: 0.9;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.1);
}

.btn-secondary:hover {
    color: #000000 !important; /* or var(--text-color) */
    background-color: #e2e6ea !important;
    border-color: #dae0e5 !important;
}

/* Admin functionality preservation */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved {
    cursor: pointer !important;
    position: relative;
}

.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved:hover {
    opacity: 0.9 !important;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.1) !important;
    transform: scale(1.02) !important;
    transition: all 0.2s ease !important;
}

/* Ensure admin tooltips work in mobile */
@media (max-width: 767px) {
    .roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved {
        min-height: 40px !important; /* Slightly larger for touch */
        cursor: pointer !important;
    }
    
    .roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved:hover {
        transform: scale(1.05) !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    }
    
    /* Admin tooltip adjustments for mobile */
    .roomgrid-table[data-is-admin="1"] .bookedroomtime.reserved[data-bs-toggle="tooltip"] {
        position: relative;
    }
}

/* Force Admin Reserved text visibility in high-density layout */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved {
    color: #212529 !important;
    cursor: pointer !important;
    height: auto !important;
    min-height: 35px !important;
    padding: 2px 1px !important;
    font-size: 0.6rem !important;
    font-weight: 600 !important;
    display: table-cell !important;
    vertical-align: middle !important;
    text-align: center !important;
}

/* Admin view specific adjustments */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved.booking-start,
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved.booking-mid,
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved.booking-end {
    cursor: pointer !important;
}

/* Unified Border Pill for Solid Container Appearance */
.roomgrid-table td.bookedroomtime.reserved {
    position: relative;
    border: 1px solid transparent !important;
    transition: all 0.2s ease;
}

/* Ensure text doesn't overflow in table cells - applies to both render functions */
.roomgrid-table td.bookedroomtime.reserved {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roomgrid-table td.bookedroomtime.reserved span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    width: 100%;
}

/* Admin view specific adjustments */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved {
    max-width: 100px;
}

.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved span:last-child {
    font-size: 0.75rem !important;
}

/* Truncated Names Styling */
.roomgrid-table td.bookedroomtime.reserved.truncated-name .bookedroomtime.reserved span:last-child {
    cursor: help;
    position: relative;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.2s ease;
}

.roomgrid-table td.bookedroomtime.reserved.truncated-name .bookedroomtime.reserved span:last-child:hover {
    border-bottom-color: #007bff;
}

/* Enhanced tooltip for truncated names */
.roomgrid-table td.bookedroomtime.reserved.truncated-name .bookedroomtime.reserved span:last-child::after {
    content: '...';
    color: #007bff;
    font-weight: 600;
    font-size: 0.7rem;
    margin-left: 2px;
    opacity: 0.7;
    animation: fadeInOut 2s infinite alternate;
}

@keyframes fadeInOut {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* Responsive adjustments for name truncation */
@media (max-width: 767px) {
    .roomgrid-table td.bookedroomtime.reserved .bookedroomtime.reserved span:last-child {
        font-size: 0.7rem !important;
        line-height: 1.0 !important;
    }
    
    .roomgrid-table td.bookedroomtime.reserved .bookedroomtime.reserved span:first-child {
        font-size: 0.6rem !important;
        margin-bottom: 1px !important;
    }
    
    .roomgrid-table td.bookedroomtime.reserved.truncated-name .bookedroomtime.reserved span:last-child::after {
        font-size: 0.6rem;
        margin-left: 1px;
    }
}

/* Admin view specific adjustments */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved {
    max-width: 100px;
}

.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved .bookedroomtime.reserved span:last-child {
    font-size: 0.75rem !important;
}

/* VERTICAL PILL STYLING - INSET BOX-SHADOW APPROACH FOR PERFECT CONNECTIONS */
.roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved {
    border: none !important;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.15) !important;
    position: relative !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-start {
    border-radius: 8px 8px 0 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-mid {
    border-radius: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-end {
    border-radius: 0 0 8px 8px !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Single-slot bookings (both start and end) - fully rounded */
.roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-start.booking-end {
    border-radius: 8px !important;
}

/* Room-specific background colors for all booking types */
.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="1"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-1-light), #BFDBFE) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="2"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-2-light), #A7F3D0) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="3"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-3-light), #FDE68A) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="4"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-4-light), #DDD6FE) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="5"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-5-light), #FECACA) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="6"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-6-light), #A5F3FC) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="7"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-7-light), #FBCFE8) !important;
}

.roomgrid-table[data-is-admin="1"] tbody tr td[data-room="8"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-8-light), #C7D2FE) !important;
}

/* REDUNDANT BOOKING-START BACKGROUNDS REMOVED - NOW USING GENERAL ROOM-SPECIFIC STYLES */

/* OLD BOOKING-MID STYLES REMOVED - NOW USING INSET BOX-SHADOW APPROACH */

/* OLD BOOKING-END STYLES REMOVED - NOW USING INSET BOX-SHADOW APPROACH */

/* TEXT CLEANUP - REMOVED: "RESERVED" LABEL NOW VISIBLE FOR ALL SLOTS */
/* .roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-mid span:first-child,
.roomgrid-table[data-is-admin="1"] tbody tr td.bookedroomtime.reserved.booking-end:not(.booking-start) span:first-child {
    display: none !important;
} */

/* ALTERNATING SHADES FOR ZEBRA PATTERN */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
    position: relative !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="1"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="2"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="3"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="4"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="5"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="6"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="7"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

.roomgrid-table[data-is-admin="1"] td[data-room="8"].bookedroomtime.reserved.alt-shade {
    filter: contrast(1.1) brightness(0.95) !important;
}

/* VISUAL CONNECTION BETWEEN CONSECUTIVE SLOTS - REMOVED TO FIX PILL CONNECTIONS */

/* Customer boundary - hard visual break for back-to-back bookings (DISABLED for solid pill effect) */
.roomgrid-table td.bookedroomtime.reserved.customer-boundary {
    /* Removed border-bottom and margin-bottom to create solid visual connection */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important; /* Enhanced shadow to make it pop */
}

/* Premium Shading for Alternating Booking Groups - Zebra Pattern */
.roomgrid-table td.bookedroomtime.reserved.alt-shade {
    filter: brightness(0.9) saturate(1.2) !important;
    position: relative;
}

.roomgrid-table td.bookedroomtime.reserved.alt-shade::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.08);
    pointer-events: none;
    border-radius: inherit;
}

/* Exact Room Color Specifications */
:root {
    --room-1-primary: #3B82F6;
    --room-1-light: #DBEAFE;
    --room-1-dark: #2563EB;
    
    --room-2-primary: #10B981;
    --room-2-light: #D1FAE5;
    --room-2-dark: #059669;
    
    --room-3-primary: #F59E0B;
    --room-3-light: #FEF3C7;
    --room-3-dark: #D97706;
    
    --room-4-primary: #8B5CF6;
    --room-4-light: #EDE9FE;
    --room-4-dark: #7C3AED;
    
    --room-5-primary: #EF4444;
    --room-5-light: #FEE2E2;
    --room-5-dark: #DC2626;
    
    --room-6-primary: #06B6D4;
    --room-6-light: #CFFAFE;
    --room-6-dark: #0891B2;
    
    --room-7-primary: #EC4899;
    --room-7-light: #FCE7F3;
    --room-7-dark: #DB2777;
    
    --room-8-primary: #6366F1;
    --room-8-light: #E0E7FF;
    --room-8-dark: #4F46E5;
}

/* Apply exact room colors to headers and reserved blocks */
.roomgrid-table th:nth-child(2) { /* R1 */
    background: var(--room-1-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(3) { /* R2 */
    background: var(--room-2-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(4) { /* R3 */
    background: var(--room-3-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(5) { /* R4 */
    background: var(--room-4-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(6) { /* R5 */
    background: var(--room-5-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(7) { /* R6 */
    background: var(--room-6-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(8) { /* R7 */
    background: var(--room-7-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-table th:nth-child(9) { /* R8 */
    background: var(--room-8-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

/* Ensure room colors work in admin view - more specific selectors */
.roomgrid-admin .roomgrid-table th:nth-child(2) { /* R1 Admin */
    background: var(--room-1-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(3) { /* R2 Admin */
    background: var(--room-2-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(4) { /* R3 Admin */
    background: var(--room-3-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(5) { /* R4 Admin */
    background: var(--room-4-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(6) { /* R5 Admin */
    background: var(--room-5-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(7) { /* R6 Admin */
    background: var(--room-6-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(8) { /* R7 Admin */
    background: var(--room-7-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

.roomgrid-admin .roomgrid-table th:nth-child(9) { /* R8 Admin */
    background: var(--room-8-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
}

/* Admin Available Slots - High contrast for staff visibility */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.available {
    border: 1px solid #000000 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.roomgrid-table[data-is-admin="1"] td.bookedroomtime.available:hover {
    background-color: #f8f9fa !important;
    border-color: #007bff !important;
    color: #007bff !important;
}

/* Admin Available Slots Selected State */
.roomgrid-table[data-is-admin="1"] td.bookedroomtime.available.selected {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0a58ca !important;
    font-weight: 600 !important;
}

/* Room-specific reserved block colors */
.roomgrid-table td[data-room="1"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-1-light), #BFDBFE) !important;
    border-color: var(--room-1-primary) !important;
}

.roomgrid-table td[data-room="2"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-2-light), #A7F3D0) !important;
    border-color: var(--room-2-primary) !important;
}

.roomgrid-table td[data-room="3"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-3-light), #FDE68A) !important;
    border-color: var(--room-3-primary) !important;
}

.roomgrid-table td[data-room="4"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-4-light), #DDD6FE) !important;
    border-color: var(--room-4-primary) !important;
}

/* Room-specific reserved block colors - FIXED CONSISTENCY */
.roomgrid-table td[data-room="1"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-1-light), #BFDBFE) !important;
    border-color: var(--room-1-primary) !important;
}

.roomgrid-table td[data-room="2"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-2-light), #A7F3D0) !important;
    border-color: var(--room-2-primary) !important;
}

.roomgrid-table td[data-room="3"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-3-light), #FDE68A) !important;
    border-color: var(--room-3-primary) !important;
}

.roomgrid-table td[data-room="4"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-4-light), #DDD6FE) !important;
    border-color: var(--room-4-primary) !important;
}

.roomgrid-table td[data-room="5"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-5-light), #FECACA) !important;
    border-color: var(--room-5-primary) !important;
}

.roomgrid-table td[data-room="6"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-6-light), #A5F3FC) !important;
    border-color: var(--room-6-primary) !important;
}

.roomgrid-table td[data-room="7"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-7-light), #FBCFE8) !important;
    border-color: var(--room-7-primary) !important;
}

.roomgrid-table td[data-room="8"].bookedroomtime.reserved {
    background: linear-gradient(135deg, var(--room-8-light), #C7D2FE) !important;
    border-color: var(--room-8-primary) !important;
}

/* Standardize reserved slot text appearance */
.roomgrid-table td.bookedroomtime.reserved {
    text-align: center !important;
    vertical-align: middle !important;
    color: #212529 !important;
    font-weight: 500 !important;
    border: 1px solid !important;
    opacity: 1 !important;
}

.roomgrid-table td.bookedroomtime.reserved span {
    display: block !important;
    text-align: center !important;
    color: inherit !important;
}

/* Ensure consistent box-shadow for visual grouping */
.roomgrid-table td.bookedroomtime.reserved.booking-start,
.roomgrid-table td.bookedroomtime.reserved.booking-mid,
.roomgrid-table td.bookedroomtime.reserved.booking-end {
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1) !important;
}

/* Compact Calendar Design */
.roomgrid-table .time-label {
    font-size: 0.75rem !important;
    padding: 4px 8px !important;
    font-weight: 600;
    color: var(--text-muted);
}

/* Show only top of hour in time column */
.roomgrid-table tbody tr[data-minute="00"] .time-label {
    font-weight: 700;
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
}

.roomgrid-table tbody tr[data-minute="30"] .time-label {
    font-weight: 400;
    color: var(--text-muted);
    opacity: 0.7;
}

/* Reduce grid height */
.roomgrid-table td.bookedroomtime {
    min-height: 40px !important;
    padding: 6px 4px !important;
    font-size: 0.8rem !important;
}

/* High-Density Mobile Optimization - Exact Specifications */
@media (max-width: 767px) {
    /* Edge-to-edge container fix - remove all padding and gutters */
    .roomgrid-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
    }
    
    .table-responsive {
        padding: 0 !important;
        margin: 0 !important;
        overflow: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Remove conflicting overflow from admin grid */
    .roomgrid-admin-full-width .table-responsive {
        max-height: 80vh;
        overflow: auto !important;
    }
    
    /* Mathematical 100% width table with fixed layout */
    .roomgrid-table {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        font-size: 0.6rem !important;
        border-collapse: separate;
        border-spacing: 0;
    }
    
    /* Time Column - 12% width with constraints */
    .roomgrid-table th:first-child,
    .roomgrid-table td:first-child {
        width: 12% !important;
        min-width: 45px !important;
        max-width: 50px !important;
        padding: 1px 0.5px !important;
        font-size: 0.5rem !important;
        text-align: center !important;
        vertical-align: middle !important;
    }
    
    /* Room Columns - 11% width each (8 rooms = 88% total) */
    .roomgrid-table th:not(:first-child),
    .roomgrid-table td:not(:first-child) {
        width: 11% !important;
        min-width: 40px !important;
        max-width: none !important;
        padding: 1px 0.25px !important;
        font-size: 0.5rem !important;
        line-height: 1.0 !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        text-align: center !important;
        vertical-align: middle !important;
    }
    
    /* Mobile UI polish - compact booking cells */
    .roomgrid-table td.bookedroomtime {
        height: 30px !important;
        padding: 1px 0.25px !important;
    }
    
    /* Admin grid mobile consistency with mathematical layout */
    .roomgrid-table[data-is-admin="1"] {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
    }
    
    .roomgrid-table[data-is-admin="1"] th:first-child,
    .roomgrid-table[data-is-admin="1"] td:first-child {
        width: 12% !important;
        min-width: 45px !important;
        max-width: 50px !important;
    }
    
    .roomgrid-table[data-is-admin="1"] th:not(:first-child),
    .roomgrid-table[data-is-admin="1"] td:not(:first-child) {
        width: 11% !important;
        min-width: 40px !important;
        max-width: none !important;
    }
    
    /* Room headers - R1, R2, etc. - optimized for 40px width */
    .roomgrid-table th:not(:first-child) {
        font-size: 0.6rem !important;
        font-weight: 700 !important;
        padding: 2px 0.5px !important;
        height: 30px !important;
        text-align: center !important;
        vertical-align: middle !important;
    }
    
    /* Compact row height - reduced to 30px for mobile */
    .roomgrid-table td.bookedroomtime {
        min-height: 30px !important;
        max-height: 30px !important;
        height: 30px !important;
        padding: 1px 0.25px !important;
        font-size: 0.45rem !important;
        line-height: 0.9 !important;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    
    /* Time labels - ultra compact for 40px width */
    .roomgrid-table .time-label {
        font-size: 0.45rem !important;
        padding: 1px 0.25px !important;
        font-weight: 500 !important;
        writing-mode: horizontal-tb !important;
        text-align: center !important;
        line-height: 0.9 !important;
    }
    
    /* Hide half-hour labels on mobile */
    .roomgrid-table .time-label.mobile-hidden {
        opacity: 0;
        font-size: 0 !important;
        line-height: 0 !important;
        padding: 0 !important;
    }
    
    /* Mobile sticky time column - preserve functionality with 40px width */
    .roomgrid-table th:first-child,
    .roomgrid-table td:first-child {
        position: sticky !important;
        left: 0 !important;
        z-index: 10 !important;
        background: #ffffff !important;
        border-right: 2px solid #dee2e6 !important;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1) !important;
    }
    
    /* Mobile sticky time header styling */
    .roomgrid-table th:first-child {
        z-index: 15 !important;
        background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
        border-right: 2px solid #495057 !important;
        font-weight: 600 !important;
    }
    
    /* Mobile sticky time cells styling */
    .roomgrid-table td:first-child {
        z-index: 5 !important;
        background: linear-gradient(135deg, #ffffff, #f8f9fa) !important;
        border-right: 2px solid #495057 !important;
        font-weight: 500 !important;
        font-family: 'Courier New', monospace !important;
    }
    
    /* Compact buttons */
    .btn {
        padding: 4px 6px !important;
        font-size: 0.65rem !important;
        min-height: auto !important;
        border-radius: 4px !important;
    }
    
    /* Compact modal */
    .modal-dialog {
        margin: 2px;
        max-width: calc(100% - 4px);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.5rem !important;
    }
    
    .form-control {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
        min-height: auto !important;
    }
    
    .form-label {
        font-size: 0.7rem !important;
        margin-bottom: 0.2rem !important;
    }
    
    /* Pill styling adjustments for mobile */
    .roomgrid-table td.bookedroomtime.reserved.booking-start {
        border-left-width: 1px !important;
        border-radius: 4px 0 0 4px;
    }
    
    .roomgrid-table td.bookedroomtime.reserved.booking-mid {
        border-radius: 0;
    }
    
    .roomgrid-table td.bookedroomtime.reserved.booking-end {
        border-right-width: 1px !important;
        border-radius: 0 4px 4px 0;
    }
    
    .roomgrid-table td.bookedroomtime.reserved.customer-boundary {
        border-right-width: 2px !important;
    }
    
    /* Hide session indicators on mobile to save space */
    .session-indicator {
        display: none !important;
    }
    
    /* Hide old floating countdown pill in admin view */
.roomgrid-admin .roomgrid-countdown-container {
    display: none !important;
}

/* Compact countdown timer */
    .roomgrid-countdown-container {
        padding: 0.5rem !important;
        margin-bottom: 0.5rem !important;
        max-width: 180px;
    }
    
    .roomgrid-countdown-timer {
        font-size: 1rem !important;
    }
    
    .roomgrid-countdown-label {
        font-size: 0.75rem !important;
    }
}

/* Admin-specific countdown styling */
.roomgrid-countdown-container.admin-countdown {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    max-width: 200px;
    margin: 0 auto 1rem auto;
}

.roomgrid-countdown-container.admin-countdown .roomgrid-countdown-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.roomgrid-countdown-container.admin-countdown .roomgrid-countdown-timer {
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* New bookings indicator */
.new-bookings-indicator {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #212529;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    text-align: center;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.4);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Enhanced refresh indicator for admin */
.roomgrid-refresh-indicator {
    background: linear-gradient(135deg, #17a2b8, #138496) !important;
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.3);
}

/* New booking flash animation */
.roomgrid-countdown-container.admin-countdown.new-booking-flash {
    animation: newBookingFlash 2s ease-in-out;
    box-shadow: 0 4px 25px rgba(40, 167, 69, 0.6) !important;
    transform: scale(1.05);
}

@keyframes newBookingFlash {
    0% { 
        background: linear-gradient(135deg, #28a745, #20c997) !important;
        transform: scale(1);
    }
    25% { 
        background: linear-gradient(135deg, #ffc107, #ff9800) !important;
        transform: scale(1.08);
    }
    50% { 
        background: linear-gradient(135deg, #ffc107, #ff9800) !important;
        transform: scale(1.08);
    }
    75% { 
        background: linear-gradient(135deg, #28a745, #20c997) !important;
        transform: scale(1.05);
    }
    100% { 
        background: linear-gradient(135deg, #28a745, #20c997) !important;
        transform: scale(1);
    }
}

/* Countdown Timer Styles - Sticky Pill */
.roomgrid-countdown-container {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-bottom: 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 10px;
    z-index: 100;
    max-width: 200px;
    margin-left: auto;
    margin-right: auto;
}

.roomgrid-countdown-timer {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.1em;
}

.roomgrid-countdown-label {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Auto-refresh indicator */
.roomgrid-refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.roomgrid-refresh-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

/* Cross-midnight styling for 5pm-2am logic */
.cross-midnight-slot {
    border-top: 1px dashed var(--border-color) !important;
    background-color: rgba(99, 102, 241, 0.02) !important;
}

.cross-midnight-slot .time-label {
    color: var(--primary-color) !important;
    font-weight: 600 !important;
    position: relative;
}

.cross-midnight-slot .time-label::before {
    content: "→";
    position: absolute;
    left: -12px;
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Session indicators for dual sessions */
.session-indicator {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.25rem;
}

.session-lunch {
    background: #fff3cd;
    color: #856404;
}

.session-dinner {
    background: #d1ecf1;
    color: #0c5460;
}

/* Basic Toggle Switch Styling */
.roomgrid-admin .form-check .form-check-input {
    cursor: pointer;
}

/* Session Mode Badge Styling */
.roomgrid-admin #session-mode-badge {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.roomgrid-admin #session-mode-badge.bg-primary {
    background-color: #0d6efd !important;
}

.roomgrid-admin #session-mode-badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Toggle Container Styling */
.roomgrid-admin .border.rounded.bg-light {
    border-color: #dee2e6 !important;
    background-color: #f8f9fa !important;
    transition: all 0.3s ease;
}

.roomgrid-admin .border.rounded.bg-light:hover {
    background-color: #e9ecef !important;
    border-color: #adb5bd !important;
}

/* Booking Source Badges Styling */
.roomgrid-admin .modern-table .badge.bg-primary {
    background-color: #0d6efd !important;
    color: white !important;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

.roomgrid-admin .modern-table .badge.bg-success {
    background-color: #198754 !important;
    color: white !important;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

.roomgrid-admin .modern-table .badge.bg-secondary {
    background-color: #6c757d !important;
    color: white !important;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
}

/* Hover effects for source badges */
.roomgrid-admin .modern-table .badge {
    transition: all 0.2s ease;
    cursor: default;
}

.roomgrid-admin .modern-table .badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for source badges */
@media (max-width: 767px) {
    .roomgrid-admin .modern-table .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Admin Bookings Table - Last Updated Column Styling */
.roomgrid-admin .modern-table .last-updated {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: help;
    transition: all 0.2s ease;
}

/* Recent bookings styling (within last hour) */
.roomgrid-admin .modern-table .last-updated.recent {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    color: #155724;
    border: 1px solid #b8daff;
}

/* Very recent bookings (within last 15 minutes) */
.roomgrid-admin .modern-table .last-updated.very-recent {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
    animation: pulse 2s infinite;
}

/* Today's bookings styling */
.roomgrid-admin .modern-table .last-updated.today {
    background: linear-gradient(135deg, #d1ecf1, #bee5eb);
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Older bookings styling */
.roomgrid-admin .modern-table .last-updated.older {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

/* Hover effect for last updated column */
.roomgrid-admin .modern-table .last-updated:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Highlight newest booking row */
.roomgrid-admin .modern-table tbody tr:first-child td {
    background-color: rgba(40, 167, 69, 0.05) !important;
}

/* Highlight recent bookings (top 3) */
.roomgrid-admin .modern-table tbody tr:nth-child(-n+3) td {
    background-color: rgba(23, 162, 184, 0.02) !important;
}

/* Enhanced table header for admin bookings */
.roomgrid-admin .modern-table th {
    background: linear-gradient(135deg, #343a40, #495057) !important;
    color: white !important;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Admin bookings table responsive improvements */
@media (max-width: 767px) {
    .roomgrid-admin .modern-table .last-updated {
        font-size: 0.7rem;
        padding: 1px 3px;
    }
    
    .roomgrid-admin .modern-table:not(.roomgrid-table) th:nth-child(8),
    .roomgrid-admin .modern-table:not(.roomgrid-table) td:nth-child(8) {
        display: none; /* Hide last updated on very small screens */
    }
    
    .roomgrid-admin .modern-table:not(.roomgrid-table) th:nth-child(9),
    .roomgrid-admin .modern-table:not(.roomgrid-table) td:nth-child(9) {
        display: none; /* Hide actions on very small screens */
    }
    
    .roomgrid-admin .refresh-bookings {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.8rem !important;
    }
}

/* Refresh button hover effect */
.roomgrid-admin .refresh-bookings:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    transform: rotate(180deg);
    transition: all 0.3s ease;
}

/* Auto-refresh indicator */
.roomgrid-admin .auto-refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.roomgrid-admin .auto-refresh-indicator.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* STICKY TIME COLUMN - FROZEN FIRST COLUMN FOR HORIZONTAL SCROLL */
.roomgrid-table {
    position: relative;
}

.roomgrid-table th:first-child,
.roomgrid-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: #ffffff;
    border-right: 2px solid #dee2e6 !important;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

/* Enhanced styling for sticky time header */
.roomgrid-table th:first-child {
    z-index: 15;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    border-right: 2px solid #495057 !important;
    min-width: 80px;
    text-align: center;
    font-weight: 600;
}

/* Enhanced styling for sticky time cells */
.roomgrid-table td:first-child {
    z-index: 5;
    background: linear-gradient(135deg, #ffffff, #f8f9fa) !important;
    border-right: 2px solid #495057 !important;
    min-width: 80px;
    text-align: center;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* Ensure sticky elements stay above other cells */
.roomgrid-table th:first-child,
.roomgrid-table td:first-child {
    position: sticky;
    left: 0;
}

/* Enhanced visual hierarchy for time labels */
.roomgrid-table .time-label {
    font-weight: 600;
    color: #495057;
    background: inherit;
    padding: 0.75rem 0.5rem;
    white-space: nowrap;
    text-align: center;
    font-size: 0.9rem;
}

/* Time hierarchy for sticky column - top of hour bold */
.roomgrid-table tbody tr[data-minute="00"] td:first-child .time-label {
    font-weight: 700 !important;
    color: var(--text-color) !important;
    border-top: 1px solid var(--border-color) !important;
}

/* Time hierarchy for sticky column - half hour lighter */
.roomgrid-table tbody tr[data-minute="30"] td:first-child .time-label {
    font-weight: 400 !important;
    color: var(--text-muted) !important;
    opacity: 0.7 !important;
}

/* Ensure admin view respects time hierarchy */
.roomgrid-admin .roomgrid-table tbody tr[data-minute="00"] td:first-child .time-label {
    font-weight: 700 !important;
    color: var(--text-color) !important;
    border-top: 1px solid var(--border-color) !important;
}

.roomgrid-admin .roomgrid-table tbody tr[data-minute="30"] td:first-child .time-label {
    font-weight: 400 !important;
    color: var(--text-muted) !important;
    opacity: 0.7 !important;
}

/* Cross-midnight time styling */
.roomgrid-table .time-label.cross-midnight-time {
    color: #6f42c1;
    font-weight: 700;
    background: linear-gradient(135deg, #f3e8ff, #e9d5ff) !important;
}

/* Time column width adjustments for single-time display */
.roomgrid-table th:first-child,
.roomgrid-table td:first-child {
    min-width: 70px; /* Reduced width since we only show start time */
    max-width: 80px;
}

/* Mobile adjustments for single-time display */
@media (max-width: 767px) {
    .roomgrid-table th:first-child,
    .roomgrid-table td:first-child {
        min-width: 60px;
        font-size: 0.8rem;
        padding: 0.5rem 0.25rem;
    }
    
    .roomgrid-table .time-label {
        font-size: 0.8rem;
        padding: 0.5rem 0.25rem;
    }
}

/* Scroll hint and indicators */
.scroll-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 100;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 123, 255, 0.3);
}

.table-responsive.needs-horizontal-scroll {
    position: relative;
}

.table-responsive.is-scrolling::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95));
}

/* Mobile adjustments for sticky column */
@media (max-width: 767px) {
    .roomgrid-table th:first-child,
    .roomgrid-table td:first-child {
        min-width: 60px;
        font-size: 0.8rem;
        padding: 0.5rem 0.25rem;
    }
    
    .roomgrid-table .time-label {
        font-size: 0.8rem;
        padding: 0.5rem 0.25rem;
    }
    
    .scroll-hint {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

/* Table container scrolling handled in mobile media query */
.roomgrid-admin-full-width .table-responsive {
    max-width: 100%;
    /* Overflow settings consolidated in mobile media query */
}

/* FLOATING BOOK BUTTON - EASILY ACCESSIBLE FOR ALL VIEWS */
.floating-book-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 123, 255, 0.3);
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 600;
    min-width: 120px;
}

.floating-book-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-book-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 123, 255, 0.4);
}

.floating-book-btn:active {
    transform: translateY(0);
}

/* Admin-specific floating button styling */
.floating-book-btn.admin-btn {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    border-color: #28a745 !important;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.3);
}

.floating-book-btn.admin-btn:hover {
    box-shadow: 0 6px 25px rgba(40, 167, 69, 0.4);
}

/* Customer-specific floating button styling */
.floating-book-btn.customer-btn {
    background: linear-gradient(135deg, #007bff, #0056b3) !important;
    border-color: #007bff !important;
}

/* Icon styling */
.floating-book-btn i {
    margin-right: 8px;
}

/* Mobile adjustments */
@media (max-width: 767px) {
    .floating-book-btn {
        bottom: 80px;
        right: 15px;
        padding: 10px 20px;
        font-size: 0.9rem;
        min-width: 100px;
    }
}

/* Sticky Booking Button for Mobile UX */
@media (max-width: 767px) {
    .roomgrid-book-button-container.has-selection {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem;
        border-top: 1px solid #dee2e6;
        z-index: 1000;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .roomgrid-book-button-container.has-selection #roomgrid-book-btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
        font-weight: 600;
    }
}

/* Enhanced grid for dual sessions */
.roomgrid-table tr.session-separator {
    border-top: 2px solid var(--border-color);
}

.roomgrid-table tr.session-separator td {
    padding-top: 0.5rem !important;
}

/* =========================================
   MOBILE TIME COLUMN FIX
   ========================================= */
@media (max-width: 767px) {
    /* Target the first cell of every row in the grid body */
    .roomgrid-table tbody td:first-child {
        /* 1. Make the background solid white */
        background-color: #ffffff !important;
        
        /* 2. Ensure the text color is black for high contrast */
        color: #000000 !important;
        
        /* 3. Make the time labels bold for better readability */
        font-weight: 800 !important;
        
        /* Defensive: Ensure the cell and text are visible */
        visibility: visible !important;
        opacity: 1 !important;
        display: table-cell !important;
        
        /* Optional: Add a subtle border to separate from the grid */
        border-right: 1px solid #dee2e6 !important;
    }
}

/* =========================================
   CURRENT TIME INDICATOR STYLES
   ========================================= */
.current-time-line {
    position: absolute;
    left: 0;
    height: 2px;
    background-color: #dc3545; /* Red */
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.8);
}

.current-time-label {
    position: absolute;
    right: 10px;
    background-color: #dc3545;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    z-index: 1001;
    pointer-events: none;
    transform: translateY(-50%);
}

/* Ensure the table container is the relative parent for absolute positioning */
.roomgrid-table {
    position: relative !important;
}

/* Session Break Row Styling */
.session-break-row td {
    background-color: #f8f9fa !important;
    text-align: center !important;
    font-weight: bold !important;
    pointer-events: none !important;
    color: #6c757d !important;
    border: 1px solid #dee2e6 !important;
    padding: 8px !important;
}

.session-break-cell {
    font-style: italic !important;
    font-size: 0.9em !important;
}

/* RoomGrid Section Styles - Replaces Bootstrap card for full width */
.roomgrid-section {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    margin-bottom: 1rem;
}

.roomgrid-section-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 0.375rem 0.375rem 0 0;
}

.roomgrid-section-body {
    padding: 1rem;
}

.dining-reservation-row:hover {
    background-color: #f8f9fa;
}

.dining-reservation-row {
    transition: background-color 0.15s ease-in-out;
}

/* Modal fixes for proper display */
.modal.show {
    display: block !important;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1050;
}

.modal-backdrop.show {
    opacity: 1;
}

/* Auto-refresh indicator */
.dining-refresh-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 12px;
    color: #6c757d;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dining-refresh-indicator.refreshing {
    opacity: 1;
}

.dining-refresh-indicator .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #6c757d;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
