/* Bookr shared CSS — focus states, accessibility, spinner, loading dots */

:root {
  /* Audit found --dim at 0.26 opacity fails WCAG AA (2.7:1). Bump to 0.42 ≈ 4.6:1. */
  --dim: rgba(250,250,248,.42);
}

/* Focus visibility — keyboard users */
*:focus-visible {
  outline: 2px solid var(--blue, #2563EB);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Shared spinner — used across many pages */
.bookr-spinner,
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-bottom-color: transparent;
  border-radius: 50%;
  animation: bookr-spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes bookr-spin {
  to { transform: rotate(360deg); }
}

/* Loading dots */
.bookr-loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.bookr-loading-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted, rgba(250,250,248,.52));
  animation: bookr-dot 1.4s ease-in-out infinite both;
}
.bookr-loading-dots span:nth-child(2) { animation-delay: 0.16s; }
.bookr-loading-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes bookr-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ─────────────────────────────────────────────────────────────
   Bookr animation library — canonical bk-* keyframes
   Source of truth for every motion primitive used across the site.
   Per-page CSS should reference these names, not redefine them.
   ───────────────────────────────────────────────────────────── */

/* Fade up — content entering the viewport */
@keyframes bkFadeUp {
  0%   { opacity: 0; transform: translateY(6px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* Slot-in — list rows staggering on */
@keyframes bkSlotIn {
  0%   { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* Counter / small number fade */
@keyframes bkCounterIn {
  0%   { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* Scale-in pop — success checkmarks, modals */
@keyframes bkScaleIn {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
/* Stroke draw — checkmark / icon */
@keyframes bkCheckDraw {
  to { stroke-dashoffset: 0; }
}
/* Error / failure shake */
@keyframes bkShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(2px); }
}
/* Pulse — small accent dot */
@keyframes bkPulse {
  0%, 100% { opacity: .4; transform: scale(1); }
  50%      { opacity: 1;  transform: scale(1.35); }
}
/* Pulse dot — opacity only, no scale */
@keyframes bkPulseDot {
  0%, 100% { opacity: .6; }
  50%      { opacity: 1; }
}
/* Loading dot — slight scale + opacity */
@keyframes bkLoadingDot {
  0%, 100% { opacity: .25; transform: scale(.85); }
  50%      { opacity: 1;   transform: scale(1); }
}
/* Skeleton shimmer — left to right gradient sweep */
@keyframes bkSkelShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
/* Decorative card-top shimmer — used on intro cards */
@keyframes bkShimmer {
  0%   { transform: translateX(-100%); opacity: 0; }
  20%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}
/* Bar rise — chart bars growing from baseline */
@keyframes bkBarRise {
  0%   { transform: scaleY(0); opacity: 0; }
  60%  { opacity: 1; }
  100% { transform: scaleY(1); opacity: 1; }
}
/* Bar glow — chart highlight pulse */
@keyframes bkBarGlow {
  0%, 100% { box-shadow: 0 0 16px rgba(37,99,235,.4); }
  50%      { box-shadow: 0 0 32px rgba(37,99,235,.85); }
}
/* Aura drift — soft radial glow ambient motion */
@keyframes bkAuraDrift {
  0%, 100% { transform: translate(-50%, 0) scale(1); opacity: .9; }
  50%      { transform: translate(-50%, -10px) scale(1.06); opacity: 1; }
}
/* Slow drift — gentle vertical hover */
@keyframes bkSlowDrift {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
/* Spin — generic spinner */
@keyframes bkSpin {
  to { transform: rotate(360deg); }
}
/* Sheet up — bottom sheet entrance */
@keyframes bkSheetUp {
  0%   { opacity: 0; transform: translateY(40px); }
  100% { opacity: 1; transform: translateY(0); }
}
/* Slide down in — iOS-style notification card */
@keyframes bkSlideDownIn {
  0%   { opacity: 0; transform: translateY(-30px) scale(.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* Spotlight pulse — coachmark highlight ring */
@keyframes bkSpotPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(59,130,246,.18), 0 0 40px rgba(59,130,246,.4); }
  50%      { box-shadow: 0 0 0 10px rgba(59,130,246,.28), 0 0 60px rgba(59,130,246,.6); }
}
/* Pull-to-refresh indicator bounce */
@keyframes bkPullBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(3px); }
}
/* Button breathing glow — subtle CTA pulse */
@keyframes bkButtonBreathe {
  0%, 100% { box-shadow: 0 6px 22px rgba(37,99,235,.32); }
  50%      { box-shadow: 0 10px 36px rgba(37,99,235,.55); }
}
@keyframes bkButtonBreatheStrong {
  0%, 100% { box-shadow: 0 6px 22px rgba(37,99,235,.32); }
  50%      { box-shadow: 0 14px 44px rgba(37,99,235,.65); }
}
/* Activity show — recurring micro-pop for activity tickers */
@keyframes bkActivityShow {
  0%, 100%  { opacity: 0; transform: translateY(-10px); }
  6%, 22%   { opacity: 1; transform: translateY(0); }
  30%       { opacity: 0; transform: translateY(10px); }
  31%, 99%  { opacity: 0; transform: translateY(-10px); }
}

/* Convenience utility classes — opt-in, no defaults */
.bk-skel {
  position: relative; overflow: hidden;
  background: rgba(250,250,248,.06);
  border-radius: 6px;
}
.bk-skel::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent);
  animation: bkSkelShimmer 1.6s infinite;
}

/* ─────────────────────────────────────────────────────────────
   P2 — Universal button feedback + accessibility
   Applies to every button class used across the site without
   needing per-page edits. Honours prefers-reduced-motion.
   ───────────────────────────────────────────────────────────── */

/* Press-down feedback on all common button classes */
.btn-p:not(:disabled):active,
.btn-s:not(:disabled):active,
.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active,
.btn-blue:not(:disabled):active,
.submit-btn:not(:disabled):active,
.plan-cta:not(:disabled):active,
.cv-book:not(:disabled):active,
.hero-cta-p:not(:disabled):active,
.hero-cta-s:not(:disabled):active,
.s0-primary:not(:disabled):active,
.s0-sec:not(:disabled):active,
.nav-btn:not(:disabled):active {
  transform: scale(.97);
  transition: transform .08s ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .btn-p:active, .btn-s:active, .btn-primary:active, .btn-secondary:active,
  .btn-blue:active, .submit-btn:active, .plan-cta:active, .cv-book:active,
  .hero-cta-p:active, .hero-cta-s:active, .s0-primary:active, .s0-sec:active,
  .nav-btn:active { transform: none; }
}

/* Disabled state visual */
button:disabled,
.btn-p:disabled, .btn-s:disabled, .submit-btn:disabled,
.plan-cta:disabled, .btn-primary:disabled, .btn-secondary:disabled {
  cursor: not-allowed; opacity: .55;
}

/* Stronger focus ring for keyboard users on primary actions */
.btn-p:focus-visible,
.btn-primary:focus-visible,
.btn-blue:focus-visible,
.submit-btn:focus-visible,
.plan-cta:focus-visible,
.s0-primary:focus-visible,
.hero-cta-p:focus-visible,
.nav-btn:focus-visible {
  outline: 2px solid var(--blue, #2563EB);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(37,99,235,.18);
}

/* Tab focus visible (manage.html and other tabbed pages) */
.tab:focus-visible {
  outline: 2px solid var(--blue, #2563EB);
  outline-offset: -2px;
  border-radius: 4px;
}

/* Hover transition smoothness on .btn-* — defensive, won't override existing :hover bg */
.btn-p, .btn-s, .btn-primary, .btn-secondary, .btn-blue,
.submit-btn, .plan-cta {
  transition: background-color .15s ease, border-color .15s ease,
              color .15s ease, transform .12s ease, box-shadow .15s ease;
}

/* ─────────────────────────────────────────────────────────────
   P3 — Reusable state-screen patterns from Claude Design
   These are utility classes/components individual pages can opt into.
   ───────────────────────────────────────────────────────────── */

/* — Empty state: "A quiet day" stacked-cards illustration — */
.bk-empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; text-align: center;
  padding: 64px 32px;
  max-width: 360px; margin: 0 auto;
}
.bk-empty-illu {
  position: relative;
  width: 140px; height: 100px; margin-bottom: 8px;
}
.bk-empty-illu .bk-empty-bar {
  position: absolute; left: 50%;
  height: 12px; border-radius: 4px;
  border: 1px solid var(--border, rgba(250,250,248,.08));
  transform: translateX(-50%);
}
.bk-empty-illu .bk-empty-bar:nth-child(1) { width: 100px; top: 30px; background: rgba(250,250,248,.06); animation: bkSlowDrift 4s 0s ease-in-out infinite; }
.bk-empty-illu .bk-empty-bar:nth-child(2) { width: 90px;  top: 52px; background: rgba(250,250,248,.045); animation: bkSlowDrift 4s .4s ease-in-out infinite; }
.bk-empty-illu .bk-empty-bar:nth-child(3) { width: 80px;  top: 74px; background: rgba(250,250,248,.03); animation: bkSlowDrift 4s .8s ease-in-out infinite; }
.bk-empty-state .bk-empty-title {
  font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  color: var(--paper, #FAFAF8);
}
.bk-empty-state .bk-empty-sub {
  font-size: 13.5px; line-height: 1.55;
  color: var(--muted, rgba(250,250,248,.52));
}

/* — Animated success bubble — uses bkScaleIn + bkCheckDraw — */
.bk-success-bubble {
  width: 88px; height: 88px; border-radius: 50%;
  background: rgba(37,99,235,.14);
  border: 2px solid var(--blue, #2563EB);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  animation: bkScaleIn .6s cubic-bezier(.2,.9,.3,1.4) both,
             bkButtonBreathe 3s 1s infinite ease-in-out;
  box-shadow: 0 10px 40px rgba(37,99,235,.4);
}
.bk-success-bubble.is-success {
  background: rgba(31,138,91,.14);
  border-color: var(--green, #1F8A5B);
  box-shadow: 0 10px 40px rgba(31,138,91,.32);
}
.bk-success-bubble.is-error {
  background: rgba(224,82,82,.12);
  border-color: var(--red, #E05252);
  box-shadow: 0 10px 40px rgba(224,82,82,.32);
  animation: bkScaleIn .55s cubic-bezier(.2,.9,.3,1.4) both,
             bkShake 1.2s .55s ease-in-out;
}
.bk-success-bubble svg { width: 46px; height: 46px; }
.bk-success-bubble .bk-check-path {
  stroke-dasharray: 60; stroke-dashoffset: 60;
  animation: bkCheckDraw .55s .35s forwards ease-out;
}

/* — Bottom sheet — modal drawer from bottom — */
.bk-sheet-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: bkFadeUp .25s ease both;
}
.bk-sheet {
  width: 100%; max-width: 520px;
  background: rgba(20,20,26,.94);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border-top-left-radius: 22px; border-top-right-radius: 22px;
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 0 0 30px;
  animation: bkSheetUp .45s cubic-bezier(.2,.85,.3,1) both;
  max-height: 86vh; overflow-y: auto;
}
.bk-sheet-handle {
  width: 36px; height: 5px; border-radius: 99px;
  background: rgba(235,235,245,.18);
  margin: 11px auto 12px;
}

/* — iOS-style push notification toast — */
.bk-toast {
  position: fixed; top: 12px; left: 12px; right: 12px; z-index: 300;
  max-width: 480px; margin: 0 auto;
  background: rgba(28,28,30,.88);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 18px;
  padding: 11px 13px 12px;
  display: flex; align-items: flex-start; gap: 11px;
  color: var(--paper, #FAFAF8);
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
  animation: bkSlideDownIn .5s cubic-bezier(.2,.85,.3,1) both;
}
.bk-toast-mark {
  width: 36px; height: 36px; border-radius: 9px;
  background: #0A0A0F;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.bk-toast-body { flex: 1; min-width: 0; }
.bk-toast-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 600; letter-spacing: -0.1px;
}
.bk-toast-time { font-size: 10.5px; color: rgba(235,235,245,.5); font-weight: 400; }
.bk-toast-line { margin-top: 1px; font-size: 13px; }
.bk-toast-sub { margin-top: 1px; font-size: 12.5px; color: rgba(235,235,245,.65); }

/* — OTP code boxes (for 6-digit verify flows) — */
.bk-otp-row { display: flex; gap: 8px; }
.bk-otp-box {
  flex: 1; aspect-ratio: 1 / 1.15;
  background: rgba(250,250,248,.06);
  border: 1px solid rgba(250,250,248,.14);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono, ui-monospace), monospace;
  font-size: 22px; font-weight: 600;
  color: var(--paper, #FAFAF8);
}
.bk-otp-box.is-focus {
  background: rgba(37,99,235,.1);
  border: 1.5px solid rgba(37,99,235,.6);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.bk-otp-box .bk-otp-caret {
  width: 2px; height: 22px;
  background: var(--blue, #2563EB);
  animation: bkPulseDot 1s infinite;
}

/* — Stepper bar (3 segments) — */
.bk-stepper {
  display: flex; gap: 4px; padding: 0;
}
.bk-stepper > div {
  flex: 1; height: 3px; border-radius: 99px;
  background: rgba(255,255,255,.1);
  transition: background .25s;
}
.bk-stepper > div.is-active,
.bk-stepper > div.is-done { background: var(--blue, #2563EB); }

/* — Coachmark tooltip (onboarding) — */
.bk-coachmark-mask {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,.62);
  pointer-events: none;
}
.bk-coachmark-spot {
  position: absolute; z-index: 251;
  border-radius: 12px;
  background: rgba(37,99,235,.12);
  border: 2px solid rgba(59,130,246,.7);
  animation: bkSpotPulse 1.6s infinite ease-in-out;
  pointer-events: none;
}
.bk-coachmark {
  position: absolute; z-index: 252;
  background: var(--paper, #FAFAF8); color: var(--ink, #0A0A0F);
  border-radius: 16px; padding: 16px 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5);
  animation: bkFadeUp .5s .2s both;
}
