/* ============================================================
   Supersei — demo booking widget
   UX replicated from the InterviewLift DemoBookingWidget
   (4-step flow, date strip, slot grid, inline confirm panel,
   success screen). Branding is Supersei's own: emerald accent
   on the surface tokens already defined in style.css
   (--ink-*, --em-*, --tx-*, --line-*). IL's purple/ember
   accents intentionally NOT carried over.

   Everything here is token-driven rather than hard-coded, so
   the widget follows the site's light/dark toggle without a
   second set of rules. The only literal colours are the
   emerald gradient, the amber urgency cue and the red error
   tints, all of which hold up on both surfaces.
   ============================================================ */

.bk-wrap {
  max-width: 720px;
  margin: 0 auto;
}

.bk-card {
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 20px;
  /* Light default; the dark theme gets the deeper lift it needs below. */
  box-shadow: 0 18px 44px rgba(11, 20, 36, 0.08);
}

:root[data-theme="dark"] .bk-card {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

@media (min-width: 640px) {
  .bk-card { padding: 24px; }
}

/* ── section headings ─────────────────────────────────────── */

.bk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.bk-card .bk-h4,
.bk-h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--tx-1);
}

@media (min-width: 640px) {
  .bk-card .bk-h4, .bk-h4 { font-size: 16px; }
}

.bk-h4 svg { width: 16px; height: 16px; color: var(--em-2); flex: none; }
.bk-h4 .bk-tz { font-size: 12px; font-weight: 400; color: var(--tx-3); }

/* ── date strip ───────────────────────────────────────────── */

.bk-pager { display: flex; align-items: center; gap: 4px; }

.bk-pager button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--tx-2);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}

.bk-pager button:hover:not(:disabled) { background: var(--ink-3); border-color: var(--line-2); }
.bk-pager button:disabled { opacity: .3; cursor: not-allowed; }
.bk-pager svg { width: 16px; height: 16px; }

.bk-dates {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.bk-section { margin-bottom: 24px; }
.bk-section--times { margin-bottom: 16px; }

/* Keep the 7-across strip (same as the reference) but claw back enough
   width on small phones for a 44px tap target. */
@media (max-width: 420px) {
  .bk-card { padding: 14px; }
  .bk-dates { gap: 5px; }
  .bk-chip { padding-left: 2px; padding-right: 2px; }
}

/* ── chips: shared by date strip and slot grid ────────────────
   One class per state. The date chip and the slot chip get the
   same selected treatment so a user reads them as the same kind
   of control — same rule InterviewLift follows.  */

.bk-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 4px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--ink-1);
  color: var(--tx-1);
  text-align: center;
  cursor: pointer;
  font: inherit;
  /* background-color is deliberately NOT transitioned. The site's theme
     toggle swaps --ink-* live, and a chip with a background transition kept
     painting the previous theme's colour until the next reload (dark chip +
     dark text in light mode). Border/transform/shadow still animate, so the
     hover feel is unchanged. */
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.bk-chip:hover:not(:disabled) {
  border-color: rgba(52, 211, 153, .45);
  transform: translateY(-1px);
}

.bk-chip:focus-visible {
  outline: 2px solid var(--em-2);
  outline-offset: 2px;
}

.bk-chip-sub {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--tx-3);
}

.bk-chip-day { font-size: 18px; font-weight: 900; line-height: 1.1; }
.bk-chip-mon { font-size: 10px; font-weight: 600; color: var(--tx-3); text-transform: none; letter-spacing: 0; }

.bk-today-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  background: var(--em-2);
  margin-top: 4px;
}

/* selected */
.bk-chip.is-selected {
  background: linear-gradient(135deg, var(--em-1), var(--em-2));
  border-color: transparent;
  color: #04140E;
  box-shadow: 0 10px 24px -8px rgba(5, 150, 105, .55);
}
.bk-chip.is-selected .bk-chip-sub,
.bk-chip.is-selected .bk-chip-mon { color: rgba(4, 20, 14, .72); }
.bk-chip.is-selected .bk-today-dot { background: rgba(4, 20, 14, .8); }

