/* DoctorBookk Global Motion Design Tokens
 * Direction: Apple-inspired Physics-based Motion — Slow, Smooth, Fluid, Soft, Natural
 * Preserves DoctorBookk White / Black / Red Brand Identity
 */

:root {
  /* Duration Tokens */
  --motion-instant: 120ms;      /* 80–150ms: tactile press, instant feedback */
  --motion-micro: 220ms;        /* 180–250ms: checkbox, radio, subtle hover */
  --motion-button: 300ms;       /* 250–350ms: button state & spring release */
  --motion-component: 450ms;    /* 400–500ms: dropdown, accordion, tab indicator */
  --motion-page: 560ms;         /* 500–650ms: crossfade + soft slide */
  --motion-modal: 500ms;        /* 450–600ms: modal scale+fade, bottom sheet */
  --motion-reveal: 700ms;       /* 600–800ms: scroll & entrance content reveal */
  --motion-number: 700ms;       /* 600–800ms: number flow & progress bar */
  --motion-result: 900ms;       /* 800–1000ms: result reveal & progressive chart */
  --motion-stagger: 80ms;       /* 60–100ms: staggered list/card reveal */
  --motion-digit-roll: 320ms;   /* Strictly < 1000ms to prevent countdown overlap */

  /* Easing Curves (Critically damped, zero harsh overshoot) */
  --ease-smooth: cubic-bezier(0.45, 0, 0.55, 1);
  --ease-soft-enter: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft-exit: cubic-bezier(0.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(0.42, 0, 0.58, 1);
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Global Disable Flag (from Admin Marketing Control) & Reduced Motion Accessibility */
html.dbk-motion-off *,
html.dbk-motion-off *::before,
html.dbk-motion-off *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

@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 Motion Utility Components */

/* 1. Soft Content Reveal (GPU-only transform + opacity) */
.dbk-reveal {
  opacity: 0;
  transform: translate3d(0, 14px, 0);
  transition: opacity var(--motion-reveal) var(--ease-soft-enter),
              transform var(--motion-reveal) var(--ease-soft-enter);
  will-change: opacity, transform;
}
.dbk-reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  will-change: auto;
}

/* 2. Page Crossfade + Soft Slide (Direction-aware) */
.dbk-page-enter {
  animation: dbk-slide-in-right var(--motion-page) var(--ease-soft-enter) both;
}
.dbk-page-enter-back {
  animation: dbk-slide-in-left var(--motion-page) var(--ease-soft-enter) both;
}
@keyframes dbk-slide-in-right {
  from { opacity: 0; transform: translate3d(18px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes dbk-slide-in-left {
  from { opacity: 0; transform: translate3d(-18px, 0, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* 3. Marketing Widgets (Harmonized with DoctorBookk White / Black / Red) */
.dbk-mkt-strip {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fafaf8;
  border: 1px solid #e5e5e2;
  margin-block: 14px;
}
.dbk-mkt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.dbk-mkt-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #141414;
}
.dbk-mkt-meta {
  font-size: 0.8125rem;
  color: #595959;
  font-variant-numeric: tabular-nums;
}

/* Smooth Digit Roll Countdown (Zero Layout Shift via tabular-nums + fixed digit slot) */
.dbk-countdown {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
  color: #bd1720;
  letter-spacing: 0.02em;
}
.dbk-digit-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 1.1ch;
  flex: 0 0 1.1ch;
  height: 1.35em;
  overflow: hidden;
  line-height: 1.35em;
}
.dbk-digit-val {
  display: block;
  will-change: transform, opacity;
}
.dbk-digit-sep {
  opacity: 0.65;
  padding-inline: 1px;
}

/* Animated Number Flow Counter (Zero Layout Shift) */
.dbk-numflow {
  display: inline-flex;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  min-width: 3.4ch;
  justify-content: center;
}
#waitlist-live-count {
  display: inline-flex;
  min-width: 3.4ch;
  justify-content: center;
}

/* Fluid GPU Progress Bar */
.dbk-quota-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #eaeae6;
  overflow: hidden;
  position: relative;
}
.dbk-quota-fill {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: #bd1720;
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform var(--motion-number) var(--ease-soft-enter);
  will-change: transform;
}
.dbk-quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  color: #3f3f3f;
  font-variant-numeric: tabular-nums;
}
.dbk-quota-strong {
  font-weight: 700;
  color: #141414;
}

/* Soft Skeleton Shimmer Loading */
.dbk-skeleton {
  background: linear-gradient(90deg, #f2f2ef 25%, #e8e8e4 50%, #f2f2ef 75%);
  background-size: 200% 100%;
  animation: dbk-shimmer 1.6s var(--ease-smooth) infinite;
  border-radius: 8px;
}
@keyframes dbk-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Animated Checkmark for Success State */
.dbk-check-svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  vertical-align: middle;
}
.dbk-check-circle {
  stroke: #1b5e3a;
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 64;
  stroke-dashoffset: 64;
  animation: dbk-stroke-draw 420ms var(--ease-soft-enter) forwards;
}
.dbk-check-mark {
  stroke: #1b5e3a;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: dbk-stroke-draw 320ms var(--ease-soft-enter) 180ms forwards;
}
@keyframes dbk-stroke-draw {
  to { stroke-dashoffset: 0; }
}

/* Smooth Toast Notification */
.dbk-toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate3d(-50%, 16px, 0);
  opacity: 0;
  z-index: 2000;
  background: #141414;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(20, 20, 20, 0.22);
  pointer-events: none;
  transition: transform var(--motion-component) var(--ease-soft-enter),
              opacity var(--motion-component) var(--ease-soft-enter);
}
.dbk-toast.is-shown {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

/* Progressive Chart Animation */
.dbk-wheel-animate polygon,
.dbk-wheel-animate line.v2-wheel-edge,
.dbk-wheel-animate circle.v2-wheel-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: dbk-chart-pop var(--motion-result) var(--ease-soft-enter) both;
}
@keyframes dbk-chart-pop {
  from { opacity: 0; transform: scale(0.76); }
  to { opacity: 1; transform: scale(1); }
}

/* Modal Soft Scale + Fade (Apple-inspired) */
.dbk-modal-anim {
  transition: opacity var(--motion-modal) var(--ease-soft-enter);
}
.dbk-modal-anim .modal-card {
  transition: transform var(--motion-modal) var(--ease-soft-enter),
              opacity var(--motion-modal) var(--ease-soft-enter);
}
.dbk-modal-anim.is-entering {
  opacity: 0;
}
.dbk-modal-anim.is-entering .modal-card {
  opacity: 0;
  transform: translate3d(0, 18px, 0) scale(0.965);
}
