/* booking-page/public/assets/style.css
 * XR8 + Numark co-branded booking page — v2 rebrand
 * Brand tokens: navy #003087, teal #0f6b5c, ink #1f2533, page #eceef2
 * Font: system stack (no external font dependency)
 * WCAG 2.2 AA: contrast >=4.5:1, visible focus-visible outlines, full keyboard nav
 * Motion: tasteful, guarded behind prefers-reduced-motion
 */

/* ── Design tokens ── */
:root {
  --navy:        #003087;
  --navy-deep:   #002567;
  --ink:         #1f2533;
  --muted:       #5b6472;
  --line:        #e3e7ef;
  --chip:        #f4f6fb;
  --teal:        #0f6b5c;
  --teal-bg:     #eef6f4;
  --page:        #eceef2;
  --header:      #11131a;
  --white:       #fff;
  --error:       #b91c1c;
  --error-bg:    #fef2f2;
  --error-line:  #fca5a5;
  --focus:       #003087;

  /* legacy aliases kept for confirmed.html inline styles */
  --text-primary:   var(--ink);
  --text-secondary: var(--muted);
  --border:         var(--line);
  --surface-raised: var(--chip);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ────────────────────────────────────────
   TOP BAR
──────────────────────────────────────── */
.page-header {
  background: var(--header);
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.page-header .wordmark {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--white);
}

.page-header .cobrand {
  font-size: 12px;
  color: #aeb6c4;
}

/* ────────────────────────────────────────
   LAYOUT
──────────────────────────────────────── */
.page-wrapper {
  min-height: calc(100vh - 46px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 56px;
}

.card {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, .08), 0 0 0 1px rgba(0, 0, 0, .04);
  overflow: hidden;

  /* entrance animation */
  animation: card-rise 280ms ease-out both;
}

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

/* ────────────────────────────────────────
   CARD INTERNALS — keep accent + header/body/footer
   structure (booking.js doesn't touch these, but the
   HTML still uses them)
──────────────────────────────────────── */
.card-accent {
  height: 4px;
  background: var(--navy);
}

/* Card header: brand row rendered in the header already via .page-header,
   but keep .card-header/.brand-row alive in case someone links to the
   old brand-row markup inside the card. */
.card-header {
  /* hidden — branding now lives in .page-header */
  display: none;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-xr8 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--navy);
}

.brand-cobrand {
  font-size: 12px;
  color: var(--muted);
}

.brand-cobrand strong {
  color: var(--navy);
  font-weight: 700;
}

/* ── Card body ── */
.card-body {
  padding: 28px 32px 32px;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.3;
}

.subtitle {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 22px;
  line-height: 1.5;
}

/* ────────────────────────────────────────
   STATES — cross-fade transitions
──────────────────────────────────────── */
.state {
  display: none;
  opacity: 0;
}

.state.active {
  display: block;
  animation: state-in 220ms ease-out both;
}

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

/* ────────────────────────────────────────
   VERIFYING STATE
   Skeleton shimmer while /api/slots loads
──────────────────────────────────────── */
.verifying-msg {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 8px 0 20px;
}

.verifying-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  color: var(--muted);
}

/* CSS-only spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton shimmer for slot area */
.skeleton-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.skel {
  height: 38px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--chip) 0%,
    var(--line) 40%,
    var(--chip) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.skel-date {
  width: 160px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--chip) 0%,
    var(--line) 40%,
    var(--chip) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  margin-bottom: 8px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ────────────────────────────────────────
   INVALID STATE
──────────────────────────────────────── */
.invalid-msg {
  padding: 16px 18px;
  margin-bottom: 16px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.55;
}

.invalid-msg strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
}

/* ────────────────────────────────────────
   DURATION TOGGLE — segmented pill control
──────────────────────────────────────── */
.duration-row {
  margin-bottom: 20px;
}

.duration-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 8px;
}

.duration-btns {
  display: inline-flex;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.duration-btn {
  flex: 1;
  min-width: 80px;
  padding: 9px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.duration-btn.selected {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .1);
}

.duration-btn:hover:not(.selected) {
  color: var(--ink);
}

.duration-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ────────────────────────────────────────
   SLOT LIST
──────────────────────────────────────── */
.slots-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 12px;
}

.date-group {
  margin-bottom: 20px;
  animation: state-in 200ms ease-out both;
}

.date-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
}

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

/* Slot button — staggered entrance via nth-child */
.slot-btn {
  padding: 9px 14px;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  min-width: 70px;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease,
              box-shadow 150ms ease, transform 150ms ease;
  animation: slot-in 200ms ease-out both;
}

.slot-btn:hover {
  border-color: var(--navy);
  box-shadow: 0 2px 6px rgba(0, 48, 135, .12);
  transform: translateY(-1px);
}

.slot-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.slot-btn.selected {
  border-color: var(--teal);
  background: var(--teal-bg);
  color: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 107, 92, .2);
}

