/* CertFlow Booking Form — public stylesheet (cf-bf-* namespace) */

.cf-bf {
    /* Literal design tokens — aligned to the Militra / BoltPress design system.
       (Knob vars like --cf-bf-accent come from the per-form inline block.) */
    --cf-bf-ink: #0f172a;     /* headings */
    --cf-bf-border: #e2e8f0;  /* neutral-200 */
    --cf-bf-muted: #64748b;   /* neutral-500 */
    --cf-bf-faint: #94a3b8;   /* neutral-400 */
    --cf-bf-green: #16a34a;   /* success */

    background: var(--cf-bf-bg);
    color: #334155;
    padding: 24px;
    border-radius: var(--cf-bf-r-lg);
    font-family: 'DM Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- header / pills ---------- */
.cf-bf-header { margin-bottom: 22px; }
.cf-bf-title { margin: 0 0 8px; font-size: 30px; line-height: 1.18; font-weight: 800; color: var(--cf-bf-ink); letter-spacing: -0.01em; }
.cf-bf-title-accent { color: var(--cf-bf-accent); margin-left: 8px; }
.cf-bf-subtitle { margin: 0; color: var(--cf-bf-muted); font-size: 15px; }

.cf-bf-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.cf-bf .cf-bf-pill {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 16px; border-radius: 8px;
    border: 1px solid var(--cf-bf-border); background: #fff; cursor: pointer;
    font-size: 14px; font-weight: 600; color: #334155;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
.cf-bf-pill:hover { border-color: #cbd5e1; background: #f8fafc; }
.cf-bf-pill.is-active { background: var(--cf-bf-ink); color: #fff; border-color: var(--cf-bf-ink); }
.cf-bf-pill-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: #eef2f7; color: #64748b; font-size: 11px; font-weight: 700;
}
.cf-bf-pill.is-active .cf-bf-pill-count { background: rgba(255,255,255,0.2); color: #fff; }

/* ---------- city filter (custom dropdown) ---------- */
.cf-bf-city-filter { margin-top: 16px; }
.cf-bf-city { position: relative; display: inline-block; min-width: 210px; max-width: 100%; }
.cf-bf .cf-bf-city-toggle {
    display: flex; align-items: center; gap: 9px; width: 100%;
    margin: 0; padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--cf-bf-border); background: #fff; color: var(--cf-bf-ink);
    font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; text-align: left;
    box-shadow: none; transition: border-color .18s ease, box-shadow .18s ease;
}
.cf-bf-city-toggle:hover { border-color: #cbd5e1; }
.cf-bf-city.is-open .cf-bf-city-toggle,
.cf-bf-city-toggle:focus-visible { outline: none; border-color: var(--cf-bf-accent); box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06); }
.cf-bf-city-pin { width: 16px; height: 16px; flex: 0 0 auto; color: var(--cf-bf-accent); }
.cf-bf-city-current { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-bf-city-chevron { width: 16px; height: 16px; flex: 0 0 auto; color: var(--cf-bf-muted); transition: transform .18s ease; }
.cf-bf-city.is-open .cf-bf-city-chevron { transform: rotate(180deg); }

.cf-bf-city-menu {
    position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; right: 0;
    margin: 0; padding: 6px; list-style: none;
    background: #fff; border: 1px solid var(--cf-bf-border); border-radius: 12px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.14);
    max-height: 280px; overflow-y: auto;
}
.cf-bf-city:not(.is-open) .cf-bf-city-menu { display: none; }
.cf-bf-city-opt {
    padding: 9px 11px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #334155;
    cursor: pointer; transition: background-color .12s ease, color .12s ease;
}
.cf-bf-city-opt:hover { background: #f1f5f9; }
.cf-bf-city-opt:focus { outline: none; box-shadow: inset 0 0 0 2px var(--cf-bf-accent); }
.cf-bf-city-opt.is-selected { background: var(--cf-bf-ink); color: #fff; font-weight: 600; }

/* ---------- layout ---------- */
.cf-bf-body { display: grid; grid-template-columns: 360px 1fr; gap: 24px; align-items: start; }
.cf-bf-view-cards_only .cf-bf-body,
.cf-bf-view-single_training .cf-bf-body { grid-template-columns: 1fr; }

/* ---------- shared icon ---------- */
.cf-bf-ico { width: 1em; height: 1em; flex: 0 0 auto; vertical-align: -0.125em; }

/* Keyboard-focus ring only; no outline on mouse click. Also overrides any host-theme
   :focus styles that would otherwise leak into the form's <button> elements. */
.cf-bf button:focus { outline: none; }
.cf-bf button:focus-visible { outline: 2px solid var(--cf-bf-accent); outline-offset: 2px; }
.cf-bf .cf-bf-day:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--cf-bf-accent); }

/* ---------- calendar ---------- */
.cf-bf-cal-pane {
    background: var(--cf-bf-card-bg); border: 1px solid var(--cf-bf-border);
    border-radius: 16px; padding: 20px; align-self: start;
}
.cf-bf-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cf-bf-cal-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--cf-bf-ink); }
.cf-bf .cf-bf-cal-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 8px;
    border: 1px solid var(--cf-bf-border); background: #fff; color: #475569; cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.cf-bf-cal-nav:hover { background: #f8fafc; color: var(--cf-bf-ink); border-color: #cbd5e1; }
.cf-bf-cal-nav:active { transform: scale(.96); }
.cf-bf-cal-nav .cf-bf-ico { width: 18px; height: 18px; }

.cf-bf-cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
    font-size: 11px; font-weight: 600; color: var(--cf-bf-faint);
    text-transform: uppercase; letter-spacing: .03em;
}
.cf-bf-cal-weekday { text-align: center; padding: 6px 0; }

.cf-bf-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cf-bf .cf-bf-day {
    position: relative; aspect-ratio: 1 / 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: none; background: transparent; cursor: pointer;
    border-radius: 10px; font-size: 14px; color: #334155; padding: 2px;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.cf-bf-day-num { line-height: 1; font-weight: 500; }
.cf-bf-day:not(.is-empty):not(.is-selected):hover { background: #f1f5f9; }
.cf-bf-day.is-today { box-shadow: inset 0 0 0 1.5px var(--cf-bf-accent); }
.cf-bf-day.is-selected { background: var(--cf-bf-ink); color: #fff; }
.cf-bf-day.is-selected.is-today { box-shadow: inset 0 0 0 1.5px var(--cf-bf-accent); }
.cf-bf-day.is-empty { cursor: default; }
.cf-bf-day-dots { display: flex; gap: 3px; align-items: center; height: 5px; }
.cf-bf-day-dot { width: 5px; height: 5px; border-radius: 999px; background: #94a3b8; }
.cf-bf-day.is-selected .cf-bf-day-dot { background: rgba(255,255,255,0.92) !important; }
.cf-bf-day-overflow { font-size: 9px; line-height: 1; color: #64748b; }
.cf-bf-day.is-selected .cf-bf-day-overflow { color: rgba(255,255,255,0.85); }

.cf-bf-cal-legend {
    display: flex; flex-wrap: wrap; gap: 7px 16px;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--cf-bf-border);
}
.cf-bf-legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--cf-bf-muted); }
.cf-bf-legend-dot { width: 9px; height: 9px; border-radius: 999px; flex: 0 0 auto; }

/* ---------- list pane ---------- */
.cf-bf-list-pane { display: flex; flex-direction: column; gap: 14px; }

.cf-bf-list-header {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 2px 2px 8px; gap: 12px;
}
.cf-bf-list-header[hidden] { display: none; }
.cf-bf-list-date { font-size: 18px; font-weight: 700; color: var(--cf-bf-ink); }
.cf-bf-list-count { font-size: 13px; color: var(--cf-bf-muted); white-space: nowrap; }

.cf-bf-list-empty {
    padding: 40px 24px; text-align: center; color: var(--cf-bf-muted);
    background: var(--cf-bf-card-bg); border: 1px solid var(--cf-bf-border); border-radius: 14px;
}
.cf-bf-list-empty[hidden] { display: none; }

/* ---------- training card ---------- */
.cf-bf-card {
    background: var(--cf-bf-card-bg); padding: var(--cf-bf-density-pad);
    border: 1px solid var(--cf-bf-border); border-radius: 14px;
    display: flex; flex-direction: column; gap: 8px;
    transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
/* Reference (.post) card hover: lift + dark border + soft shadow. */
.cf-bf-card:hover {
    transform: translateY(-3px);
    border-color: var(--cf-bf-ink);
    box-shadow: 0 4px 12px rgba(15,23,42,0.08);
}
.cf-bf-card.is-full { opacity: 0.6; }
.cf-bf-card.is-full:hover { transform: none; border-color: var(--cf-bf-border); box-shadow: none; }
.cf-bf-card.is-hidden { display: none; }

.cf-bf-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cf-bf-card-badge {
    display: inline-flex; align-items: center;
    padding: 3px 9px; border-radius: 8px;
    font-size: 11px; font-weight: 700; letter-spacing: .03em;
    color: var(--cf-cat-color, #475569);
    background: #f1f5f9; /* fallback for browsers without color-mix */
    background: color-mix(in srgb, var(--cf-cat-color, #94a3b8) 14%, #fff);
}
.cf-bf-card-loc { display: inline-flex; align-items: center; gap: 5px; color: var(--cf-bf-muted); font-size: 13px; }
.cf-bf-card-loc .cf-bf-ico { width: 15px; height: 15px; }

.cf-bf-card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--cf-bf-ink); line-height: 1.3; }

.cf-bf-card-info { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.cf-bf-card-time { display: inline-flex; align-items: center; gap: 6px; color: var(--cf-bf-muted); }
.cf-bf-card-time .cf-bf-ico { width: 15px; height: 15px; }
.cf-bf-card-seats { color: var(--cf-bf-green); font-weight: 600; }

.cf-bf-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 2px; }
.cf-bf-card-price { font-size: 17px; font-weight: 700; color: var(--cf-bf-ink); }

/* ---------- course chooser (multi-product cards) ---------- */
.cf-bf-course-pick { display: flex; flex-direction: column; gap: 6px; }
.cf-bf-course-pick-label { font-size: 12px; font-weight: 600; color: var(--cf-bf-muted); }
.cf-bf-course-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-bf .cf-bf-course-pill {
    --cf-course-accent: var(--cf-bf-accent);
    display: inline-flex; align-items: center; margin: 0;
    padding: 5px 11px; border-radius: 8px; cursor: pointer;
    font-size: 12px; font-weight: 700; letter-spacing: .02em; line-height: 1.4;
    /* Fallbacks for browsers without color-mix() */
    border: 1px solid var(--cf-bf-border);
    background: #fff;
    color: #1f2937;
    border-color: color-mix(in srgb, var(--cf-course-accent) 40%, var(--cf-bf-border));
    background: color-mix(in srgb, var(--cf-course-accent) 8%, #fff);
    color: color-mix(in srgb, var(--cf-course-accent) 70%, #1f2937);
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.cf-bf-course-pill:hover { border-color: var(--cf-course-accent); }
.cf-bf-course-pill.is-active {
    background: var(--cf-course-accent);
    border-color: var(--cf-course-accent);
    color: #fff;
}
.cf-bf-course-pill:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-course-accent) 25%, transparent);
}
/* Matches the theme primary button: 8px radius, 15px/600, darken on hover (no lift/glow,
   no icon nudge), scale(.98) on press. Scoped `.cf-bf .cf-bf-*` so the host theme's global
   `button` / `button:hover` rules can't override the fill/border. */
.cf-bf .cf-bf-register {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 11px 20px; border-radius: 8px;
    background: var(--cf-bf-accent); color: #fff; border: 1px solid var(--cf-bf-accent); cursor: pointer;
    font-size: 15px; font-weight: 600;
    transition: background-color .18s ease, border-color .18s ease, transform .12s ease;
}
.cf-bf .cf-bf-register:hover:not(:disabled) {
    background: color-mix(in srgb, var(--cf-bf-accent) 86%, #000);
    border-color: color-mix(in srgb, var(--cf-bf-accent) 86%, #000);
}
.cf-bf .cf-bf-register:active:not(:disabled) { transform: scale(.98); }
.cf-bf .cf-bf-register:disabled { background: #cbd5e1; border-color: #cbd5e1; cursor: not-allowed; }
.cf-bf-register .cf-bf-ico-arrow { width: 15px; height: 15px; }

/* whole-form empty state (no trainings match locked filters at all) */
.cf-bf-empty {
    padding: 40px 24px; text-align: center; color: var(--cf-bf-muted);
    background: var(--cf-bf-card-bg); border: 1px solid var(--cf-bf-border); border-radius: 14px;
}

/* ---------- modal ---------- */
.cf-bf-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
}
.cf-bf-modal[hidden] { display: none; }
.cf-bf-modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,0.65); }
.cf-bf-modal-content {
    position: relative; background: #fff; border-radius: 14px;
    padding: 28px; max-width: 520px; width: calc(100% - 32px);
    max-height: 90vh; overflow-y: auto;
    box-shadow: 0 24px 60px rgba(15,23,42,0.28);
}
.cf-bf .cf-bf-modal-close {
    position: absolute; top: 8px; right: 8px;
    background: transparent; border: none; font-size: 28px; cursor: pointer; line-height: 1; padding: 4px 12px;
    color: #64748b; border-radius: 8px; transition: background-color .15s ease, color .15s ease;
}
.cf-bf-modal-close:hover { background: #f1f5f9; color: var(--cf-bf-ink); }
.cf-bf-modal-title { margin-top: 0; color: var(--cf-bf-ink); }
.cf-bf-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cf-bf-field-full { display: block; margin-top: 10px; }
.cf-bf-field-full[hidden] { display: none; }
.cf-bf-modal-form input,
.cf-bf-modal-form textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--cf-bf-border);
    border-radius: 8px; font-size: 15px; box-sizing: border-box;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.cf-bf-modal-form input:focus,
.cf-bf-modal-form textarea:focus {
    outline: none; border-color: var(--cf-bf-accent);
    box-shadow: 0 0 0 3px rgba(232,80,30,0.16); /* fallback */
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-bf-accent) 22%, transparent);
}
.cf-bf-modal-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.cf-bf .cf-bf-submit {
    background: var(--cf-bf-accent); color: #fff; border: 1px solid var(--cf-bf-accent);
    padding: 12px 22px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 15px;
    transition: background-color .18s ease, border-color .18s ease, transform .12s ease;
}
.cf-bf-submit:hover:not(:disabled) {
    background: color-mix(in srgb, var(--cf-bf-accent) 86%, #000);
    border-color: color-mix(in srgb, var(--cf-bf-accent) 86%, #000);
}
.cf-bf-submit:active:not(:disabled) { transform: scale(.98); }
.cf-bf-submit:disabled { opacity: .6; cursor: not-allowed; }
.cf-bf-modal-error { color: #b91c1c; margin-top: 12px; padding: 8px 12px; background: #fef2f2; border-radius: var(--cf-bf-r-sm); }
.cf-bf-modal-success h4 { color: #15803d; margin-top: 0; }

.cf-bf-calendar-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
/* Calendar-link buttons follow the reference secondary button. */
.cf-bf-cal-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 16px; border-radius: 8px;
    background: #fff; color: var(--cf-bf-ink); text-decoration: none;
    font-size: 14px; font-weight: 600; border: 1px solid var(--cf-bf-border);
    transition: background-color .18s ease, border-color .18s ease;
}
.cf-bf-cal-btn:hover { background: #f8fafc; border-color: #cbd5e1; }

/* ---------- animations ---------- */
@keyframes cf-bf-card-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
/* One-shot class added by JS only to cards newly entering the visible set, so cards
   already on screen never re-flash on filter/day clicks. `backwards` fill shows the
   pre-animation state during the stagger delay WITHOUT pinning the end transform —
   otherwise the entered card couldn't lift on :hover. */
.cf-bf-card.is-entering { animation: cf-bf-card-in .3s ease backwards; }

@keyframes cf-bf-grid-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.cf-bf-cal-grid { animation: cf-bf-grid-in .25s ease; }

@keyframes cf-bf-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes cf-bf-backdrop-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes cf-bf-pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes cf-bf-pop-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(.98); } }

/* Exclude the closing state so exactly one animation matches during close,
   regardless of source order. */
.cf-bf-modal:not([hidden]):not(.is-closing) .cf-bf-modal-backdrop { animation: cf-bf-backdrop-in .2s ease; }
.cf-bf-modal:not([hidden]):not(.is-closing) .cf-bf-modal-content { animation: cf-bf-pop-in .26s cubic-bezier(.16,1,.3,1); }
.cf-bf-modal.is-closing .cf-bf-modal-backdrop { animation: cf-bf-backdrop-out .18s ease forwards; }
.cf-bf-modal.is-closing .cf-bf-modal-content { animation: cf-bf-pop-out .18s ease forwards; }

@media (prefers-reduced-motion: reduce) {
    .cf-bf-card.is-entering,
    .cf-bf-cal-grid,
    .cf-bf-modal:not([hidden]) .cf-bf-modal-backdrop,
    .cf-bf-modal:not([hidden]) .cf-bf-modal-content,
    .cf-bf-modal.is-closing .cf-bf-modal-backdrop,
    .cf-bf-modal.is-closing .cf-bf-modal-content { animation: none !important; }
    .cf-bf-day, .cf-bf-pill, .cf-bf-course-pill, .cf-bf-register, .cf-bf-submit, .cf-bf-cal-nav,
    .cf-bf-card, .cf-bf-register .cf-bf-ico-arrow, .cf-bf-modal-form input,
    .cf-bf-modal-form textarea, .cf-bf-cal-btn, .cf-bf-modal-close { transition: none !important; }
    /* No positional shift on hover/press for reduced-motion users. */
    .cf-bf-card:hover, .cf-bf-register:hover:not(:disabled) .cf-bf-ico-arrow,
    .cf-bf-register:active, .cf-bf-submit:active, .cf-bf-cal-nav:active { transform: none !important; }
}

/* ---------- mobile ---------- */
@media (max-width: 880px) {
    .cf-bf-body { grid-template-columns: 1fr; }
    .cf-bf[data-design*='"mobile_mode":"drawer"'] .cf-bf-cal-pane { display: none; }
}
@media (max-width: 480px) {
    .cf-bf { padding: 16px; }
    .cf-bf-title { font-size: 24px; }
    .cf-bf-card-foot { flex-direction: column; align-items: stretch; gap: 10px; }
    .cf-bf-register { justify-content: center; }
    .cf-bf-field-row { grid-template-columns: 1fr; }
}
