/**
 * BPS Booking — Calendar shortcode styles.
 *
 * Matches dev/plans/bps-booking-html-mockups/01-booking-page.html.
 * Scoped under .bps-booking--panel .bps-booking-card so it cannot leak.
 * Uses BPS palette tokens with mockup colors as fallbacks — palette wins.
 *
 * Enqueued conditionally on pages containing the booking shortcode.
 */

.bps-booking--panel {
    padding: 40px 20px;
    background: transparent;
    /* Respond to the box a BPS/Elementor container actually gives this widget, not the
       browser viewport. A `moa-width-narrow` (or any authored-narrow) column can hand this
       far less than 640px on a full-width desktop screen, where the old viewport media
       query never fired and the two-column layout below silently overflowed its own
       `overflow: hidden` card. See the matching @container block under "Responsive". */
    container-type: inline-size;
}

.bps-booking--panel .bps-booking-card {
    /* 🔴 BUG-988: the card's ink is declared LOCALLY and deliberately does not read the
       ambient `--text-color`.
       The card paints its own light surface from `--light-bg`, which stays white inside a
       BPS `.dark` section — but `--text-color` in that same section is `#ffffff`. The two
       tokens do not move together, so the card rendered WHITE TEXT ON A WHITE CARD: the
       session title, the month heading and every BOOKABLE day vanished, on desktop and
       mobile alike, while the unbookable days survived because they carry their own greys.
       The only days a visitor could click were the only ones they could not see.
       🪤 The mirror of BUG-517: an UNDEFINED custom property falls through to its fallback
       harmlessly, so `var(--text-color, #1a1a1a)` looks safe — but a DEFINED one silently
       wins, and `.dark` defines it. A fallback is not a default.
       Measured on live blog 55, 2026-09-20. */
    --bps-bk-ink: #1a1a1a;

    background: var(--light-bg, #ffffff);
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 560px;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    overflow: hidden;
    color: var(--bps-bk-ink, #1a1a1a);
    font-family: inherit;
}

/* ── Sidebar ──────────────────────────────────────────────────────── */

.bps-booking-card .bps-bk-sidebar {
    border-right: 1px solid var(--border-color, #e8e8e8);
    padding: 36px 28px;
    display: flex;
    flex-direction: column;
    background: var(--light-bg, #ffffff);
}

.bps-booking-card .bps-bk-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #CECBF6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #3C3489;
    margin-bottom: 16px;
}

.bps-booking-card .bps-bk-host-name {
    font-size: 12px;
    color: #6b6b6b;
    margin-bottom: 4px;
    font-weight: 400;
    line-height: 1.3;
}

.bps-booking-card .bps-bk-event-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--bps-bk-ink, #1a1a1a);
    line-height: 1.3;
    margin-bottom: 20px;
}

.bps-booking-card .bps-bk-meta-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.bps-booking-card .bps-bk-meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #6b6b6b;
    padding: 5px 0;
    line-height: 1.3;
}

.bps-booking-card .bps-bk-meta-item svg {
    flex-shrink: 0;
    color: #a0a0a0;
}

/* 🔴 BUG-988, part 2 — beat the ambient TONE LOOP, which outranks the rules above.
   Fixing the ink token was not enough. BPS's own `style.css` paints every bare `li`
   and `p` inside a toned section:
       `.section.dark li:where(:not(.override)):where(:not(.override *)) { color: var(--text-color) }`
   The `:where()` guards cost zero specificity, so that rule is **(0,2,1)** — and the
   component rules above are only **(0,2,0)**. The tone loop won, and the meta items
   stayed WHITE on this white card even after `--bps-bk-ink` was pinned.
   `BPS_Design_Contracts_Reference` §C3 is explicit about the remedy: *"If a component
   needs different paint, give IT its own rule at ≥ (0,3,1). Never add a guard to the
   ambient tone loop."* So these are re-stated at **(0,3,1)** — three classes plus the
   element selector — rather than reaching for `.override` or `!important`.
   🪤 The element selector is load-bearing. Drop the `li`/`p` and it falls back to
   (0,3,0), which still wins today but stops being self-evidently correct. */
.bps-booking--panel .bps-booking-card li.bps-bk-meta-item {
    color: #6b6b6b;
}

.bps-booking--panel .bps-booking-card p.bps-bk-description {
    color: #6b6b6b;
}

.bps-booking-card .bps-bk-divider {
    border: none;
    border-top: 1px solid var(--border-color, #e8e8e8);
    margin: 16px 0;
}

.bps-booking-card .bps-bk-description {
    font-size: 13px;
    color: #6b6b6b;
    line-height: 1.65;
    margin: 0;
}

.bps-booking-card .bps-bk-tz-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b6b6b;
    margin-top: auto;
    padding-top: 20px;
}

.bps-booking-card .bps-bk-tz-row svg {
    color: #a0a0a0;
    flex-shrink: 0;
}

/* Native select, deliberately (BUG-990 — Select2 was removed in 1.6.5).
   🪤 `color` was `inherit`, which walked straight back up to the ambient `--text-color`
   and went white inside a `.dark` section — the same BUG-988 failure as the card. It is
   pinned to the card's own ink instead.
   `appearance: none` + the inline SVG caret keeps the control looking the same across
   browsers; `min-height: 44px` meets the touch-target guideline on a phone, where this
   now opens the OS picker. */
.bps-booking-card .bps-bk-tz-select {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    font-size: 13px;
    min-height: 44px;
    padding: 8px 30px 8px 10px;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 6px;
    background-color: var(--light-bg, #ffffff);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    color: var(--bps-bk-ink, #1a1a1a);
    font-family: inherit;
    line-height: 1.3;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.bps-booking-card .bps-bk-tz-select:focus-visible {
    outline: 2px solid var(--brand-color, #534AB7);
    outline-offset: 1px;
}

/* ── Calendar area ────────────────────────────────────────────────── */

.bps-booking-card .bps-bk-main {
    padding: 32px 36px;
    display: flex;
    flex-direction: column;
    background: var(--light-bg, #ffffff);
}

.bps-booking-card .bps-bk-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.bps-booking-card .bps-bk-cal-month {
    font-size: 16px;
    font-weight: 600;
}

.bps-booking-card .bps-bk-cal-nav {
    display: flex;
    gap: 4px;
}

.bps-booking-card .bps-bk-nav-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6b6b;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    transition: border-color 0.15s, color 0.15s;
}

.bps-booking-card .bps-bk-nav-btn:hover {
    border-color: var(--brand-color, #534AB7);
    color: var(--brand-color, #534AB7);
}

.bps-booking-card .bps-bk-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin-bottom: 24px;
}

.bps-booking-card .bps-bk-cal-label {
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #a0a0a0;
    padding: 4px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bps-booking-card .bps-bk-cal-day {
    text-align: center;
    padding: 8px 4px;
    font-size: 13px;
    border-radius: 6px;
    color: #a0a0a0;
    transition: background 0.1s, color 0.1s;
    user-select: none;
    line-height: 1.2;
}

.bps-booking-card .bps-bk-cal-day--avail {
    color: var(--bps-bk-ink, #1a1a1a);
    font-weight: 500;
    cursor: pointer;
}

.bps-booking-card .bps-bk-cal-day--avail:hover,
.bps-booking-card .bps-bk-cal-day--avail:focus {
    background: var(--light-bg2, #f3f3f0);
    outline: none;
}

.bps-booking-card .bps-bk-cal-day--selected {
    background: var(--brand-color, #534AB7) !important;
    color: #ffffff !important;
}

.bps-booking-card .bps-bk-cal-day--today {
    box-shadow: inset 0 0 0 1px var(--brand-color, #534AB7);
}

.bps-booking-card .bps-bk-cal-day--past {
    color: #d0d0d0;
    cursor: default;
}

/* ── Slots ────────────────────────────────────────────────────────── */

.bps-booking-card .bps-bk-slots-wrap {
    margin-top: 8px;
}

.bps-booking-card .bps-bk-slots-header {
    font-size: 13px;
    font-weight: 600;
    color: #6b6b6b;
    margin-bottom: 12px;
}

.bps-booking-card .bps-bk-slots-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

.bps-booking-card .bps-bk-slot {
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--bps-bk-ink, #1a1a1a);
    cursor: pointer;
    text-align: center;
    background: var(--light-bg, #ffffff);
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.bps-booking-card .bps-bk-slot:hover {
    border-color: var(--brand-color, #534AB7);
    color: var(--brand-color, #534AB7);
}

.bps-booking-card .bps-bk-slot--active {
    background: var(--brand-color, #534AB7);
    color: #ffffff;
    border-color: var(--brand-color, #534AB7);
}

.bps-booking-card .bps-bk-slot-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.75;
}

.bps-booking-card .bps-bk-login-prompt {
    margin-top: 16px;
    padding: 12px;
    background: #EEEDFE;
    border-radius: 6px;
    font-size: 13px;
    color: #3C3489;
    text-align: center;
}

.bps-booking-card .bps-bk-login-prompt a {
    color: var(--brand-color, #534AB7);
    font-weight: 600;
}

/* ── Empty state (no provider) ────────────────────────────────────── */

.bps-booking--empty {
    padding: 2rem 1rem;
}

.bps-booking--empty .container {
    max-width: 520px;
    margin: 2rem auto;
    padding: 2rem 1.5rem;
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 14px;
    background: var(--light-bg, #ffffff);
    text-align: center;
    color: var(--bps-bk-ink, #1a1a1a);
}

.bps-booking--empty h3 {
    margin: 0 0 0.75rem;
    font-size: 1.125rem;
}

/* ── Select2 overrides to match card ──────────────────────────────── */

.bps-booking-card .select2-container--default .select2-selection--single {
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 6px;
    height: 30px;
    background: var(--light-bg, #ffffff);
}

.bps-booking-card .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px;
    padding-left: 8px;
    padding-right: 20px;
    font-size: 12px;
    color: inherit;
}

.bps-booking-card .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 28px;
}

.bps-booking-card .select2-container--default.select2-container--focus .select2-selection--single,
.bps-booking-card .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--brand-color, #534AB7);
}

.select2-dropdown.bps-bk-tz-dropdown {
    border-color: var(--border-color, #e8e8e8);
    border-radius: 6px;
    font-size: 12px;
}

.select2-dropdown.bps-bk-tz-dropdown .select2-results__option--highlighted[aria-selected] {
    background: var(--brand-color, #534AB7);
}

/* ================================================================== */
/*  INTAKE PAGE — mockup 04                                           */
/* ================================================================== */

.bps-booking--intake {
    padding: 40px 20px;
    background: transparent;
    /* Same container-vs-viewport reasoning as .bps-booking--panel above. */
    container-type: inline-size;
}

.bps-booking--intake .bps-bk-intake-card {
    background: var(--light-bg, #ffffff);
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    overflow: hidden;
    color: var(--bps-bk-ink, #1a1a1a);
    font-family: inherit;
}

/* Progress bar */
.bps-booking--intake .bps-bk-progress {
    padding: 20px 32px 16px;
    border-bottom: 1px solid var(--border-color, #e8e8e8);
}

.bps-booking--intake .bps-bk-progress-bar {
    height: 4px;
    background: var(--light-bg2, #f3f3f0);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.bps-booking--intake .bps-bk-progress-fill {
    height: 100%;
    background: var(--brand-color, #534AB7);
    transition: width 0.3s ease;
}

.bps-booking--intake .bps-bk-progress-label {
    font-size: 11px;
    font-weight: 500;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Event banner */
.bps-booking--intake .bps-bk-event-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 32px;
    background: #EEEDFE;
    border-bottom: 1px solid var(--border-color, #e8e8e8);
}

.bps-booking--intake .bps-bk-event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--brand-color, #534AB7);
    margin-top: 6px;
    flex-shrink: 0;
}

.bps-booking--intake .bps-bk-event-banner__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--bps-bk-ink, #1a1a1a);
    line-height: 1.3;
}

.bps-booking--intake .bps-bk-event-banner__with {
    font-weight: 400;
    color: #6b6b6b;
    margin-left: 4px;
}

.bps-booking--intake .bps-bk-event-banner__meta {
    font-size: 13px;
    color: #6b6b6b;
    margin-top: 4px;
}

/* Form body */
.bps-booking--intake .bps-bk-intake-body {
    padding: 28px 32px 32px;
}

.bps-booking--intake .bps-bk-intake-heading {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px;
    color: var(--bps-bk-ink, #1a1a1a);
}

.bps-booking--intake .bps-bk-intake-sub {
    font-size: 13px;
    color: #6b6b6b;
    margin: 0 0 20px;
}

.bps-booking--intake .bps-bk-intake-error {
    padding: 10px 12px;
    background: #FEE4E2;
    border: 1px solid #FDA29B;
    border-radius: 6px;
    color: #B42318;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Form fields */
.bps-booking--intake .bps-bk-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.bps-booking--intake .bps-bk-field {
    margin-bottom: 16px;
}

.bps-booking--intake .bps-bk-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--bps-bk-ink, #1a1a1a);
    margin-bottom: 6px;
}

.bps-booking--intake .bps-bk-req {
    color: #B42318;
    font-weight: 400;
}

.bps-booking--intake .bps-bk-optional {
    color: #a0a0a0;
    font-weight: 400;
    font-size: 12px;
}

.bps-booking--intake .bps-bk-input,
.bps-booking--intake .bps-bk-textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--bps-bk-ink, #1a1a1a);
    background: var(--light-bg, #ffffff);
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.bps-booking--intake .bps-bk-input:focus,
.bps-booking--intake .bps-bk-textarea:focus {
    outline: none;
    border-color: var(--brand-color, #534AB7);
    box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.12);
}

.bps-booking--intake .bps-bk-textarea {
    resize: vertical;
    min-height: 80px;
}

.bps-booking--intake .bps-bk-intake-actions {
    margin-top: 20px;
}

.bps-booking--intake .bps-bk-intake-privacy {
    margin: 16px 0 0;
    font-size: 11px;
    color: #a0a0a0;
    line-height: 1.5;
    text-align: center;
}

/* ================================================================== */
/*  CONFIRMATION PAGE — mockup 05                                     */
/* ================================================================== */

.bps-booking--confirm {
    padding: 40px 20px;
    background: transparent;
    /* Same container-vs-viewport reasoning as .bps-booking--panel above. */
    container-type: inline-size;
}

.bps-booking--confirm .bps-bk-confirm-card {
    background: var(--light-bg, #ffffff);
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    overflow: hidden;
    color: var(--bps-bk-ink, #1a1a1a);
    font-family: inherit;
}

.bps-booking--confirm .bps-bk-success-banner {
    background: #EAF3DE;
    padding: 32px;
    text-align: center;
    border-bottom: 1px solid var(--border-color, #e8e8e8);
}

.bps-booking--confirm .bps-bk-check-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3B6D11;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.bps-booking--confirm .bps-bk-confirm-title {
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 6px;
}

.bps-booking--confirm .bps-bk-confirm-sub {
    font-size: 13px;
    color: #3B6D11;
    margin: 0;
}

.bps-booking--confirm .bps-bk-email-pill {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 10px;
    background: var(--light-bg, #ffffff);
    border: 1px solid #c8dbae;
    border-radius: 999px;
    font-size: 12px;
    color: #3B6D11;
    font-weight: 500;
}

.bps-booking--confirm .bps-bk-confirm-body {
    padding: 28px 32px;
}

.bps-booking--confirm .bps-bk-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 12px;
}

.bps-booking--confirm .bps-bk-detail-block {
    margin-bottom: 20px;
}

.bps-booking--confirm .bps-bk-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
}

.bps-booking--confirm .bps-bk-detail-icon {
    flex-shrink: 0;
    color: #a0a0a0;
    margin-top: 2px;
}

.bps-booking--confirm .bps-bk-detail-main {
    font-weight: 500;
    color: var(--bps-bk-ink, #1a1a1a);
    line-height: 1.4;
}

.bps-booking--confirm .bps-bk-detail-sub {
    font-size: 12px;
    color: #6b6b6b;
    margin-top: 2px;
    line-height: 1.4;
}

.bps-booking--confirm .bps-bk-divider {
    border: none;
    border-top: 1px solid var(--border-color, #e8e8e8);
    margin: 16px 0;
}

/* Calendar buttons row */
.bps-booking--confirm .bps-bk-cal-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.bps-booking--confirm .bps-bk-cal-btns--row .bps-bk-cal-btn {
    flex: 1 1 0;
}

.bps-booking--confirm .bps-bk-cal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--bps-bk-ink, #1a1a1a);
    background: var(--light-bg, #ffffff);
    border: 1px solid var(--border-color, #e8e8e8);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s;
}

.bps-booking--confirm .bps-bk-cal-btn:hover {
    border-color: var(--brand-color, #534AB7);
    color: var(--brand-color, #534AB7);
}

/* Action row (cancel + book again) */
.bps-booking--confirm .bps-bk-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    flex-wrap: wrap;
}

.bps-booking--confirm .bps-bk-action-link {
    background: none;
    border: 0;
    font-size: 13px;
    font-weight: 500;
    color: #6b6b6b;
    cursor: pointer;
    padding: 6px 2px;
    text-decoration: none;
    font-family: inherit;
}

.bps-booking--confirm .bps-bk-action-link:hover {
    color: var(--bps-bk-ink, #1a1a1a);
}

.bps-booking--confirm .bps-bk-action-link--danger {
    color: #B42318;
}

.bps-booking--confirm .bps-bk-action-link--danger:hover {
    color: #912006;
}

.bps-booking--confirm .bps-bk-book-again {
    color: var(--brand-color, #534AB7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.bps-booking--confirm .bps-bk-book-again:hover {
    text-decoration: underline;
}

/* ================================================================== */
/*  Shared buttons — used across intake + confirmation                */
/* ================================================================== */

.bps-booking .bps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
    line-height: 1.2;
}

.bps-booking .bps-btn--primary {
    background: var(--brand-color, #534AB7);
    color: #ffffff;
    border-color: var(--brand-color, #534AB7);
}

.bps-booking .bps-btn--primary:hover:not(:disabled) {
    background: #3C3489;
    border-color: #3C3489;
}

.bps-booking .bps-btn--outline {
    background: transparent;
    color: var(--bps-bk-ink, #1a1a1a);
    border-color: var(--border-color, #e8e8e8);
}

.bps-booking .bps-btn--outline:hover:not(:disabled) {
    border-color: var(--brand-color, #534AB7);
    color: var(--brand-color, #534AB7);
}

.bps-booking .bps-btn--full {
    width: 100%;
}

.bps-booking .bps-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ================================================================== */
/*  MODAL — bps_booking modal="1"                                     */
/* ================================================================== */

.bps-bk-modal-trigger {
    cursor: pointer;
}

.bps-bk-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
}

.bps-bk-modal.bps-bk-modal--open {
    display: flex;
}

.bps-bk-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, 0.55);
    z-index: 1;
    cursor: pointer;
}

.bps-bk-modal__dialog {
    position: relative;
    z-index: 2;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    animation: bps-bk-modal-in 0.18s ease-out;
}

@keyframes bps-bk-modal-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bps-bk-modal__close {
    position: absolute;
    top: -8px;
    right: -8px;
    z-index: 3;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: var(--light-bg, #ffffff);
    color: var(--bps-bk-ink, #1a1a1a);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    font-family: inherit;
}

.bps-bk-modal__close:hover {
    color: var(--brand-color, #534AB7);
}

.bps-bk-modal__body {
    background: transparent;
}

/* Inside a modal the card shouldn't have its own outer padding — the modal handles that. */
.bps-bk-modal__body .bps-booking--panel {
    padding: 0;
}

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 640px) {
    /* BUG-995 — reclaim the horizontal space nested ANCESTOR padding eats.
       Live blog 55 measured FIVE nested Elementor container paddings taking 63px off
       EACH side inside a 390px viewport, leaving a 264px-wide card the component can
       neither see nor control — that padding lives on the PAGE, not in this plugin.
       Rather than guess a page-specific offset (fragile, and wrong on every other
       page), break the panel out to the actual VIEWPORT width. This is the same
       recipe as BPS's own `.bps-full-bleed` utility (`bps-framework.scss`), which
       already established that a site-wide `body { overflow-x: clip }` absorbs the
       `100vw` scrollbar-width overhang safely (BUG-234) — so this reuses a proven
       pattern rather than inventing a new one.
       Trade-off, stated plainly: this makes the calendar edge-to-edge on EVERY
       mobile page, including ones with little or no ancestor padding, not only the
       pages with the 5-deep-nesting defect — the component has no way to tell how
       much padding its ancestors contributed, so it claims the full viewport rather
       than guess low and stay squeezed. Excluded from `.bps-bk-modal__body` below,
       where the panel sits inside a centred dialog and must not escape it.
       Selector is `.bps-booking--panel.bps-booking` (both classes really are on
       the element — see calendar.php's `<section>` tag), not the bare class, for
       the same reason as the BUG-988 tone-loop fix above: measured on blog 43, the
       compiled palette's own `.section-body { padding: 3.5rem 1.5rem }` is the
       SAME (0,1,0) specificity as a bare `.bps-booking--panel`, and whichever
       stylesheet happens to load second wins that tie — here, the palette did,
       silently eating the padding override. Two real classes make this (0,2,0)
       and win regardless of enqueue order. */
    .bps-booking--panel.bps-booking {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
        padding: 16px 8px;
    }

    /* The modal dialog already centres and sizes itself (`.bps-bk-modal__dialog`,
       max-width: 860px) — the breakout above must not fight it. (0,3,0) beats the
       (0,2,0) breakout regardless of source order, so the reset always wins. */
    .bps-bk-modal__body .bps-booking--panel.bps-booking {
        width: auto;
        margin-left: 0;
        margin-right: 0;
    }

    .bps-booking--panel .bps-booking-card {
        grid-template-columns: 1fr;
        min-height: 0;
        max-width: 100%;
    }

    .bps-booking-card .bps-bk-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border-color, #e8e8e8);
        padding: 24px 20px;
    }

    .bps-booking-card .bps-bk-tz-row {
        margin-top: 16px;
        padding-top: 16px;
    }

    /* Horizontal padding trimmed from 20px to 12px (vertical unchanged) — the
       calendar grid lives in here, and every px reclaimed here is a px toward the
       44px minimum tap target below. */
    .bps-booking-card .bps-bk-main {
        padding: 24px 12px;
    }

    /* BUG-995 — day cells were 30x32px against a 44px minimum tap target (Apple HIG /
       WCAG 2.5.5). Width falls out of the breakout + padding trim above (7 equal grid
       columns over the reclaimed width clear 44px comfortably down to a 360px-wide
       phone — 44.0px exactly at that floor, more everywhere wider); height needs an
       explicit floor since the cell was sized by font + padding alone. `display: flex`
       centers the day number in the taller box without hand-tuning padding per font
       size. Deliberately NOT `min-width: 44px`: the card has `overflow: hidden`
       (base rule above), and a hard min-width would overflow it — invisibly clipping
       the rightmost day columns — on the handful of sub-360px phones still in use,
       which is worse than the defect this fixes. Below 360px the cells undershoot
       44px slightly rather than disappear. */
    .bps-booking-card .bps-bk-cal-day {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 4px;
    }

    .bps-booking-card .bps-bk-slots-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .bps-booking--intake .bps-bk-progress,
    .bps-booking--intake .bps-bk-event-banner,
    .bps-booking--intake .bps-bk-intake-body,
    .bps-booking--confirm .bps-bk-success-banner,
    .bps-booking--confirm .bps-bk-confirm-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .bps-booking--intake .bps-bk-form-row {
        grid-template-columns: 1fr;
    }

    .bps-booking--confirm .bps-bk-cal-btns {
        flex-direction: column;
    }
}

/* ── Responsive, container-aware ─────────────────────────────────────
 * Same rules as the @media block above, but keyed to the WIDTH THIS
 * WIDGET ACTUALLY HAS, not the browser viewport. `.bps-booking--panel`,
 * `--intake` and `--confirm` each declare `container-type: inline-size`
 * above, so this fires whenever a page author (e.g. a narrow BPS/Elementor
 * column) hands the widget less than 640px, even on a full desktop screen —
 * which is exactly the case a viewport media query cannot see. Kept as a
 * SEPARATE block, not a replacement, so a browser without container-query
 * support (the @media block still covers it) degrades safely rather than
 * silently losing mobile styling.
 */
@container (max-width: 640px) {
    .bps-booking--panel {
        padding: 16px 8px;
    }

    .bps-booking--panel .bps-booking-card {
        grid-template-columns: 1fr;
        min-height: 0;
        max-width: 100%;
    }

    .bps-booking-card .bps-bk-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border-color, #e8e8e8);
        padding: 24px 20px;
    }

    .bps-booking-card .bps-bk-tz-row {
        margin-top: 16px;
        padding-top: 16px;
    }

    /* Mirrors the @media block's trim (20px → 12px) — see BUG-995 comment there.
       Load-bearing here, not cosmetic: `.bps-booking--panel` sets
       `container-type: inline-size`, so on a real phone BOTH this block and the
       @media block above match at once, and for any selector they share, this one
       — being later in the file, at equal specificity — wins the tie. Leaving this
       at the old 20px would have silently swallowed the @media block's padding
       trim on every real mobile viewport, which is exactly what happened until
       this line was added: the day cells got their 44px height but not the width
       headroom to go with it. */
    .bps-booking-card .bps-bk-main {
        padding: 24px 12px;
    }

    /* Mirrors the @media block's tap-target fix — see BUG-995 comment there. Also
       applies here on its own merits: a widget handed a narrow column on an
       otherwise-wide screen (the case this block exists for) can still be a touch
       device, e.g. a tablet in split view. */
    .bps-booking-card .bps-bk-cal-day {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 4px;
    }

    .bps-booking-card .bps-bk-slots-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .bps-booking--intake .bps-bk-progress,
    .bps-booking--intake .bps-bk-event-banner,
    .bps-booking--intake .bps-bk-intake-body,
    .bps-booking--confirm .bps-bk-success-banner,
    .bps-booking--confirm .bps-bk-confirm-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .bps-booking--intake .bps-bk-form-row {
        grid-template-columns: 1fr;
    }

    .bps-booking--confirm .bps-bk-cal-btns {
        flex-direction: column;
    }
}
