/* ==========================================================================
   booking-modern.css — Customer tee time booking page modernization layer
   Loaded AFTER styles.css on booking.html only.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Accessibility: time slots & calendar days are now real <button>s.
   styles.css has a global `button { background:#3a6e35; color:white;
   padding:12px 20px; font-size:1rem; ... }` plus hover transform/shadow —
   neutralize ALL of it so the original chip/day visuals are preserved.
   -------------------------------------------------------------------------- */
button.time-slot,
#calendar button.calendar-day {
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: #1f2937;
    background-color: transparent;
    width: 100%;
    margin: 0;
    box-shadow: none;
}
#calendar button.calendar-day {
    border: none;
    padding: 0;
    min-height: 48px;
    border-radius: 8px;
}
button.time-slot {
    padding: 14px 10px;
}
/* Kill the global button hover lift/shadow on these controls */
button.time-slot:hover:not(:disabled),
#calendar button.calendar-day:hover:not(:disabled) {
    transform: none;
    box-shadow: none;
}
button.time-slot:active:not(:disabled),
#calendar button.calendar-day:active:not(:disabled) {
    transform: none;
    box-shadow: none;
}
/* Restore intended state colors (global button:disabled sets gray bg) */
#calendar button.calendar-day.current-month {
    background-color: #f0f0f0;
}
#calendar button.calendar-day.current-month:hover:not(:disabled) {
    background-color: #d5e8d4;
}
#calendar button.calendar-day.selected {
    background-color: var(--brand-primary, #3a6e35);
    color: #ffffff;
}
#calendar button.calendar-day.past,
#calendar button.calendar-day:disabled {
    background-color: #f0f0f0;
    color: #aaa;
    text-decoration: line-through;
}
button.time-slot.available {
    background-color: #d5e8d4;
}
button.time-slot.available:hover:not(:disabled):not(.selected) {
    background-color: #c2ddc0;
}
button.time-slot.partial {
    background-color: #fff2cc;
}
button.time-slot.partial:hover:not(:disabled):not(.selected) {
    background-color: #ffe9a8;
}
button.time-slot.selected:hover:not(:disabled) {
    background-color: var(--brand-primary, #3a6e35);
}
button.time-slot:disabled,
button.time-slot.booked,
button.time-slot.blocked {
    background-color: #f8cecc;
    color: #6b7280;
    opacity: 0.7;
}
button.time-slot:disabled,
#calendar button.calendar-day:disabled {
    cursor: not-allowed;
}

/* Always-visible keyboard focus */
button.time-slot:focus-visible,
#calendar button.calendar-day:focus-visible,
.secondary-button:focus-visible,
#summary-bar-continue:focus-visible {
    outline: 2px solid var(--brand-primary, #3a6e35);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   2. Time-of-day group labels (Morning / Afternoon / Evening)
   -------------------------------------------------------------------------- */
.slot-group-label {
    grid-column: 1 / -1;
    margin-top: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #555f6b;
    border-bottom: 1px solid #e3e7e4;
    padding-bottom: 4px;
}
.slot-group-label:first-child {
    margin-top: 0;
}

/* Keep slot times on one line */
.time-slot {
    white-space: nowrap;
}

/* Selected slot: explicit dark fill so contrast holds even when the popIn
   animation is skipped (e.g. prefers-reduced-motion) */
button.time-slot.selected {
    background-color: var(--brand-primary, #3a6e35);
    border-color: var(--brand-primary, #3a6e35);
    color: #ffffff;
}

/* Prevent grid blowout: allow booking columns to shrink below content width
   (fixes horizontal page scroll on small phones) */
.booking-container > * {
    min-width: 0;
}

/* Desktop booking layout: the shared stylesheet uses four time columns inside a
   narrow middle panel, which can force time labels to wrap or spill sideways. */
@media (min-width: 1024px) {
    .booking-container {
        grid-template-columns: minmax(230px, 0.9fr) minmax(280px, 1.15fr) minmax(270px, 1fr);
        gap: 22px;
    }

    #time-slots {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    button.time-slot {
        min-width: 0;
        padding: 12px 8px;
        font-size: 0.88rem;
        line-height: 1.15;
    }
}

@media (min-width: 1280px) {
    .booking-container {
        grid-template-columns: minmax(260px, 0.95fr) minmax(360px, 1.25fr) minmax(300px, 1fr);
    }

    #time-slots {
        grid-template-columns: repeat(4, minmax(76px, 1fr));
    }
}

@media (max-width: 767px) {
    .booking-section {
        margin-left: auto;
        margin-right: auto;
        max-width: 520px;
    }

    .calendar-container,
    .time-slots-container,
    .booking-form-container {
        padding: 18px 14px;
        border-radius: 12px;
    }

    #calendar .calendar-grid {
        gap: 4px;
    }

    #calendar button.calendar-day {
        min-height: 42px;
        border-radius: 7px;
        font-size: 0.9rem;
    }

    #time-slots {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
}