/* small check affordance inside selected slot */
.slot-btn.selected::after {
  content: " \2713";
  font-size: 12px;
  opacity: .8;
}

.slot-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* staggered entrance — up to 12 slots */
.slot-btn:nth-child(1)  { animation-delay:   0ms; }
.slot-btn:nth-child(2)  { animation-delay:  30ms; }
.slot-btn:nth-child(3)  { animation-delay:  60ms; }
.slot-btn:nth-child(4)  { animation-delay:  90ms; }
.slot-btn:nth-child(5)  { animation-delay: 120ms; }
.slot-btn:nth-child(6)  { animation-delay: 150ms; }
.slot-btn:nth-child(7)  { animation-delay: 180ms; }
.slot-btn:nth-child(8)  { animation-delay: 210ms; }
.slot-btn:nth-child(9)  { animation-delay: 240ms; }
.slot-btn:nth-child(10) { animation-delay: 270ms; }
.slot-btn:nth-child(11) { animation-delay: 300ms; }
.slot-btn:nth-child(12) { animation-delay: 330ms; }

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

.no-slots-msg {
  font-size: 15px;
  color: var(--muted);
  padding: 10px 0;
}

/* ────────────────────────────────────────
   CONFIRM BUTTON
──────────────────────────────────────── */
.btn-primary {
  position: relative;
  display: block;
  width: 100%;
  padding: 14px 20px;
  margin-top: 22px;
  background: var(--navy);
  color: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, box-shadow 150ms ease;
  text-align: center;
}

.btn-primary:hover:not(:disabled) {
  background: var(--navy-deep);
  box-shadow: 0 2px 8px rgba(0, 48, 135, .25);
}

.btn-primary:active:not(:disabled) {
  box-shadow: none;
}

.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn-primary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

/* CSS spinner shown while button is in "Booking…" state (disabled) */
.btn-primary:disabled::after {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* Only show spinner when text is "Booking…" (relies on disabled state) */
.btn-primary:not(:disabled)::after {
  display: none;
}

/* ────────────────────────────────────────
   SECONDARY BUTTON (request new link)
──────────────────────────────────────── */
.btn-secondary {
  display: inline-block;
  padding: 11px 22px;
  margin-top: 14px;
  background: transparent;
  color: var(--navy);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid var(--navy);
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--navy);
  color: var(--white);
}

.btn-secondary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ────────────────────────────────────────
   ALERTS
──────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 7px;
  font-size: 14px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid var(--error-line);
}

.alert-info {
  background: var(--chip);
  color: var(--ink);
  border: 1px solid var(--line);
}

/* ────────────────────────────────────────
   CARD FOOTER — legal identity
──────────────────────────────────────── */
.card-footer {
  background: var(--chip);
  padding: 14px 32px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  line-height: 1.55;
}

.card-footer a {
  color: var(--muted);
  text-decoration: underline;
}

.card-footer a:hover {
  color: var(--ink);
}

/* ────────────────────────────────────────
   TURNSTILE
──────────────────────────────────────── */
#turnstile-container {
  margin-bottom: 4px;
}

/* ────────────────────────────────────────
   CONFIRMED PAGE ADDITIONS
   (confirmed.html uses its own <style> block
    but also inherits these globals)
──────────────────────────────────────── */

/* Success icon — teal circle with animated check */
.confirmed-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 16px;
  animation: icon-pop 320ms cubic-bezier(.34, 1.56, .64, 1) both;
}

@keyframes icon-pop {
  from {
    opacity: 0;
    transform: scale(.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.confirmed-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--white);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: draw-check 300ms 200ms ease-out forwards;
}

@keyframes draw-check {
  to { stroke-dashoffset: 0; }
}

/* ────────────────────────────────────────
   CANCELLED PAGE ADDITIONS
──────────────────────────────────────── */
.cancelled-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 16px;
}

.cancelled-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--white);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ────────────────────────────────────────
   REDUCED MOTION — disable all animations
   (a11y guard: must wrap every keyframe user)
──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .card,
  .state.active,
  .skel,
  .skel-date,
  .slot-btn,
  .date-group,
  .confirmed-icon,
  .confirmed-icon svg,
  .spinner {
    animation: none;
  }

  .card {
    opacity: 1;
    transform: none;
  }

  .state.active {
    opacity: 1;
    transform: none;
  }

  .skel,
  .skel-date {
    background: var(--chip);
  }

  .confirmed-icon svg {
    stroke-dashoffset: 0;
  }
}

/* ────────────────────────────────────────
   RESPONSIVE
──────────────────────────────────────── */
@media (max-width: 480px) {
  .page-header {
    padding: 12px 16px;
  }

  .card-body, .card-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .slot-btn {
    min-width: 60px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .duration-btns {
    width: 100%;
  }

  .duration-btn {
    flex: 1;
    min-width: 0;
  }
}
