/* ============================
   TW ROOM CALENDAR — CLEAN CSS
   ============================ */

.tw-room-calendar-wrapper {
    margin: 20px 0;
}

/* FullCalendar button styling */
.fc .fc-button {
    background-color: #0073aa !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 6px 12px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
}

.fc .fc-button:hover {
    background-color: #005f8a !important;
}

.fc .fc-button.fc-button-active {
    background-color: #004f73 !important;
}

.fc-header-toolbar {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
}

.fc .fc-toolbar-chunk .fc-button {
    margin-right: 6px !important;
}

/* ============================
   MODAL STYLING
   ============================ */

/* Simple modal styling */
.tw-room-booking-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
}

.tw-modal-content {
    background: #fff;
    max-width: 400px;
    margin: 80px auto;
    padding: 20px;
    border-radius: 6px;
}

.tw-modal-content label {
    display: block;
    margin-top: 10px;
    font-weight: 600;
}

.tw-modal-content input,
.tw-modal-content textarea {
    width: 100%;
    margin-top: 4px;
    padding: 6px;
    box-sizing: border-box;
}

.tw-modal-content button {
    margin-top: 12px;
    margin-right: 8px;
}

#tw-save-booking {
    background: #0073aa;
    color: white;
    margin-right: 10px;
}

#tw-cancel-booking {
    background: #ccc;
}

#tw-captain-date-modal.tw-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

#tw-captain-date-modal .tw-modal-content {
    background: #fff;
    width: 320px;
    margin: 120px auto;
    padding: 20px;
    border-radius: 6px;
    text-align: center;
}

.tw-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.tw-btn-danger {
    background: #cc0000;
}

