/* ==========================================================================
   FormPilot 11.5 — Booking UI
   Shared by the Smart Booking form [smart_schedule_booking] and the public
   event scheduler [formpilot_event]. Everything is scoped to .fpb so theme
   styles cannot leak in and these styles cannot leak out.

   Tokens (override per instance via inline style on .fpb):
     --fpb-accent       brand colour for selection, buttons, focus
     --fpb-accent-ink   text colour placed on the accent
     --fpb-side         background of the event/ticket panel
     --fpb-side-bg      optional gradient for the panel (Smart Booking form)
   ========================================================================== */

.fpb {
    --fpb-accent: #3b4bdb;
    --fpb-accent-ink: #ffffff;
    --fpb-accent-soft: color-mix(in srgb, var(--fpb-accent) 9%, #ffffff);
    --fpb-accent-line: color-mix(in srgb, var(--fpb-accent) 32%, #ffffff);
    --fpb-ink: #141b2d;
    --fpb-ink-2: #3a4256;
    --fpb-muted: #687087;
    --fpb-line: #e3e6ee;
    --fpb-line-2: #eef0f5;
    --fpb-side: #f5f6f9;
    --fpb-surface: #ffffff;
    --fpb-beacon: #f4b740;
    --fpb-danger: #c8372d;
    --fpb-danger-soft: #fdf1f0;
    --fpb-success: #0f8a5f;
    --fpb-radius: 16px;
    --fpb-radius-sm: 10px;
    --fpb-font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

    font-family: var(--fpb-font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--fpb-ink);
    width: 100%;
    max-width: 1080px;
    margin: 32px auto;
    -webkit-font-smoothing: antialiased;
    text-align: left;
}
@supports not (color: color-mix(in srgb, red 10%, white)) {
    .fpb { --fpb-accent-soft: #eef0fd; --fpb-accent-line: #c3c9f5; }
}
.fpb *, .fpb *::before, .fpb *::after { box-sizing: border-box; }
.fpb h2, .fpb h3, .fpb p, .fpb ul, .fpb dl, .fpb dd { margin: 0; padding: 0; }
.fpb ul { list-style: none; }
.fpb [hidden] { display: none !important; }

/* Reset theme button styling inside the widget */
.fpb button {
    -webkit-appearance: none; appearance: none;
    font: inherit; color: inherit; letter-spacing: normal; text-transform: none;
    background: none; border: 0; box-shadow: none; margin: 0; padding: 0;
    line-height: inherit; cursor: pointer; text-decoration: none;
}
.fpb button:disabled { cursor: not-allowed; }
.fpb :focus-visible { outline: 2px solid var(--fpb-accent); outline-offset: 2px; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.fpb-shell {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    background: var(--fpb-surface);
    border: 1px solid var(--fpb-line);
    border-radius: 22px;
    box-shadow: 0 1px 2px rgba(20, 27, 45, .04), 0 24px 60px -32px rgba(20, 27, 45, .28);
    overflow: hidden;
    min-height: 600px;
}

/* ── Side panel: event facts + ticket ──────────────────────────────────── */
.fpb-side {
    background: var(--fpb-side-bg, var(--fpb-side));
    border-right: 1px solid var(--fpb-line);
    padding: 32px 28px 28px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.fpb-brand { display: flex; align-items: center; gap: 12px; }
.fpb-mark {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--fpb-ink); color: #fff;
    font-weight: 700; font-size: 17px;
}
.fpb-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; background: #fff; }
.fpb-brand-name { font-size: 13px; font-weight: 600; color: var(--fpb-muted); }
.fpb-title {
    font-size: 25px; line-height: 1.18; font-weight: 600;
    letter-spacing: -0.02em; color: var(--fpb-ink);
    text-wrap: balance;
}
.fpb-facts { display: grid; gap: 10px; }
.fpb-facts li {
    display: flex; align-items: center; gap: 10px;
    font-size: 14px; font-weight: 500; color: var(--fpb-ink-2);
}
.fpb-facts svg { width: 18px; height: 18px; flex: none; color: var(--fpb-muted); }
.fpb-desc { font-size: 14px; line-height: 1.65; color: var(--fpb-muted); max-width: 34ch; }
.fpb-desc p + p { margin-top: .7em; }

/* Ticket — the booking summary fills in as the visitor chooses */
.fpb-ticket {
    --notch: 11px;
    position: relative;
    margin-top: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    background: var(--fpb-surface);
    border: 1px solid var(--fpb-line);
    border-radius: 14px;
    filter: drop-shadow(0 10px 18px rgba(20, 27, 45, .07));
}
.fpb-ticket::before, .fpb-ticket::after {
    content: ""; position: absolute; right: calc(86px - var(--notch));
    width: calc(var(--notch) * 2); height: calc(var(--notch) * 2);
    border-radius: 50%; background: var(--fpb-side);
    border: 1px solid var(--fpb-line);
}
.fpb-ticket::before { top: calc(var(--notch) * -1); clip-path: inset(50% 0 0 0); }
.fpb-ticket::after  { bottom: calc(var(--notch) * -1); clip-path: inset(0 0 50% 0); }
.fpb-ticket-main { padding: 16px 16px 14px; display: grid; gap: 10px; min-width: 0; }
.fpb-ticket-row { display: grid; gap: 1px; min-width: 0; }
.fpb-ticket-row span { font-size: 11.5px; font-weight: 500; color: var(--fpb-muted); }
.fpb-ticket-row strong {
    font-size: 14px; font-weight: 600; color: var(--fpb-ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}
.fpb-ticket-row strong.is-empty { color: #b3b8c6; font-weight: 500; }
.fpb-ticket-stub {
    border-left: 2px dashed var(--fpb-line);
    padding: 16px 10px; display: flex; flex-direction: column;
    justify-content: center; align-items: center; text-align: center; gap: 2px;
}
.fpb-ticket-stub span { font-size: 11.5px; color: var(--fpb-muted); }
.fpb-ticket-stub strong { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.fpb-ticket-stub small { font-size: 11.5px; color: var(--fpb-muted); }
.fpb-stamp {
    position: absolute; right: 4px; top: 50%; width: 78px; text-align: center;
    transform: translateY(-50%) rotate(-12deg) scale(1.6);
    padding: 4px 0; border: 2px solid var(--fpb-success); border-radius: 7px;
    color: var(--fpb-success); font-weight: 700; font-size: 12px; letter-spacing: .01em;
    background: var(--fpb-surface);
    opacity: 0; pointer-events: none;
}
.fpb.is-done .fpb-ticket-stub > * { opacity: 0; transition: opacity .2s; }
.fpb.is-done .fpb-stamp { animation: fpb-stamp .42s cubic-bezier(.2, .9, .3, 1.25) .15s forwards; }
@keyframes fpb-stamp {
    to { opacity: 1; transform: translateY(-50%) rotate(-12deg) scale(1); }
}

/* ── Main panel / steps ────────────────────────────────────────────────── */
.fpb-main { padding: 32px 36px 36px; min-width: 0; position: relative; }
.fpb-step { display: none; }
.fpb-step.is-active { display: block; animation: fpb-in .22s ease-out; }
@keyframes fpb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.fpb-step-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.fpb-h { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
.fpb-sub { font-size: 14px; color: var(--fpb-muted); margin-top: 4px !important; max-width: 60ch; }

/* Time zone control */
.fpb-tz { display: grid; gap: 4px; min-width: 230px; }
.fpb-tz label { font-size: 12px; font-weight: 500; color: var(--fpb-muted); }
.fpb-select, .fpb-input, .fpb-textarea {
    width: 100%; font: inherit; font-size: 15px; color: var(--fpb-ink);
    background: var(--fpb-surface); border: 1px solid var(--fpb-line);
    border-radius: var(--fpb-radius-sm); padding: 11px 13px; min-height: 46px;
    box-shadow: 0 1px 1px rgba(20,27,45,.03); transition: border-color .15s, box-shadow .15s;
    margin: 0;
}
.fpb-select {
    -webkit-appearance: none; appearance: none; padding-right: 38px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23687087' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.fpb-tz .fpb-select { min-height: 40px; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
.fpb-textarea { min-height: 104px; resize: vertical; line-height: 1.5; }
.fpb-input::placeholder, .fpb-textarea::placeholder { color: #a3a9b8; }
.fpb-select:hover, .fpb-input:hover, .fpb-textarea:hover { border-color: #ccd1dd; }
.fpb-select:focus, .fpb-input:focus, .fpb-textarea:focus {
    outline: none; border-color: var(--fpb-accent);
    box-shadow: 0 0 0 4px var(--fpb-accent-soft);
}
.fpb-input.is-invalid, .fpb-textarea.is-invalid, .fpb-select.is-invalid { border-color: var(--fpb-danger); box-shadow: 0 0 0 4px var(--fpb-danger-soft); }

/* Picker: calendar + slot column */
.fpb-picker { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.fpb-picker.has-day { grid-template-columns: minmax(0, 1fr) 220px; }

.fpb-cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.fpb-month { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.fpb-nav-btns { display: flex; gap: 6px; }
.fpb-nav {
    width: 36px; height: 36px; border-radius: 10px !important;
    display: grid; place-items: center; color: var(--fpb-ink-2) !important;
    border: 1px solid var(--fpb-line) !important; background: var(--fpb-surface) !important;
    transition: background .15s, border-color .15s;
}
.fpb-nav:hover:not(:disabled) { background: var(--fpb-side) !important; border-color: #ccd1dd !important; }
.fpb-nav:disabled { opacity: .35; }
.fpb-nav svg { width: 16px; height: 16px; }

.fpb-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.fpb-wd { font-size: 12px; font-weight: 500; color: var(--fpb-muted); text-align: center; padding-bottom: 6px; }
.fpb-day {
    position: relative; aspect-ratio: 1 / 1; max-height: 58px; width: 100%;
    border-radius: 12px !important; display: grid; place-items: center;
    font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums;
    color: #b3b8c6 !important; background: transparent !important;
}
.fpb-day.is-open {
    color: var(--fpb-accent) !important; background: var(--fpb-accent-soft) !important; font-weight: 600;
    transition: background .14s, color .14s, transform .14s;
}
.fpb-day.is-open:hover { background: color-mix(in srgb, var(--fpb-accent) 16%, #fff) !important; }
.fpb-day.is-selected, .fpb-day.is-selected:hover { background: var(--fpb-accent) !important; color: var(--fpb-accent-ink) !important; }
.fpb-day.is-today::after {
    content: ""; position: absolute; bottom: 7px; left: 50%; width: 5px; height: 5px;
    margin-left: -2.5px; border-radius: 50%; background: var(--fpb-beacon);
}
.fpb-cal-legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--fpb-muted); }
.fpb-cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.fpb-cal-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--fpb-accent-soft); border: 1px solid var(--fpb-accent-line); }
.fpb-cal-legend i.today { border-radius: 50%; background: var(--fpb-beacon); border: 0; width: 6px; height: 6px; }

.fpb-slots { display: flex; flex-direction: column; min-height: 0; }
.fpb-slots-head { font-size: 15px; font-weight: 600; margin-bottom: 14px; min-height: 36px; display: flex; align-items: center; }
.fpb-slot-list {
    display: grid; gap: 8px; max-height: 392px; overflow-y: auto;
    padding: 2px 6px 2px 2px; overscroll-behavior: contain; scrollbar-width: thin;
}
.fpb-slot {
    width: 100% !important; min-height: 46px; padding: 0 12px !important;
    border: 1px solid var(--fpb-accent-line) !important; border-radius: 10px !important;
    color: var(--fpb-accent) !important; font-weight: 600; font-size: 15px;
    background: var(--fpb-surface) !important; font-variant-numeric: tabular-nums;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: border-color .14s, background .14s, color .14s;
}
.fpb-slot:hover:not(:disabled) { border-color: var(--fpb-accent) !important; background: var(--fpb-accent-soft) !important; }
.fpb-slot.is-selected { background: var(--fpb-accent) !important; color: var(--fpb-accent-ink) !important; border-color: var(--fpb-accent) !important; }
.fpb-slot:disabled { color: #b3b8c6 !important; border-color: var(--fpb-line-2) !important; background: var(--fpb-side) !important; font-weight: 500; }
.fpb-slot small { font-size: 11.5px; font-weight: 500; opacity: .8; }
.fpb-slots-empty { font-size: 14px; color: var(--fpb-muted); padding: 14px; border: 1px dashed var(--fpb-line); border-radius: 12px; text-align: center; }

.fpb-skeleton { height: 46px; border-radius: 10px; background: linear-gradient(90deg, var(--fpb-line-2), #f7f8fb, var(--fpb-line-2)); background-size: 200% 100%; animation: fpb-shimmer 1.1s linear infinite; }
@keyframes fpb-shimmer { to { background-position: -200% 0; } }

/* ── Details step ──────────────────────────────────────────────────────── */
.fpb-back {
    display: inline-flex !important; align-items: center; gap: 6px;
    font-size: 14px; font-weight: 500; color: var(--fpb-muted) !important;
    margin-bottom: 18px !important; padding: 6px 10px 6px 6px !important; border-radius: 8px !important;
}
.fpb-back:hover { color: var(--fpb-ink) !important; background: var(--fpb-side) !important; }
.fpb-back svg { width: 16px; height: 16px; }

.fpb-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 16px; margin: 24px 0; }
.fpb-field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.fpb-field.is-full { grid-column: 1 / -1; }
.fpb-label { font-size: 13.5px; font-weight: 600; color: var(--fpb-ink-2); }
.fpb-req { color: var(--fpb-danger); margin-left: 2px; }
.fpb-field-err { font-size: 12.5px; color: var(--fpb-danger); min-height: 0; }

.fpb-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.fpb-choice { position: relative; display: inline-flex; cursor: pointer; }
.fpb-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.fpb-choice span {
    display: inline-flex; align-items: center; gap: 8px; min-height: 42px;
    padding: 8px 14px; border: 1px solid var(--fpb-line); border-radius: 999px;
    font-size: 14px; font-weight: 500; color: var(--fpb-ink-2); background: var(--fpb-surface);
    transition: border-color .14s, background .14s, color .14s;
}
.fpb-choice span::before {
    content: ""; width: 14px; height: 14px; border-radius: 50%;
    border: 1.5px solid #c3c8d4; background: #fff; flex: none; transition: .14s;
}
.fpb-choice:hover span { border-color: #ccd1dd; }
.fpb-choice input:checked + span { border-color: var(--fpb-accent); background: var(--fpb-accent-soft); color: var(--fpb-ink); }
.fpb-choice input:checked + span::before { border: 4px solid var(--fpb-accent); }
.fpb-choice input:focus-visible + span { outline: 2px solid var(--fpb-accent); outline-offset: 2px; }

.fpb-pay {
    border: 1px solid var(--fpb-line); border-radius: 14px; padding: 18px;
    background: var(--fpb-side); margin: 4px 0 22px;
}
.fpb-pay-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.fpb-pay-head strong { font-size: 14px; font-weight: 600; }
.fpb-pay-head span { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.fpb-card {
    background: var(--fpb-surface); border: 1px solid var(--fpb-line); border-radius: var(--fpb-radius-sm);
    padding: 13px 13px; min-height: 46px;
}
.fpb-card.StripeElement--focus { border-color: var(--fpb-accent); box-shadow: 0 0 0 4px var(--fpb-accent-soft); }
.fpb-pay-note { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fpb-muted); margin-top: 10px !important; }
.fpb-pay-note svg { width: 14px; height: 14px; }

.fpb-alert {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 12px 14px; border-radius: 12px; font-size: 14px; line-height: 1.45;
    background: var(--fpb-danger-soft); color: #8f251d; border: 1px solid #f4cdc9; margin-bottom: 16px;
}
.fpb-alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

.fpb-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.fpb-btn {
    display: inline-flex !important; align-items: center; justify-content: center; gap: 10px;
    min-height: 50px; padding: 0 26px !important; border-radius: var(--fpb-btn-radius, 12px) !important;
    background: var(--fpb-accent) !important; color: var(--fpb-accent-ink) !important; text-decoration: none !important;
    font-size: 15.5px; font-weight: 600; letter-spacing: -0.005em;
    box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 8px 18px -10px var(--fpb-accent) !important;
    transition: transform .12s, filter .15s;
}
.fpb-btn:hover:not(:disabled) { filter: brightness(1.07); }
.fpb-btn:active:not(:disabled) { transform: translateY(1px); }
.fpb-btn:disabled { opacity: .65; }
.fpb-btn-ghost {
    display: inline-flex !important; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px !important;
    border-radius: 12px !important; border: 1px solid var(--fpb-line) !important; background: var(--fpb-surface) !important;
    font-weight: 600; font-size: 14.5px; color: var(--fpb-ink) !important; text-decoration: none !important;
}
.fpb-btn-ghost:hover { border-color: #ccd1dd !important; background: var(--fpb-side) !important; }
.fpb-btn svg, .fpb-btn-ghost svg { width: 18px; height: 18px; }
.fpb-spin {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.4); border-top-color: currentColor;
    animation: fpb-rot .7s linear infinite;
}
@keyframes fpb-rot { to { transform: rotate(360deg); } }
.fpb-fine { font-size: 12.5px; color: var(--fpb-muted); }

/* ── Done step ─────────────────────────────────────────────────────────── */
.fpb-done { max-width: 520px; padding-top: 18px; }
.fpb-done-icon {
    width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center;
    background: #e7f6ef; color: var(--fpb-success); margin-bottom: 20px;
}
.fpb-done-icon svg { width: 26px; height: 26px; }
.fpb-done .fpb-h { font-size: 26px; }
.fpb-done .fpb-sub { font-size: 15px; margin-top: 8px !important; }
.fpb-done-when {
    margin: 22px 0 !important; padding: 16px 18px; border-radius: 14px;
    border: 1px solid var(--fpb-line); background: var(--fpb-side);
    display: grid; gap: 2px;
}
.fpb-done-when strong { font-size: 16px; font-weight: 600; }
.fpb-done-when span { font-size: 13.5px; color: var(--fpb-muted); }
.fpb-done .fpb-actions { margin-top: 6px; }

.fpb-notice { padding: 16px 18px; border-radius: 12px; border: 1px solid var(--fpb-line); background: var(--fpb-side); color: var(--fpb-ink-2); font-size: 14px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 920px) {
    .fpb-shell { grid-template-columns: 1fr; }
    .fpb-side { border-right: 0; border-bottom: 1px solid var(--fpb-line); padding: 24px 22px; gap: 16px; }
    .fpb-desc { max-width: none; }
    .fpb-ticket { margin-top: 4px; }
    .fpb-main { padding: 24px 22px 28px; }
}
@media (max-width: 640px) {
    .fpb { margin: 16px auto; font-size: 15px; }
    .fpb-shell { border-radius: 18px; }
    .fpb-picker.has-day { grid-template-columns: 1fr; }
    .fpb-slot-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
    .fpb-fields { grid-template-columns: 1fr; }
    .fpb-tz { min-width: 0; width: 100%; }
    .fpb-title { font-size: 22px; }
    .fpb-day { border-radius: 10px !important; font-size: 14px; }
    .fpb-cal-grid { gap: 4px; }
    .fpb-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .fpb *, .fpb *::before, .fpb *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
    .fpb.is-done .fpb-stamp { opacity: 1; transform: translateY(-50%) rotate(-12deg) scale(1); }
}