/* last seat — urgency cue */
.bk-chip.is-low { border-color: rgba(245, 158, 11, .55); }
.bk-chip.is-low:hover:not(:disabled) { border-color: #f59e0b; }
.bk-chip.is-low .bk-seats { color: #b45309; }

/* full / unavailable */
.bk-chip.is-full {
  background: var(--ink-1);
  color: var(--tx-3);
  border-color: var(--line-1);
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}
.bk-chip.is-full:hover { transform: none; border-color: var(--line-1); }

/* ── slot grid ────────────────────────────────────────────── */

.bk-slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}

@media (min-width: 640px) {
  .bk-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.bk-slots::-webkit-scrollbar { width: 6px; }
.bk-slots::-webkit-scrollbar-thumb { background: var(--line-3); border-radius: 999px; }

.bk-slot { padding: 10px 12px; font-size: 14px; font-weight: 700; }
.bk-seats {
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--em-2);
}
.bk-chip.is-selected .bk-seats { color: rgba(4, 20, 14, .78); }
.bk-chip.is-full .bk-seats { color: var(--tx-3); }

/* ── status panels: loading / empty / error ───────────────── */

.bk-state {
  padding: 32px 16px;
  text-align: center;
  border-radius: 16px;
  border: 1px solid var(--line-1);
  background: var(--ink-1);
}

.bk-state svg { width: 32px; height: 32px; margin: 0 auto 8px; display: block; color: var(--tx-3); }
.bk-state-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--tx-2); }
.bk-state-sub { margin: 4px 0 0; font-size: 12px; color: var(--tx-3); }

.bk-state--error { border-color: rgba(185, 28, 28, .22); background: rgba(185, 28, 28, .05); }
.bk-state--error svg { color: #dc2626; }
.bk-state--error .bk-state-title { color: #b91c1c; }

.bk-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tx-3);
}

.bk-spin { animation: bk-spin 1s linear infinite; width: 24px; height: 24px; color: var(--em-2); }
@keyframes bk-spin { to { transform: rotate(360deg); } }

.bk-retry {
  margin-top: 12px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  color: #b91c1c;
  background: transparent;
  border: 1px solid rgba(185, 28, 28, .3);
  transition: background-color .15s ease;
}
.bk-retry:hover { background: rgba(185, 28, 28, .08); }

/* ── confirm panel ────────────────────────────────────────── */

.bk-confirm {
  margin-top: 24px;
  padding: 20px;
  border-radius: 16px;
  background: var(--ink-1);
  border: 1px solid var(--line-2);
  animation: bk-rise .28s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes bk-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.bk-slot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  margin-bottom: 16px;
}

.bk-slot-icon {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 211, 153, .12);
  border: 1px solid rgba(52, 211, 153, .22);
  color: var(--em-2);
}
.bk-slot-icon svg { width: 20px; height: 20px; }

.bk-slot-when { margin: 0; font-size: 14px; font-weight: 700; color: var(--tx-1); }
.bk-slot-meta { margin: 2px 0 0; font-size: 12px; font-weight: 600; color: var(--tx-3); }

/* ── form ─────────────────────────────────────────────────── */

.bk-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }

.bk-field { position: relative; }

.bk-field > svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--tx-3);
  pointer-events: none;
}

.bk-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--ink-2);
  color: var(--tx-1);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.bk-input::placeholder { color: var(--tx-3); font-weight: 500; }

.bk-input:focus {
  outline: none;
  border-color: var(--em-2);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .18);
}

.bk-input.bk-select { padding-left: 12px; }
.bk-input.bk-select option { background: var(--ink-2); color: var(--tx-1); }

.bk-phone-row { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 640px) {
  .bk-phone-row { flex-direction: row; }
  .bk-phone-row .bk-select { width: 176px; flex: none; }
  .bk-phone-row .bk-field { flex: 1; min-width: 0; }
}

.bk-err {
  margin: -8px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: #b91c1c;
}

.bk-banner {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(185, 28, 28, .25);
  background: rgba(185, 28, 28, .06);
  color: #b91c1c;
}
.bk-banner.is-warning {
  border-color: rgba(180, 83, 9, .3);
  background: rgba(180, 83, 9, .07);
  color: #b45309;
}

/* ── buttons ──────────────────────────────────────────────── */

.bk-actions { display: flex; gap: 12px; }

.bk-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s ease, background-color .15s ease,
              border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.bk-btn svg { width: 16px; height: 16px; flex: none; }

.bk-btn-ghost {
  background: var(--ink-2);
  color: var(--tx-1);
  border: 1px solid var(--line-2);
}
.bk-btn-ghost:hover { border-color: var(--line-3); background: var(--ink-3); }

.bk-btn-primary {
  background: linear-gradient(135deg, var(--em-1), var(--em-2));
  color: #04140E;
  border: none;
  box-shadow: 0 12px 28px -10px rgba(5, 150, 105, .6);
}
.bk-btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.bk-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ── success screen ───────────────────────────────────────── */

.bk-success {
  padding: 24px;
  text-align: center;
  animation: bk-rise .32s cubic-bezier(.16, 1, .3, 1) both;
}