.tw-btn-cancel {
    margin-top: 10px;
    background: #777;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}


/* ============================
   FULLCALENDAR HEADER FIX
   (Prev / Title / Next centered tightly)
   ============================ */

/* Make the entire header a centered flexbox */
.fc-header-toolbar {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
}

/* Collapse LEFT (prev) + CENTER (title) into one tight group */
.fc-toolbar-chunk:nth-child(1),
.fc-toolbar-chunk:nth-child(2) {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
}

/* Prevent FullCalendar from stretching chunks */
.fc-toolbar-chunk {
    flex: 0 0 auto !important;
}

/* Push RIGHT chunk (today + view buttons + next) to the far right */
.fc-toolbar-chunk:last-child {
    margin-left: auto !important;
}

/* FORCE the center chunk (prev/title/next) to be truly centered */
.fc-toolbar-chunk:nth-child(2) {
    flex: 0 1 auto !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}


/* FORCE the entire FullCalendar header to center itself */
.tw-room-calendar-wrapper .fc-header-toolbar {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* Center the prev/title/next group */
.tw-room-calendar-wrapper .fc-toolbar-chunk:nth-child(2) {
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Keep the right-side buttons on the right */
.tw-room-calendar-wrapper .fc-toolbar-chunk:last-child {
    margin-left: auto !important;
}

/* OVERRIDE THE THEME'S WRAPPER THAT IS FORCING LEFT ALIGNMENT */
.tw-room-calendar-wrapper .fc {
    width: 100% !important;
}

.tw-room-calendar-wrapper .fc-toolbar {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

/* Center prev/title/next as a group */
.tw-room-calendar-wrapper .fc-toolbar-chunk:nth-child(2) {
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

/* Keep Today/Month/Week/Day on the right */
.tw-room-calendar-wrapper .fc-toolbar-chunk:last-child {
    margin-left: auto !important;
}

/* Prevent theme from hijacking FullCalendar's title */
.tw-room-calendar-wrapper h2.fc-toolbar-title {
    all: unset !important;
    font-size: 1.4em !important;
    font-weight: bold !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline-block !important;
}

/* Force the title to stay INSIDE the toolbar */
.fc-toolbar-title {
    display: inline-block !important;
}






/* Remove extra white space below last visible time slot */
.tw-room-calendar-wrapper .fc-timegrid-body,
.tw-room-calendar-wrapper .fc-timegrid-slots {
    height: auto !important;
}

.tw-room-calendar-wrapper .fc-scroller {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}


/* ---------------------------------------------------------
   HIGH CONTRAST CALENDAR THEME
   Designed for readability + accessibility
--------------------------------------------------------- */

/* Overall calendar container */
body .fc {
    background: #ffffff !important;
    border: 3px solid #000000 !important;
    border-radius: 8px !important;
    padding: 12px !important;
}

/* Header title (Month name) */
body .fc .fc-toolbar-title {
    font-size: 1.8rem !important;
    font-weight: 900 !important;
    color: #000000 !important;
}

/* Header buttons (Today / Prev / Next / Month / Week / Day) */
body .fc .fc-button {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    padding: 8px 14px !important;
    border-radius: 6px !important;
}

body .fc .fc-button:hover {
    background: #333333 !important;
}

body .fc .fc-button.fc-button-active {
    background: #ffcc00 !important;
    color: #000000 !important;
    border-color: #000000 !important;
}

/* Spacing between buttons */
body .fc .fc-button-group .fc-button {
    margin-right: 8px !important;
}
body .fc .fc-button-group .fc-button:last-child {
    margin-right: 0 !important;
}

/* Weekday header row (Sun, Mon, Tue...) */
body .fc .fc-col-header-cell {
    background: #000000 !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    font-size: 1rem !important;
    border: 2px solid #000000 !important;
    padding: 10px 0 !important;
}

/* Day cells */
body .fc .fc-daygrid-day {
    border: 2px solid #000000 !important;
    background: #ffffff !important;
}

/* Day numbers */
body .fc .fc-daygrid-day-number {
    font-size: 1.1rem !important;
    font-weight: 900 !important;
    color: #000000 !important;
    padding: 6px !important;
}

/* Today highlight */
body .fc .fc-day-today {
    background: #fffbcc !important; /* soft yellow */
    border: 3px solid #ffcc00 !important;
}

/* Events (Month view) */
body .fc .fc-event {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    border-radius: 6px !important;
    padding: 4px 6px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

/* Event hover */
body .fc .fc-event:hover {
    background-color: #333333 !important;
    cursor: pointer !important;
}

/* TimeGrid (Week/Day view) */
body .fc .fc-timegrid-slot {
    height: 2.4em !important;
    border-color: #000000 !important;
}

body .fc .fc-timegrid-slot-label {
    font-weight: 900 !important;
    color: #000000 !important;
    font-size: 1rem !important;
}

body .fc .fc-timegrid-slot-lane {
    background: #ffffff !important;
}

/* TimeGrid events */
body .fc .fc-timegrid-event {
    background-color: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
    border-radius: 6px !important;
    padding: 6px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
}

/* Event text */
body .fc .fc-event-title,
body .fc .fc-event-time {
    font-weight: 900 !important;
    font-size: 1rem !important;
}

/* Improve spacing above toolbar */
body .fc .fc-toolbar {
    margin-bottom: 12px !important;
}

/* Dark blue weekday header bar with white text */
body .fc .fc-col-header-cell {
    background: #003366 !important;   /* deep navy blue */
    color: #ffffff !important;        /* white text */
    font-weight: 900 !important;
    font-size: 1rem !important;
    border: 2px solid #000000 !important;
    padding: 10px 0 !important;
}

/* Make sure the day name text itself is white */
body .fc .fc-col-header-cell-cushion {
    color: #ffffff !important;
    font-weight: 900 !important;
}

/* APPROVED (blue) */
body .fc .fc-event.fc-status-approved {
    background-color: #003366 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

/* PENDING (gold) */
body .fc .fc-event.fc-status-pending {
    background-color: #d4a017 !important;  /* gold */
    color: #000000 !important;             /* black text */
    border-color: #000000 !important;      /* black border */
}


/* Ensure pending event text is black */
body .fc .fc-event.fc-status-pending .fc-event-main {
    color: #000000 !important;
}

/* Fix text alignment inside pending events */
body .fc .fc-event.fc-status-pending .fc-event-main {
    line-height: 1.2 !important;
    padding: 2px 4px !important;
}


/* Catch ALL unavailable event types */
body .fc .fc-event.unavailable,
body .fc .fc-event.fc-unavailable,
body .fc .fc-event.fc-status-unavailable,
body .fc .fc-bg-event.unavailable,
body .fc .fc-bg-event.fc-status-unavailable {
    background-color: #555555 !important;
    border-color: #555555 !important;
    color: #ffffff !important;
}





#tw-cancel-booking {
    background: #0073aa !important;   /* same blue as Save Booking */
    color: white !important;
    margin-left: 10px !important;
}

#tw-captain-code {
    width: 150px !important;
    max-width: 150px !important;
    display: inline-block !important;
}

/* ============================================================
   MOBILE‑OPTIMIZED MODAL (SAFE VERSION)
   Only affects the modal box itself — NOT the overlay
============================================================ */

@media (max-width: 600px) {

    /* Modal container */
    .tw-modal,
    .twsf-modal,
    #gg-modal {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;

        width: 92% !important;
        max-width: 360px !important;
        height: auto !important;
        max-height: 85vh !important;

        background: #fff;
        border-radius: 10px;
        overflow: hidden;
        box-shadow: 0 0 25px rgba(0,0,0,0.35);
        z-index: 999999 !important;
    }

    /* Modal content scrolls if needed */
    .tw-modal-content,
    #gg-frame {
        width: 100% !important;
        max-height: 75vh !important;
        overflow-y: auto !important;
        padding: 10px !important;
    }

    /* Close button */
    .tw-modal-close,
    #gg-close {
        top: 10px !important;
        right: 14px !important;
        font-size: 26px !important;
    }

    /* Buttons inside modal */
    .tw-modal button,
    .twsf-modal button {
        width: 100% !important;
        padding: 14px !important;
        font-size: 16px !important;
        margin-top: 10px !important;
    }

    /* Text inside modal */
    .tw-modal h2,
    .tw-modal p,
    .twsf-modal h2,
    .twsf-modal p {
        font-size: 16px !important;
        line-height: 1.4 !important;
    }
}

/* ============================
   CALENDAR LEGEND
   ============================ */

.tw-calendar-legend {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.tw-calendar-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tw-calendar-legend .legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-block;
    border: 1px solid #000;
}

/* Match your event colors */
.tw-calendar-legend .approved {
    background-color: #0073aa;   /* blue */
    border-color: #ffffff;
}

.tw-calendar-legend .pending {
    background-color: #d4a017;   /* gold */
    border-color: #000000;
}

.tw-calendar-legend .unavailable {
    background-color: #555555;   /* grey */
    border-color: #ffffff;
}

.tw-room-calendar-wrapper {
    overflow: visible !important;
    position: static !important;
    z-index: auto !important;
}

.tw-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
}

.tw-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    width: 400px;
    max-width: 90%;
    z-index: 1000000 !important;
}