/* --------------------------------------------------------------------------
   3. Secondary buttons: outline style so they no longer look disabled
   (View Membership Options, Validate code, Sign Out, …)
   -------------------------------------------------------------------------- */
.secondary-button {
    background: #ffffff;
    color: var(--brand-primary, #3a6e35);
    border: 1.5px solid var(--brand-primary, #3a6e35);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.secondary-button:hover {
    background: var(--brand-primary, #3a6e35);
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   4. Collapsible member sign-in & special-code sections
   -------------------------------------------------------------------------- */
.member-signin-collapse summary,
.promo-code-collapse summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand-primary, #3a6e35);
    padding: 6px 0;
    list-style-position: inside;
}
.member-signin-collapse summary:hover,
.promo-code-collapse summary:hover {
    text-decoration: underline;
}
.member-signin-collapse[open] summary,
.promo-code-collapse[open] summary {
    margin-bottom: 8px;
}
.member-signin-collapse .member-signin-intro {
    margin: 0 0 10px;
    color: #555f6b;
    font-size: 0.92rem;
}

/* Sign-in card becomes a slim row when collapsed */
.member-session-card:has(.member-signin-collapse:not([open])) {
    padding-top: 10px;
    padding-bottom: 10px;
}

/* --------------------------------------------------------------------------
   5. Legend: tidy single-row pills
   -------------------------------------------------------------------------- */
.booking-section .legend {
    gap: 8px 14px;
    align-items: center;
}
.booking-section .legend-item {
    background: #f6f8f7;
    border: 1px solid #e3e7e4;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. Sticky selection summary bar (mobile only)
   -------------------------------------------------------------------------- */
.booking-summary-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: #1f2937;
    color: #ffffff;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s ease;
}
.booking-summary-bar.hidden {
    display: none;
}
.booking-summary-bar.summary-bar-suppressed {
    transform: translateY(110%);
}
.summary-bar-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
#summary-bar-datetime {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#summary-bar-price {
    font-size: 0.85rem;
    color: #9fd99a;
    font-weight: 700;
}
#summary-bar-continue {
    flex-shrink: 0;
    appearance: none;
    border: none;
    border-radius: 8px;
    background: var(--brand-secondary, #5a9e54);
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    padding: 10px 18px;
    cursor: pointer;
}
#summary-bar-continue:hover {
    background: var(--brand-primary, #3a6e35);
}

@media (max-width: 768px) {
    .booking-summary-bar:not(.hidden) {
        display: flex;
    }
    /* Keep the bar from covering the end of the form */
    .booking-form-container {
        padding-bottom: 72px;
    }
}

/* --------------------------------------------------------------------------
   7. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .time-slot.slot-animate-in,
    .time-slot.selected,
    #calendar .calendar-day {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
    }
    .booking-summary-bar {
        transition: none;
    }
}
