/**
 * ITCI booking flow fixes.
 *
 * Paired with inc/assets/js/itci-booking-fixes.js, which measures any
 * bottom-pinned overlay and publishes its height as --itci-bottom-overlay.
 */

:root {
    --itci-bottom-overlay: 0px;
    --itci-header-offset: 0px;
}

/*
 * Never let a scroll leave part of the booking widget underneath the sticky
 * header. The header's height follows the text size, so at larger text the top
 * row of dates ends up behind it and taps there hit the header instead — which
 * reads to the customer as "the calendar does not respond".
 */
.ph-calendar-container,
.time-picker-wraper,
#ph-calendar-days,
#ph-calendar-time,
.ph-ul-date,
.ph-ul-time,
#accordionExample .card {
    scroll-margin-top: calc(var(--itci-header-offset, 0px) + 12px);
}

/*
 * Reserve room for whatever is pinned across the bottom of the viewport, so
 * the end of the page can always be scrolled clear of it. Without this the
 * cookie banner permanently hides the last ~200px of every page on a phone.
 */
body {
    padding-bottom: var(--itci-bottom-overlay, 0px);
}

/*
 * The consent banner is allowed to float, but never to own a third of a small
 * screen. Capping it keeps the booking form's Confirm buttons reachable even
 * before the JS has re-scrolled them.
 */
@media (max-height: 720px) {
    .wordpress-gdpr-popup-container {
        max-height: 38vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Failure message shown when an availability request does not come back. */
.itci-booking-error {
    margin: 12px 0 0;
    padding: 10px 12px;
    border: 1px solid #c0392b;
    border-left-width: 4px;
    border-radius: 2px;
    background: #fdecea;
    color: #922b21;
    font-size: 14px;
    line-height: 1.45;
    text-align: left;
}

@media (prefers-color-scheme: dark) {
    .itci-booking-error {
        background: #2c1614;
        border-color: #e07a6f;
        color: #f3b5ad;
    }
}

/*
 * The floating WhatsApp button is fixed with z-index 999999999, and its label
 * stretches 156px to the left of the 56px button. That label sits over the
 * booking form and swallows taps aimed at the time slots underneath it — a
 * customer trying to pick 18:00 hits "Need help?" instead.
 *
 * The round button stays fully tappable; only its label stops intercepting,
 * which is how a floating action button is normally expected to behave.
 */
.wa__btn_popup_txt {
    pointer-events: none;
}

/*
 * Flight time picker (jquery.datetimepicker). Its stock look is a 300px box of
 * 25px grey cells in blue and orange, which does not match the booking form and
 * is too small to tap reliably on a phone.
 */
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current {
    background: #00a9a9;
    box-shadow: none;
    color: #fff;
}

.xdsoft_datetimepicker .xdsoft_calendar td:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div:hover,
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover {
    background: #e0f5f5 !important;
    color: #15272a !important;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_current:hover {
    background: #00a9a9 !important;
    color: #fff !important;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today:not(.xdsoft_current) {
    color: #00a9a9;
    font-weight: 700;
}

/* Roomier on every screen: 44px days and times, the site's type and teal. */
.xdsoft_datetimepicker {
    width: 400px !important;
    max-width: calc(100vw - 24px);
    padding: 12px !important;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(21, 39, 42, 0.2);
    font-family: inherit;
}

.xdsoft_datetimepicker .xdsoft_datepicker {
    width: calc(100% - 92px);
    margin-left: 0;
}

.xdsoft_datetimepicker .xdsoft_timepicker {
    width: 80px;
    margin-left: 12px;
}

.xdsoft_datetimepicker .xdsoft_datepicker.active + .xdsoft_timepicker {
    margin-top: 0;
}

.xdsoft_datetimepicker .xdsoft_monthpicker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 44px;
}

.xdsoft_datetimepicker .xdsoft_label {
    float: none;
    width: auto;
    font-size: 16px;
    padding: 0 4px;
}

.xdsoft_datetimepicker .xdsoft_calendar th,
.xdsoft_datetimepicker .xdsoft_calendar td {
    height: 44px;
    font-size: 15px;
    text-align: center;
    background: #fff;
    border-color: #eaf1f1;
    color: #15272a;
}

.xdsoft_datetimepicker .xdsoft_calendar th {
    height: 32px;
    font-size: 12px;
    color: #5a6f72;
}

.xdsoft_datetimepicker .xdsoft_calendar td > div {
    padding-right: 0;
}

/* Six rows of 44px, matching the calendar beside it. */
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box {
    height: 264px;
    border-radius: 10px;
    border-color: #eaf1f1;
}

/* Row height must match timeHeightInTimePicker in custom.js. */
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div {
    height: 44px;
    line-height: 44px;
    font-size: 15px;
    background: #fff;
    border-top-color: #eaf1f1;
    color: #15272a;
}

/*
 * Days and times outside the 6-48h window were only dimmed to 50% opacity,
 * which on this palette read almost the same as the ones that can be chosen.
 * Selectable cells are dark and semi-bold; the rest sit on a tinted ground in
 * pale grey and do not react to hover.
 */
.xdsoft_datetimepicker .xdsoft_calendar td,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div {
    font-weight: 600;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_disabled {
    opacity: 1;
    background: #f3f6f6;
    color: #b3c0c2;
    font-weight: 400;
    cursor: not-allowed;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled {
    opacity: 1;
    background: #f3f6f6;
    color: #d3dcdd;
    font-weight: 400;
}

.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box > div > div.xdsoft_disabled:hover {
    background: #f3f6f6 !important;
    color: #b3c0c2 !important;
}

/* Time-only pickers (functions.php preset flow) have no calendar to make room for. */
.xdsoft_datetimepicker:not(:has(.xdsoft_datepicker.active)) {
    width: auto !important;
}

.xdsoft_datetimepicker:not(:has(.xdsoft_datepicker.active)) .xdsoft_timepicker {
    margin-left: 0;
}

@media (max-width: 767px) {
    /* On phones, a full-width sheet under the field. */
    .xdsoft_datetimepicker {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none;
    }
}