@media (min-width: 640px) { .bk-success { padding: 32px; } }

.bk-success-ring {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(52, 211, 153, .14);
  border: 1px solid rgba(52, 211, 153, .3);
  color: var(--em-2);
  animation: bk-pop .4s cubic-bezier(.34, 1.56, .64, 1) both;
}
.bk-success-ring svg { width: 32px; height: 32px; }

@keyframes bk-pop {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: none; }
}

.bk-card .bk-success h2,
.bk-success h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  color: var(--tx-1);
}
@media (min-width: 640px) { .bk-card .bk-success h2,
.bk-success h2 { font-size: 30px; } }

.bk-success-lede {
  margin: 0 auto 24px;
  max-width: 28rem;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--tx-2);
}
.bk-success-lede strong { color: var(--tx-1); font-weight: 700; }

@media (min-width: 640px) { .bk-success-lede { font-size: 16px; } }

.bk-success-card {
  max-width: 24rem;
  margin: 0 auto 24px;
  padding: 20px;
  border-radius: 16px;
  text-align: left;
  background: var(--ink-1);
  border: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bk-success-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tx-1);
}
.bk-success-row svg { width: 16px; height: 16px; flex: none; color: var(--em-2); }

.bk-meet-link {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--em-2);
  text-decoration: none;
}
.bk-meet-link:hover { text-decoration: underline; }
/* Both icons need an explicit size. The success-row rule doesn't reach here
   (this link is a sibling of those rows, not a child), so without this the
   inline SVG has no intrinsic size and stretches to fill the card. */
.bk-meet-link svg { width: 16px; height: 16px; flex: none; }
.bk-meet-link .bk-ext { width: 12px; height: 12px; }
.bk-meet-link span:not(.bk-sr-only) { white-space: nowrap; }

.bk-success-note {
  margin: 0 0 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--tx-3);
}

@media (min-width: 640px) { .bk-success-note { font-size: 14px; } }

.bk-success .bk-btn { flex: none; padding-left: 24px; padding-right: 24px; }
.bk-success .bk-actions { justify-content: center; }

/* ── skeleton (first paint) ───────────────────────────────── */

.bk-skeleton { display: grid; gap: 8px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bk-skeleton div {
  height: 72px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--ink-1) 25%, var(--ink-3) 50%, var(--ink-1) 75%);
  background-size: 200% 100%;
  animation: bk-shimmer 1.4s ease-in-out infinite;
}
@keyframes bk-shimmer { to { background-position: -200% 0; } }

/* ── reduced motion ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .bk-chip, .bk-btn, .bk-confirm, .bk-success, .bk-success-ring, .bk-skeleton div {
    animation: none !important;
    transition: none !important;
  }
  .bk-chip:hover:not(:disabled), .bk-btn-primary:hover:not(:disabled) { transform: none; }
  .bk-spin { animation-duration: 2s; }
}

/* ── accessibility ────────────────────────────────────────── */

.bk-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;
}

.bk-pager button:focus-visible,
.bk-btn:focus-visible,
.bk-retry:focus-visible,
.bk-meet-link:focus-visible,
.bk-input:focus-visible {
  outline: 2px solid var(--em-2);
  outline-offset: 2px;
}

/* The success heading is focused programmatically — don't draw a ring
   around a whole line of display text for a move the user didn't make. */
.bk-success h2:focus { outline: none; }
.bk-success h2:focus-visible { outline: 2px solid var(--em-2); outline-offset: 4px; }

/* Windows high-contrast: borders are dropped, so keep a visible edge. */
@media (forced-colors: active) {
  .bk-chip, .bk-btn, .bk-input { border: 1px solid ButtonText; }
  .bk-chip.is-selected { border: 2px solid Highlight; }
}

/* ── dark theme: lift the status colours off the dark surface ─
   The base rules above are tuned for the light surface, where a
   pale red would sit at roughly 1.9:1. These are the dark-side
   equivalents.  */

