/**
 * ONS Booking System — public booking widget styles.
 *
 * Everything is scoped under .onsb-root / .onsb-modal / .onsb-fab so the
 * widget looks identical on every theme (Recommendation 08). CSS variables
 * (--onsb-brand, --onsb-radius) are injected by the widget config.
 */

.onsb-root,
.onsb-modal,
.onsb-fab {
        --onsb-brand: #2563eb;
        --onsb-brand-dark: #1d4ed8;
        --onsb-ink: #0f172a;
        --onsb-ink-soft: #475569;
        --onsb-muted: #94a3b8;
        --onsb-surface: #ffffff;
        --onsb-surface-soft: #f8fafc;
        --onsb-border: #e2e8f0;
        --onsb-radius: 14px;
        --onsb-shadow: 0 10px 40px -12px rgba(15, 23, 42, .25);
        --onsb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

/* Root container */
.onsb-root {
        box-sizing: border-box;
        font-family: var(--onsb-font);
        color: var(--onsb-ink);
        background: var(--onsb-surface);
        border: 1px solid var(--onsb-border);
        border-radius: var(--onsb-radius);
        overflow: hidden;
        max-width: 760px;
        margin: 0 auto;
        box-shadow: var(--onsb-shadow);
        direction: ltr;
}

.onsb-root *,
.onsb-modal * { box-sizing: border-box; }

/* Skeleton loader */
.onsb-skeleton { padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.onsb-skeleton__bar {
        height: 18px;
        border-radius: 8px;
        background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
        background-size: 200% 100%;
        animation: onsb-shimmer 1.3s infinite;
}
.onsb-skeleton__bar:nth-child(2) { width: 65%; }
.onsb-skeleton__bar:nth-child(3) { width: 45%; }
@keyframes onsb-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.onsb-visually-hidden {
        position: absolute !important;
        width: 1px; height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
}

/* Shell */
.onsb-shell { display: flex; flex-direction: column; min-height: 420px; }

.onsb-header {
        padding: 20px 24px 12px;
        border-bottom: 1px solid var(--onsb-border);
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: var(--onsb-surface-soft);
}

.onsb-header__logo { max-height: 44px; width: auto; align-self: flex-start; }

.onsb-header__title {
        margin: 0;
        font-size: 19px;
        font-weight: 700;
        letter-spacing: -0.01em;
}

/* Stepper */
.onsb-stepper {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 16px 24px 0;
        gap: 6px;
}

.onsb-stepper__item {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--onsb-muted);
        font-size: 12px;
        font-weight: 600;
}

.onsb-stepper__dot {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: var(--onsb-surface-soft);
        border: 1.5px solid var(--onsb-border);
        font-size: 12px;
        flex: 0 0 auto;
        transition: all .25s ease;
}

.onsb-stepper__item.is-done .onsb-stepper__dot {
        background: var(--onsb-brand);
        border-color: var(--onsb-brand);
        color: #fff;
}

.onsb-stepper__item.is-current .onsb-stepper__dot {
        border-color: var(--onsb-brand);
        color: var(--onsb-brand);
        box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.onsb-stepper__item.is-current { color: var(--onsb-ink); }
.onsb-stepper__label { display: none; }
@media (min-width: 640px) { .onsb-stepper__label { display: inline; } }

/* Body */
.onsb-body { flex: 1; padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }

/* Banners */
.onsb-banner {
        border-radius: 10px;
        padding: 10px 14px;
        font-size: 13.5px;
        line-height: 1.5;
        margin: 0 0 4px;
}
.onsb-banner--error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.onsb-banner--info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.onsb-banner--success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Loading */
.onsb-loading { color: var(--onsb-muted); font-size: 14px; margin: 8px 0; }
.onsb-muted { color: var(--onsb-muted); font-size: 13px; }

/* Services */
.onsb-services { display: flex; flex-direction: column; gap: 12px; }

.onsb-service-card {
        font-family: inherit;
        text-align: left;
        background: var(--onsb-surface);
        border: 1.5px solid var(--onsb-border);
        border-radius: 12px;
        padding: 16px 18px;
        cursor: pointer;
        transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.onsb-service-card:hover,
.onsb-service-card:focus-visible {
        border-color: var(--service-color, var(--onsb-brand));
        transform: translateY(-1px);
        box-shadow: 0 8px 24px -12px rgba(15, 23, 42, .3);
        outline: none;
}

.onsb-service-card__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.onsb-service-card__name { font-weight: 700; font-size: 15.5px; }
.onsb-service-card__badges { display: flex; gap: 6px; flex-wrap: wrap; }

.onsb-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        background: var(--onsb-surface-soft);
        border: 1px solid var(--onsb-border);
        color: var(--onsb-ink-soft);
        border-radius: 999px;
        padding: 3px 10px;
        font-size: 12px;
        font-weight: 600;
        white-space: nowrap;
}
.onsb-badge--status { background: var(--onsb-surface-soft); }

.onsb-service-card__desc { margin: 8px 0 0; color: var(--onsb-ink-soft); font-size: 13.5px; line-height: 1.55; }
.onsb-service-card__loc { margin: 6px 0 0; color: var(--onsb-muted); font-size: 12.5px; }

/* Calendar layout */
.onsb-calendar-layout { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 700px) { .onsb-calendar-layout { grid-template-columns: 1.2fr 1fr; } }

.onsb-tz-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.onsb-tz-label { font-size: 12.5px; color: var(--onsb-muted); }

.onsb-tz-select {
        font-family: inherit;
        font-size: 12.5px;
        padding: 6px 10px;
        border: 1px solid var(--onsb-border);
        border-radius: 8px;
        background: var(--onsb-surface);
        color: var(--onsb-ink);
        max-width: 260px;
}

.onsb-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.onsb-cal-title { font-weight: 700; font-size: 14.5px; text-transform: capitalize; }

.onsb-cal-nav {
        font-family: inherit;
        background: var(--onsb-surface-soft);
        border: 1px solid var(--onsb-border);
        border-radius: 8px;
        width: 34px;
        height: 34px;
        font-size: 18px;
        line-height: 1;
        color: var(--onsb-ink-soft);
        cursor: pointer;
        transition: background .15s ease;
}
.onsb-cal-nav:hover { background: var(--onsb-border); }

.onsb-cal-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
}

.onsb-cal-dow {
        text-align: center;
        font-size: 11px;
        font-weight: 700;
        color: var(--onsb-muted);
        text-transform: uppercase;
        letter-spacing: .04em;
        padding: 4px 0;
}

.onsb-cal-day {
        font-family: inherit;
        position: relative;
        border: 1.5px solid transparent;
        background: var(--onsb-surface);
        border-radius: 10px;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1px;
        cursor: pointer;
        transition: border-color .15s ease, background .15s ease;
        padding: 2px;
}

.onsb-cal-day__num { font-size: 13px; font-weight: 600; color: var(--onsb-ink); line-height: 1; }
.onsb-cal-day__count { font-size: 9.5px; font-weight: 700; color: var(--onsb-brand); line-height: 1; }

.onsb-cal-day--off { cursor: default; opacity: .35; background: var(--onsb-surface-soft); }
.onsb-cal-day--off .onsb-cal-day__count { display: none; }
.onsb-cal-day--empty { background: transparent; border: none; cursor: default; min-height: 30px; }

.onsb-cal-day--today .onsb-cal-day__num::after {
        content: "";
        display: block;
        width: 4px; height: 4px;
        border-radius: 50%;
        background: var(--onsb-muted);
        margin: 2px auto 0;
}

.onsb-cal-day:not(.onsb-cal-day--off):hover,
.onsb-cal-day:not(.onsb-cal-day--off):focus-visible { border-color: var(--onsb-brand); outline: none; }

.onsb-cal-day--selected {
        background: var(--onsb-brand);
        border-color: var(--onsb-brand);
}
.onsb-cal-day--selected .onsb-cal-day__num,
.onsb-cal-day--selected .onsb-cal-day__count { color: #fff; }

/* Slots */
.onsb-slots__title { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.onsb-slots__date { margin: 0 0 12px; font-size: 13px; color: var(--onsb-ink-soft); }
.onsb-slots__hint { margin: 6px 0 0; }
.onsb-slots__group { margin: 12px 0 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--onsb-muted); }

.onsb-slot-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.onsb-slot-pill {
        font-family: inherit;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        background: var(--onsb-surface);
        border: 1.5px solid var(--onsb-border);
        border-radius: 10px;
        padding: 8px 14px;
        cursor: pointer;
        transition: all .15s ease;
        min-width: 74px;
}

.onsb-slot-pill__time { font-weight: 700; font-size: 13.5px; color: var(--onsb-ink); line-height: 1.2; }
.onsb-slot-pill__end { font-size: 10.5px; color: var(--onsb-muted); line-height: 1.2; }

.onsb-slot-pill:hover,
.onsb-slot-pill:focus-visible { border-color: var(--onsb-brand); outline: none; }

.onsb-slot-pill.is-selected {
        background: var(--onsb-brand);
        border-color: var(--onsb-brand);
}
.onsb-slot-pill.is-selected .onsb-slot-pill__time { color: #fff; }
.onsb-slot-pill.is-selected .onsb-slot-pill__end { color: rgba(255, 255, 255, .75); }

/* Forms */
.onsb-form { display: flex; flex-direction: column; gap: 12px; }

.onsb-field { display: flex; flex-direction: column; gap: 5px; }
.onsb-field__label { font-size: 13px; font-weight: 600; color: var(--onsb-ink-soft); }

.onsb-input {
        font-family: inherit;
        font-size: 14px;
        padding: 11px 14px;
        border: 1.5px solid var(--onsb-border);
        border-radius: 10px;
        background: var(--onsb-surface);
        color: var(--onsb-ink);
        transition: border-color .15s ease, box-shadow .15s ease;
        width: 100%;
}

.onsb-input:focus {
        outline: none;
        border-color: var(--onsb-brand);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.onsb-textarea { resize: vertical; min-height: 74px; }

.onsb-consent {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        font-size: 12.5px;
        color: var(--onsb-ink-soft);
        line-height: 1.5;
}
.onsb-consent input[type="checkbox"] { margin-top: 2px; accent-color: var(--onsb-brand); width: 16px; height: 16px; flex: 0 0 auto; }

.onsb-honeypot {
        position: absolute !important;
        left: -9999px !important;
        width: 1px !important;
        height: 1px !important;
        opacity: 0 !important;
}

.onsb-turnstile { min-height: 0; }

.onsb-otp { border-top: 1px dashed var(--onsb-border); padding-top: 14px; }
.onsb-otp__hint { font-size: 13px; color: var(--onsb-ink-soft); margin: 8px 0; }
.onsb-otp__row { display: flex; gap: 8px; align-items: stretch; }
.onsb-otp__input { letter-spacing: .3em; font-size: 16px; font-weight: 700; max-width: 180px; }

/* Buttons */
.onsb-btn {
        font-family: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        border-radius: 10px;
        padding: 11px 20px;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        border: 1.5px solid transparent;
        text-decoration: none;
        transition: all .18s ease;
}

.onsb-btn--primary { background: var(--onsb-brand); color: #fff; }
.onsb-btn--primary:hover { background: var(--onsb-brand-dark); }
.onsb-btn--primary:disabled { opacity: .6; cursor: wait; }

.onsb-btn--secondary { background: var(--onsb-surface); color: var(--onsb-brand); border-color: var(--onsb-brand); }
.onsb-btn--secondary:hover { background: rgba(37, 99, 235, .08); }

.onsb-btn--ghost { background: transparent; color: var(--onsb-ink-soft); border-color: var(--onsb-border); }
.onsb-btn--ghost:hover { background: var(--onsb-surface-soft); }

.onsb-btn--danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.onsb-btn--danger:hover { background: #fee2e2; }

.onsb-btn--block { width: 100%; }
.onsb-cta { margin-top: 6px; }

.onsb-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 6px; }
.onsb-footer__spacer { flex: 1; }

/* Review */
.onsb-review__card {
        background: var(--onsb-surface-soft);
        border: 1px solid var(--onsb-border);
        border-radius: 12px;
        padding: 18px 20px;
}

.onsb-review__service { margin: 0 0 12px; font-size: 16px; }

.onsb-review__rows { display: flex; flex-direction: column; gap: 8px; }

.onsb-review__row {
        display: flex;
        justify-content: space-between;
        gap: 16px;
        font-size: 13.5px;
        padding-bottom: 8px;
        border-bottom: 1px dashed var(--onsb-border);
}

.onsb-review__row:last-child { border-bottom: none; padding-bottom: 0; }
.onsb-review__label { color: var(--onsb-muted); flex: 0 0 auto; }
.onsb-review__value { color: var(--onsb-ink); font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.onsb-policy { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--onsb-border); }
.onsb-policy__title { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--onsb-muted); }
.onsb-policy__text { margin: 0; font-size: 12.5px; color: var(--onsb-ink-soft); line-height: 1.6; }

/* Success */
.onsb-success { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 12px 0 4px; }

.onsb-success__icon {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background: linear-gradient(135deg, #22c55e, #16a34a);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        animation: onsb-pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
.onsb-success__icon svg { width: 30px; height: 30px; }
@keyframes onsb-pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.onsb-success__title { margin: 0; font-size: 21px; }
.onsb-success__text { margin: 0; color: var(--onsb-ink-soft); font-size: 14px; max-width: 420px; line-height: 1.6; }

.onsb-success__card {
        background: var(--onsb-surface-soft);
        border: 1px solid var(--onsb-border);
        border-radius: 12px;
        padding: 18px 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
        max-width: 460px;
        text-align: left;
}

.onsb-success__service { font-weight: 700; font-size: 15.5px; }
.onsb-success__when { display: flex; flex-direction: column; gap: 2px; }
.onsb-success__when strong { font-size: 14.5px; }
.onsb-success__when span { color: var(--onsb-muted); font-size: 13px; }
.onsb-success__ref { font-size: 12.5px; color: var(--onsb-ink-soft); letter-spacing: .02em; }

.onsb-link-btn {
        font-family: inherit;
        background: none;
        border: none;
        color: var(--onsb-brand);
        font-size: 13.5px;
        font-weight: 600;
        cursor: pointer;
        padding: 6px;
        text-decoration: underline;
}

/* Floating action button */
.onsb-fab {
        position: fixed;
        right: 20px;
        bottom: 20px;
        z-index: 99990;
        background: var(--onsb-brand, #2563eb);
        color: #fff;
        border: none;
        border-radius: 999px;
        padding: 13px 22px;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        font-size: 14.5px;
        font-weight: 700;
        box-shadow: 0 12px 30px -8px rgba(37, 99, 235, .55);
        cursor: pointer;
        transition: transform .18s ease, box-shadow .18s ease;
}

.onsb-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -8px rgba(37, 99, 235, .6); }

/* Modal */
.onsb-modal {
        position: fixed;
        inset: 0;
        z-index: 99999;
        background: rgba(15, 23, 42, .55);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px;
}

.onsb-modal[hidden] { display: none; }

.onsb-modal__dialog {
        position: relative;
        background: transparent;
        width: 100%;
        max-width: 780px;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        border-radius: 16px;
}

.onsb-modal__dialog .onsb-root { max-width: none; }

.onsb-modal__close {
        position: absolute;
        top: 12px;
        right: 14px;
        z-index: 2;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(15, 23, 42, .08);
        color: #0f172a;
        font-size: 20px;
        line-height: 1;
        cursor: pointer;
}
.onsb-modal__close:hover { background: rgba(15, 23, 42, .16); }

/* Manage app */
.onsb-manage { padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.onsb-manage__title { margin: 0; padding: 20px 24px 0; font-size: 19px; }
.onsb-manage__actions { display: flex; flex-direction: column; gap: 8px; }
.onsb-reschedule { border-top: 1px dashed var(--onsb-border); padding-top: 12px; }
.onsb-reschedule h3 { margin: 0 0 8px; font-size: 14.5px; }

/* Focus visibility for keyboard users */
.onsb-root :focus-visible { outline: 2px solid var(--onsb-brand); outline-offset: 2px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
        .onsb-skeleton__bar { animation: none; }
        .onsb-success__icon { animation: none; }
        .onsb-root *,
        .onsb-modal * { transition: none !important; }
}

/* Empty state (no active services yet) */
.onsb-empty {
        color: var(--onsb-muted);
        font-size: 14px;
        background: #f8fafc;
        border: 1px dashed #cbd5e1;
        border-radius: 10px;
        padding: 18px 16px;
        margin: 8px 0;
        text-align: center;
}