/* Force modal above FullCalendar */
.tw-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999999 !important; /* ⭐ higher than FullCalendar */
}

.tw-modal-content {
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    width: 400px;
    max-width: 90%;
    z-index: 1000000000 !important; /* ⭐ even higher */
}

/* Modal overlay must be above FullCalendar */
.tw-modal {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
}

/* Modal content must ALSO be above FullCalendar */
.tw-modal-content {
    position: relative !important;
    background: #fff;
    padding: 20px;
    border-radius: 6px;
    width: 400px;
    max-width: 90%;
    z-index: 1000000 !important;
}

/* Dropdown menus MUST float above everything */
.tw-modal select {
    position: relative !important;
    z-index: 1000001 !important;
}

#calendar-scroll-wrapper {
    height: 100vh;          /* full screen height */
    overflow-y: auto;       /* allow vertical scrolling */
    -webkit-overflow-scrolling: touch; /* smooth iPad scrolling */
}

/* Allow timeGrid to expand fully */
.fc-timegrid-body {
    height: auto !important;
    max-height: none !important;
}

/* Allow the whole timeGrid to grow */
.fc-timegrid {
    height: auto !important;
}

/* Ensure the scroll wrapper handles the overflow */
#calendar-scroll-wrapper {
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}


/* Make the booking modal date larger and more prominent */
.tw-booking-date {
    font-size: 2rem;        /* Bigger date */
    font-weight: 600;       /* Stronger emphasis */
    text-align: center;     /* Center it */
    margin-bottom: 12px;    /* Breathing room */
    line-height: 1.3;       /* Nice spacing */
}




/* Make unavailable event text black */
.fc-event.unavailable,
.fc-event.unavailable .fc-event-title,
.fc-event.unavailable .fc-event-time {
    color: #000 !important;
}