:root[data-theme="dark"] .bk-state--error {
  border-color: rgba(248, 113, 113, .28);
  background: rgba(248, 113, 113, .06);
}
:root[data-theme="dark"] .bk-state--error svg { color: #f87171; }
:root[data-theme="dark"] .bk-state--error .bk-state-title { color: #fca5a5; }

:root[data-theme="dark"] .bk-retry {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, .35);
}
:root[data-theme="dark"] .bk-retry:hover { background: rgba(248, 113, 113, .1); }

:root[data-theme="dark"] .bk-err { color: #fca5a5; }

:root[data-theme="dark"] .bk-banner {
  border-color: rgba(248, 113, 113, .3);
  background: rgba(248, 113, 113, .08);
  color: #fca5a5;
}
:root[data-theme="dark"] .bk-banner.is-warning {
  border-color: rgba(251, 191, 36, .35);
  background: rgba(251, 191, 36, .08);
  color: #fcd34d;
}

:root[data-theme="dark"] .bk-chip.is-low { border-color: rgba(245, 158, 11, .55); }
:root[data-theme="dark"] .bk-chip.is-low .bk-seats { color: #fbbf24; }

/* Conflict/notice banner shown above the date strip (see syncTopBanner). */
.bk-top-banner { margin-bottom: 16px; }

/* ── reschedule: a slot that lost a race ──────────────────────
   Visually distinct from an ordinary "Full" chip. Full means it was
   already booked when the grid loaded; this one was taken out from
   under the customer mid-submission, so it earns a strike-through and
   a one-shot flash to draw the eye to what changed. */

.bk-chip.is-taken {
  border-style: dashed;
  border-color: rgba(180, 83, 9, .5);
}
.bk-chip.is-taken > span:first-child { text-decoration: line-through; }
.bk-chip.is-taken .bk-seats { color: #b45309; }

:root[data-theme="dark"] .bk-chip.is-taken { border-color: rgba(251, 191, 36, .45); }
:root[data-theme="dark"] .bk-chip.is-taken .bk-seats { color: #fcd34d; }

.bk-chip.is-flash { animation: bk-flash .9s ease-out 1; }

@keyframes bk-flash {
  0%   { transform: none; box-shadow: 0 0 0 0 rgba(180, 83, 9, .45); }
  35%  { transform: translateY(-2px); box-shadow: 0 0 0 6px rgba(180, 83, 9, .16); }
  100% { transform: none; box-shadow: 0 0 0 0 rgba(180, 83, 9, 0); }
}

.bk-top-banner.is-flash { animation: bk-banner-in .45s cubic-bezier(.16, 1, .3, 1) 1; }

@keyframes bk-banner-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bk-chip.is-flash, .bk-top-banner.is-flash { animation: none; }
}

/* ── "previous demo still active" dialog ──────────────────────
   Centred sheet on desktop, bottom sheet on phones where a centred
   modal fights the on-screen keyboard and the thumb. */

.bk-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 7, 13, .55);
  backdrop-filter: blur(2px);
  animation: bk-fade .18s ease-out both;
}

@keyframes bk-fade { from { opacity: 0; } to { opacity: 1; } }

.bk-modal {
  width: 100%;
  max-width: 28rem;
  border-radius: 20px;
  background: var(--ink-2);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 70px rgba(0, 0, 0, .45);
  overflow: hidden;
  animation: bk-rise .26s cubic-bezier(.16, 1, .3, 1) both;
}

.bk-modal-head {
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--line-1);
}
.bk-modal-head h2 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--tx-1);
}
.bk-modal-head p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--tx-2); }

.bk-modal-body { padding: 16px 20px 4px; display: flex; flex-direction: column; gap: 12px; }

.bk-modal-card {
  padding: 12px;
  border-radius: 12px;
  background: var(--ink-1);
  border: 1px solid var(--line-2);
}
.bk-modal-card.is-new {
  border-color: rgba(52, 211, 153, .35);
  background: rgba(52, 211, 153, .07);
}
.bk-modal-label {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tx-3);
}
.bk-modal-card.is-new .bk-modal-label { color: var(--em-2); }
.bk-modal-value { margin: 0; font-size: 14px; font-weight: 700; color: var(--tx-1); }
.bk-modal-sub { margin: 2px 0 0; font-size: 12px; color: var(--tx-3); }
.bk-modal-note { margin: 4px 0 0; font-size: 12px; line-height: 1.55; color: var(--tx-3); }

.bk-modal-actions { display: flex; gap: 12px; padding: 16px 20px 20px; }
.bk-modal-actions .bk-btn { flex: 1; }

@media (max-width: 520px) {
  .bk-modal-backdrop { align-items: flex-end; padding: 0; }
  .bk-modal {
    max-width: none;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    animation: bk-sheet .26s cubic-bezier(.16, 1, .3, 1) both;
  }
  .bk-modal-actions { flex-direction: column-reverse; }
}

@keyframes bk-sheet {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bk-modal-backdrop, .bk-modal { animation: none; }
}

/* Industry select: read the unselected placeholder as muted, like an input's
   placeholder, then normal weight/colour once a real option is chosen. The
   form is novalidate, so :invalid drives only the colour, never a popup. */
.bk-select:required:invalid { color: var(--tx-3); }
.bk-select option { color: var(--tx-1); }
