@import url("./booking-progress.css");
@import url("./booking-locations.css");
@import url("./session-types.css");
@import url("./register.css");
@import url("./calendar.css");
@import url("./promo.css");
@import url("./payment.css");
@import url("./terms.css");
@import url("./confirmation.css");
@import url("./confirmation-blocks.css");
@import url("./post-booking-actions.css");
@import url("./reschedule.css");

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--sp-text-color, #212529);
    background: var(--sp-page-background, #ffffff);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--sp-page-background, #ffffff);
}

.sp-booking-shell {
    width: 100%;
}

.sp-standalone .sp-booking-shell {
    max-width: 1120px;
    margin: 1.75rem auto;
    overflow: hidden;
    border: 1px solid var(--sp-border-color, #e0e0e0);
    border-radius: 8px;
    background: var(--sp-form-background, var(--sp-surface-color, #ffffff));
    box-shadow: 0 1px 4px rgb(0 0 0 / 10%);
}

.sp-hosted-header {
    background: var(--portal-header-bg, #ffffff);
    color: var(--portal-header-text, #1a1a1a);
    border-bottom: 1px solid var(--portal-header-border, #e5e7eb);
}

.sp-hosted-header--minimal {
    border-bottom-color: transparent;
}

.sp-hosted-header--branded {
    background: var(--portal-header-branded-bg, var(--sp-header-bg, #1976d2));
    color: var(--portal-header-branded-text, var(--sp-header-text, #ffffff));
    border-bottom-color: transparent;
}

.sp-hosted-header-content {
    min-height: 72px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.sp-center-align .sp-hosted-header-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.sp-hosted-brand {
    min-width: 0;
    display: flex;
    align-items: center;
}

.sp-center-align .sp-hosted-brand {
    grid-column: 2;
    justify-self: center;
}

.sp-hosted-logo {
    display: block;
    max-width: min(220px, 48vw);
    max-height: 40px;
    object-fit: contain;
    background: transparent;
}

.sp-hosted-business-name {
    max-width: min(320px, 52vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: currentColor;
    font-family: var(--sp-font-primary, inherit);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.sp-hosted-header-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-space-4, 1rem);
    min-width: 44px;
}

.sp-hosted-utility-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-space-2, 0.5rem);
    min-width: var(--sp-touch-min, 44px);
    min-height: var(--sp-touch-min, 44px);
    max-width: min(14rem, 32vw);
    padding: var(--sp-space-3, 0.75rem) var(--sp-space-2, 0.5rem);
    overflow: hidden;
    color: color-mix(in oklch, var(--tenant-text, var(--sp-text, #111827)) 75%, transparent);
    font-size: var(--sp-text-sm, 0.875rem);
    font-weight: 500;
    line-height: 1.25rem;
    text-align: left;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: text-decoration-color 0.15s ease;
}

.sp-hosted-utility-icon {
    flex: 0 0 auto;
}

.sp-hosted-utility-link span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-center-align .sp-hosted-header-actions {
    grid-column: 3;
    justify-self: end;
}

.sp-hosted-utility-link:hover,
.sp-hosted-utility-link:focus-visible {
    color: var(--tenant-text, var(--sp-text, #111827));
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.sp-hosted-utility-link:focus-visible {
    outline: 0;
    border-radius: 4px;
    box-shadow: var(--sp-shadow-focus, 0 0 0 3px color-mix(in oklch, var(--tenant-text, var(--sp-text, #111827)) 38%, transparent));
}

.sp-hosted-header-accent {
    height: 3px;
    background: var(--portal-header-accent, var(--sp-button-color, #1976d2));
}

.sp-booking-main {
    width: 100%;
    min-height: calc(100vh - 72px);
    padding: 3rem 2.25rem;
    background: var(--sp-form-background, var(--sp-surface-color, #ffffff));
}

.sp-center-align .sp-booking-main {
    text-align: var(--sp-content-align, center);
}

.sp-standalone .sp-booking-main {
    min-height: auto;
}

.sp-embedded .sp-booking-main {
    min-height: 100vh;
    padding: 1rem;
}

.sp-booking-step {
    max-width: 960px;
    margin: 0 auto;
}

.sp-step-heading {
    margin: 0 0 1rem;
    color: var(--sp-heading-color, var(--sp-text-color, #212529));
    font-family: var(--sp-font-primary, inherit);
    font-size: clamp(1.75rem, 4vw, 2.4rem);
    line-height: 1.15;
}

.sp-step-description {
    margin: 0 0 2rem;
    color: var(--sp-secondary-text, #666);
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.5;
}

.sp-step-custom-content {
    margin: 0 0 2rem;
    color: var(--sp-text-color, #212529);
    line-height: 1.6;
}

.sp-step-custom-content > :first-child {
    margin-top: 0;
}

.sp-step-custom-content > :last-child {
    margin-bottom: 0;
}

.sp-step-custom-content a {
    color: var(--sp-button-color, var(--sp-link-color, #1976d2));
}

.sp-step-custom-content .content-warning,
.sp-terms-content .content-warning,
.sp-custom-message .content-warning,
.sp-custom-html .content-warning {
    color: var(--sp-error-text, var(--sp-error-color, #991b1b));
    font-weight: 600;
}

@media (max-width: 767px) {
    .sp-standalone .sp-booking-shell {
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .sp-hosted-header-content {
        min-height: 60px;
        padding: 0 1rem;
    }

    .sp-hosted-logo {
        max-width: min(180px, 54vw);
        max-height: 32px;
    }

    .sp-center-align .sp-hosted-header-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: var(--sp-space-2, 0.5rem);
        min-height: auto;
        padding: var(--sp-space-3, 0.75rem) var(--sp-space-4, 1rem);
    }

    .sp-center-align .sp-hosted-brand,
    .sp-center-align .sp-hosted-header-actions {
        grid-column: auto;
        justify-self: center;
    }

    .sp-center-align .sp-hosted-header-actions {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--sp-space-2, 0.5rem) var(--sp-space-4, 1rem);
    }

    .sp-center-align .sp-hosted-utility-link {
        max-width: 100%;
    }

    .sp-booking-main {
        padding: 1.5rem 1rem;
    }
}

@media (max-width: 479px) {
    .sp-hosted-header-content,
    .sp-center-align .sp-hosted-header-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: var(--sp-space-3, 0.75rem);
        min-height: auto;
        padding: var(--sp-space-3, 0.75rem) var(--sp-space-4, 1rem);
    }

    .sp-center-align .sp-hosted-brand,
    .sp-center-align .sp-hosted-header-actions {
        grid-column: auto;
        justify-self: start;
    }

    .sp-hosted-header-actions {
        width: 100%;
        max-width: none;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-space-1, 0.25rem);
    }

    .sp-hosted-utility-link {
        max-width: 100%;
        justify-content: flex-start;
    }
}

/* Shared booking action buttons */
.sp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem 2rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-family: var(--sp-font-family, inherit);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.sp-btn-primary {
    background: var(--sp-button-color, var(--sp-button-primary, #1976d2));
    color: var(--sp-button-text, #ffffff);
}

.sp-btn-primary:hover:not(:disabled) {
    background: var(--sp-button-hover-bg, var(--sp-button-primary-hover, #1565c0));
}

.sp-btn-back,
.sp-back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 9rem;
    padding: 0.75rem 2rem;
    border: 1px solid var(--sp-secondary-button-border-color, var(--sp-back-button-border-color, var(--sp-border-color, #bdbdbd)));
    border-radius: 4px;
    background: var(--sp-secondary-bg, var(--sp-surface-color, #ffffff));
    color: var(--sp-secondary-button-text-color, var(--sp-back-button-font-color, var(--sp-text-muted, #757575)));
    font-family: var(--sp-font-family, inherit);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.sp-btn-back:hover,
.sp-btn-back:focus,
.sp-back-link:hover,
.sp-back-link:focus {
    background: var(--sp-secondary-hover-bg, #f2f2f2);
    border-color: var(--sp-secondary-button-border-color, var(--sp-back-button-border-color, var(--sp-border-color, #bdbdbd)));
    color: var(--sp-secondary-button-text-color, var(--sp-back-button-font-color, var(--sp-text-muted, #757575)));
    text-decoration: none;
}

.sp-btn:focus-visible,
.sp-back-link:focus-visible {
    outline: 3px solid var(--sp-button-focus-outline, var(--sp-focus-color, #1976d2));
    outline-offset: 2px;
}

.sp-btn:disabled,
.sp-continue-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.sp-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sp-spin 0.75s linear infinite;
}

@keyframes sp-spin {
    to { transform: rotate(360deg); }
}

/* In-button loading state applied by button-loading.js when a form submits
   and navigates the page. The spinner inherits the button text colour via
   currentColor. */
.sp-btn-spinner {
    margin-left: 0.5rem;
    vertical-align: middle;
}

.sp-btn-loading {
    pointer-events: none;
    cursor: progress;
    opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
    .sp-spinner {
        animation-duration: 1.5s;
    }
}

.sp-step-navigation,
.sp-nav-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.sp-step-navigation {
    padding-top: 1rem;
    border-top: 1px solid var(--sp-border-color, #e5e7eb);
}

.sp-nav-buttons {
    margin-top: 2rem;
}

.sp-nav-form {
    margin: 0;
}

@media (max-width: 767px) {
    .sp-step-navigation,
    .sp-nav-buttons {
        align-items: stretch;
        flex-direction: column;
    }

    .sp-step-navigation .sp-btn,
    .sp-step-navigation .sp-back-link,
    .sp-step-navigation .sp-continue-button,
    .sp-nav-buttons .sp-btn,
    .sp-nav-form,
    .sp-nav-form .sp-btn {
        width: 100%;
    }
}

/* Question-style form steps (session promotion, inline questions). These pages
   share the .sp-question-field markup but load no page stylesheet of their own,
   so the field styling lives here in the global booking stylesheet: labels sit
   above full-width controls in a single left-aligned column, with breathing
   room before the navigation divider. */
.sp-question-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 480px;
    margin: 0 0 2rem;
    text-align: left;
}

/* Center the column itself (not its text) for center-aligned tenants. */
.sp-center-align .sp-question-fields {
    margin-inline: auto;
}

.sp-question-field label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--sp-label-color, #333);
}

.sp-question-field .sp-input,
.sp-question-field .sp-select,
.sp-question-field .sp-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--sp-text-color, #212529);
    background: var(--sp-input-background, var(--sp-surface-color, #ffffff));
    border: 1px solid var(--sp-border-color, #d1d5db);
    border-radius: var(--sp-radius, 8px);
    min-height: 44px;
}

.sp-question-field .sp-textarea {
    min-height: 96px;
    resize: vertical;
}

.sp-question-field .sp-input:focus,
.sp-question-field .sp-select:focus,
.sp-question-field .sp-textarea:focus {
    outline: none;
    border-color: var(--sp-button-color, #1976d2);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-button-color, #1976d2) 22%, transparent);
}

.sp-question-field .sp-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.sp-question-field .sp-checkbox {
    flex: 0 0 auto;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    accent-color: var(--sp-button-color, #1976d2);
}

.sp-question-field .sp-checkbox-label {
    margin-bottom: 0;
    font-weight: 400;
}

.sp-question-field .sp-required {
    margin-left: 0.25rem;
    color: var(--sp-error-color, #d32f2f);
}

.sp-question-field .sp-number-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8125rem;
    color: var(--sp-text-muted, #6c757d);
}

.sp-question-field .sp-field-error {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: var(--sp-error-color, #d32f2f);
}

.sp-question-field.sp-field-error-state .sp-input,
.sp-question-field.sp-field-error-state .sp-select,
.sp-question-field.sp-field-error-state .sp-textarea {
    border-color: var(--sp-error-color, #d32f2f);
}

.sp-processing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.25rem;
    min-height: 50vh;
    gap: 1rem;
}

.sp-processing-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--sp-border-color, #e5e7eb);
    border-top-color: var(--sp-primary-color, #2563eb);
    border-radius: 50%;
    animation: sp-spin 0.9s linear infinite;
    margin-bottom: 0.5rem;
}

.sp-processing-heading {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--sp-text-color, #111827);
}

.sp-processing-message {
    margin: 0;
    max-width: 32rem;
    color: var(--sp-text-muted-color, #6b7280);
}

@media (prefers-reduced-motion: reduce) {
    .sp-processing-spinner {
        animation-duration: 2.5s;
    }
}

/* Visually-hidden utility for screen-reader-only content. Defined here in the
   GLOBAL booking stylesheet (loaded by _BookingLayout on every step) so the hold
   countdown's threshold/expiry announcements stay invisible to sighted users on
   ALL post-date steps — not just the few page stylesheets that happened to define
   their own copy (locations, promo, terms). */
.sp-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
