/* ============================================================================
   PUBLIC BOOKING — Hairmano
   Mobile-first. Pairs with main.css design tokens.
   Motion system: organic easing, ~150-300ms UI / ~400-600ms reveals.
   ============================================================================ */

:root {
  --booking-max: 720px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[x-cloak] { display: none !important; }

.booking-body {
  background: var(--color-bg);
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--color-ink);
  position: relative;
  overflow-x: hidden;
}

/* ---------- Animated mesh background ---------- */
.booking-mesh-bg {
  position: fixed;
  inset: -100px;
  z-index: 0;
  pointer-events: none;
  background:
    var(--gradient-mesh-1),
    var(--gradient-mesh-2),
    var(--gradient-mesh-3);
  filter: blur(40px) saturate(1.1);
  animation: mesh-drift 28s ease-in-out infinite;
  opacity: 0.85;
}

@keyframes mesh-drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(2%, -1%) scale(1.04); }
  66%      { transform: translate(-1.5%, 1.5%) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  .booking-mesh-bg { animation: none; }
}

/* All content stacks above the mesh */
.booking-topbar, .booking-wrap, .booking-footer { position: relative; z-index: 1; }

/* ---------- Topbar ---------- */
.booking-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(228, 228, 231, 0.6);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  position: sticky;
  top: 0;
  z-index: 20;
}

.booking-topbar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--color-ink-muted);
}

.booking-topbar-tag {
  background: var(--gradient-ink);
  color: var(--color-bg);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .booking-topbar { padding: 14px 16px; }
  .booking-topbar-hours { display: none; }
}

/* ---------- Wrap ---------- */
.booking-wrap {
  max-width: var(--booking-max);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

/* ---------- Hero ---------- */
.booking-hero {
  margin-bottom: 36px;
  padding: 8px 4px;
}

.booking-hero-title {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.02;
  margin: 0 0 14px;
  color: var(--color-ink);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
}

.booking-hero-sub {
  font-size: 17px;
  color: var(--color-ink-muted);
  margin: 0;
  max-width: 480px;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 600ms var(--ease-out) 120ms, transform 600ms var(--ease-out) 120ms;
}

.booking-hero-title.in,
.booking-hero-sub.in {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 540px) {
  .booking-hero-title { font-size: 38px; }
  .booking-hero-sub { font-size: 15px; }
}

/* ---------- Card ---------- */
.booking-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  position: relative;
}

.booking-card-in {
  animation: card-rise 500ms var(--ease-out) backwards;
  animation-delay: 220ms;
}

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

/* ---------- Step blocks ---------- */
.booking-step {
  padding: 24px 22px;
  border-bottom: 1px solid var(--color-border);
  transition: opacity 320ms var(--ease-out), filter 320ms var(--ease-out);
}

.booking-step:last-of-type { border-bottom: none; }

.booking-step.waiting {
  opacity: 0.42;
  pointer-events: none;
  filter: saturate(0.5);
}

.booking-step.done .booking-step-num {
  background: var(--gradient-primary);
  color: var(--color-bg);
  border-color: transparent;
  box-shadow: var(--shadow-violet-sm);
}

.booking-step.active .booking-step-num {
  background: var(--gradient-ink);
  color: var(--color-bg);
  border-color: var(--color-ink);
  animation: pulse-ring 2.4s ease-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(10, 10, 10, 0.15); }
  50%      { box-shadow: 0 0 0 6px rgba(10, 10, 10, 0); }
}

.booking-step-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.booking-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 280ms var(--ease-spring);
}

.booking-step-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.booking-step-sub {
  font-size: 13px;
  color: var(--color-ink-muted);
}

.booking-step-error {
  margin-top: 8px;
  font-size: 13px;
  color: var(--color-danger);
}

/* ---------- Service tiles ---------- */
.booking-services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.service-tile {
  position: relative;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  text-align: left;
  cursor: pointer;
  transition: transform 220ms var(--ease-spring),
              box-shadow 220ms var(--ease-out),
              border-color 180ms var(--ease-out),
              background 180ms var(--ease-out);
  font-family: var(--font-body);
  animation: tile-rise 480ms var(--ease-out) backwards;
}

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

.service-tile:hover:not(:disabled) {
  border-color: var(--color-ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.service-tile:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
  transition-duration: 80ms;
}

.service-tile.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: var(--shadow-violet-sm);
}

.service-tile.selected:hover {
  border-color: var(--color-primary);
}

.service-tile.is-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.service-tile.pop {
  animation: tile-pop 360ms var(--ease-spring);
}

@keyframes tile-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.service-tile-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.005em;
  margin-bottom: 6px;
  padding-right: 22px;
}

.service-tile-meta {
  font-size: 12px;
  color: var(--color-ink-muted);
  font-variant-numeric: tabular-nums;
}

.service-tile-price {
  color: var(--color-ink);
  font-weight: 600;
}

.service-tile.selected .service-tile-price {
  color: var(--color-primary-deep);
}

.service-tile-meta .dot { margin: 0 4px; }

.service-tile-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  background: var(--color-primary);
  color: var(--color-bg);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: check-in 360ms var(--ease-spring);
}

@keyframes check-in {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}

/* Skeleton */
.skel {
  background: linear-gradient(90deg, #F4F4F5 0%, #FAFAFA 50%, #F4F4F5 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: var(--radius-md);
}

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

.service-tile-skeleton {
  height: 78px;
}

/* ---------- Date strip ---------- */
.booking-date-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 4px 14px;
  margin: -4px -4px 0;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.booking-date-strip::-webkit-scrollbar { display: none; }
.booking-date-strip { scrollbar-width: none; }

.date-tile {
  position: relative;
  flex: 0 0 auto;
  min-width: 68px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  cursor: pointer;
  transition: transform 200ms var(--ease-spring),
              border-color 180ms var(--ease-out),
              background 200ms var(--ease-out),
              color 200ms var(--ease-out);
  text-align: center;
  scroll-snap-align: start;
  font-family: var(--font-body);
}

.date-tile:hover {
  border-color: var(--color-ink);
  transform: translateY(-1px);
}

.date-tile:active { transform: translateY(0) scale(0.97); transition-duration: 80ms; }

.date-tile.selected {
  background: var(--gradient-ink);
  color: var(--color-bg);
  border-color: var(--color-ink);
  box-shadow: var(--shadow-md);
}

.date-tile.today::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-bg);
}

.date-tile.selected.today::before { box-shadow: 0 0 0 2px var(--color-ink); }

.date-tile-dow {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-ink-muted);
  margin-bottom: 4px;
}

.date-tile.selected .date-tile-dow { color: rgba(255, 255, 255, 0.65); }

.date-tile-day {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.date-tile-month {
  font-size: 11px;
  margin-top: 4px;
  color: var(--color-ink-muted);
  font-weight: 500;
}

.date-tile.selected .date-tile-month { color: rgba(255, 255, 255, 0.65); }

/* ---------- Barber cards (3 horizontal) ---------- */
.booking-barbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 540px) {
  .booking-barbers { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

.barber-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 18px 12px 14px;
  cursor: pointer;
  transition: transform 220ms var(--ease-spring),
              box-shadow 220ms var(--ease-out),
              border-color 180ms var(--ease-out);
  font-family: var(--font-body);
  text-align: center;
  animation: tile-rise 480ms var(--ease-out) backwards;
  overflow: hidden;
}

.barber-card:hover:not(:disabled) {
  border-color: var(--color-ink);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.barber-card:active:not(:disabled) {
  transform: translateY(-1px) scale(0.98);
  transition-duration: 80ms;
}

.barber-card.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
  box-shadow: var(--shadow-violet-sm);
}

.barber-card.selected::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, transparent 65%, rgba(107, 78, 255, 0.05));
  pointer-events: none;
}

.barber-card.is-off,
.barber-card.is-full {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--color-surface);
}

.barber-card-avatar {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-surface);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.barber-card-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.barber-card-avatar-fallback {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-ink-muted);
}

.barber-card.is-loading .barber-card-avatar-pulse {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0;
  animation: avatar-pulse 1.6s ease-out infinite;
}

@keyframes avatar-pulse {
  0%   { opacity: 0.7; transform: scale(0.95); }
  100% { opacity: 0; transform: scale(1.15); }
}

.barber-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
  letter-spacing: -0.005em;
  line-height: 1.2;
}

.barber-card-meta {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  min-height: 18px;
}

.barber-card-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
}

.status-available { color: var(--color-success); font-weight: 600; }
.status-off       { color: var(--color-ink-muted); }
.status-full      { color: var(--color-warning); }
.status-loading   { color: var(--color-ink-muted); }

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-ink-muted);
  display: inline-block;
}

.status-dot-live {
  background: var(--color-success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: live-pulse 1.8s ease-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
  50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}

.loading-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-ink-muted);
  animation: loading-bounce 1.2s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.15s; }
.loading-dot:nth-child(3) { animation-delay: 0.30s; }

@keyframes loading-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 380px) {
  .barber-card { padding: 14px 8px 10px; }
  .barber-card-avatar { width: 48px; height: 48px; }
  .barber-card-name { font-size: 13px; }
  .barber-card-status { font-size: 10px; }
}

/* ---------- Time strip (full day, scrollable) ---------- */
.time-strip-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.time-strip {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: 8px;
}

.time-strip::-webkit-scrollbar { display: none; }
.time-strip { scrollbar-width: none; }

.time-cell {
  flex: 0 0 auto;
  min-width: 68px;
  padding: 12px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 200ms var(--ease-spring),
              background 200ms var(--ease-out),
              border-color 180ms var(--ease-out),
              color 180ms var(--ease-out);
}

.time-cell.taken {
  background: var(--color-surface);
  color: var(--color-grey);
  border-color: transparent;
  text-decoration: line-through;
  text-decoration-color: rgba(161, 161, 170, 0.5);
  cursor: not-allowed;
}

.time-cell.available:hover {
  border-color: var(--color-ink);
  transform: translateY(-2px);
}

.time-cell.available:active {
  transform: translateY(0) scale(0.94);
  transition-duration: 80ms;
}

.time-cell.selected {
  background: var(--gradient-ink);
  color: var(--color-bg);
  border-color: var(--color-ink);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.time-strip-arrow {
  flex-shrink: 0;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  width: 36px;
  cursor: pointer;
  color: var(--color-ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 180ms var(--ease-out);
  align-self: stretch;
  margin-bottom: 12px;
}

.time-strip-arrow:hover {
  background: var(--color-ink);
  color: var(--color-bg);
  border-color: var(--color-ink);
}

.time-cell-skeleton {
  flex: 0 0 auto;
  min-width: 68px;
  height: 42px;
}

@media (max-width: 480px) {
  .time-strip-arrow { display: none; }
  .time-cell { min-width: 62px; padding: 11px 6px; font-size: 13px; }
}

/* ---------- Form ---------- */
.booking-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Submit ---------- */
.booking-submit {
  padding: 22px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.booking-summary {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  animation: summary-in 360ms var(--ease-out);
}

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

.booking-summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.booking-submit-btn {
  position: relative;
  width: 100%;
  padding: 16px 18px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-md);
  letter-spacing: -0.005em;
  overflow: hidden;
  transition: transform 220ms var(--ease-spring),
              box-shadow 220ms var(--ease-out),
              opacity 200ms var(--ease-out);
}

.booking-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.booking-submit-btn.ready {
  box-shadow: var(--shadow-violet-sm);
}

.booking-submit-btn.ready:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-violet);
}

.booking-submit-btn.ready:active {
  transform: translateY(0) scale(0.99);
}

/* Sheen sweep on ready button */
.booking-submit-btn.ready::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: sheen 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sheen {
  0%   { transform: translateX(-120%); }
  35%  { transform: translateX(180%); }
  100% { transform: translateX(180%); }
}

.dot-spinner {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  margin-right: 6px;
  animation: spinner-pulse 0.9s ease-in-out infinite;
}

@keyframes spinner-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.7); }
  50%      { opacity: 1; transform: scale(1.1); }
}

.booking-error {
  font-size: 13px;
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.18);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  animation: shake-x 380ms ease-out;
}

@keyframes shake-x {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(2px); }
}

.booking-fineprint {
  font-size: 11px;
  color: var(--color-grey);
  text-align: center;
  margin: 4px 0 0;
  line-height: 1.5;
}

/* ---------- Confirmation ---------- */
.booking-confirmed {
  text-align: center;
  padding: 56px 28px 36px;
}

.confirmed-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: var(--color-ink);
  margin-bottom: 22px;
  box-shadow: var(--shadow-lime);
}

.confirmed-circle {
  stroke-dasharray: 63;
  stroke-dashoffset: 63;
  animation: draw-circle 600ms var(--ease-out) 80ms forwards;
}

.confirmed-check {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: draw-check 380ms var(--ease-out) 580ms forwards;
}

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

.confirmed-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.confirmed-sub {
  font-size: 15px;
  color: var(--color-ink-muted);
  line-height: 1.5;
  margin: 0 auto 24px;
  max-width: 420px;
}

.confirmed-meta {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 0 auto 24px;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.confirmed-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

/* ---------- Footer ---------- */
.booking-footer {
  margin-top: 60px;
  border-top: 1px solid var(--color-border);
  padding: 22px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}

.booking-footer-row {
  max-width: var(--booking-max);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  font-size: 12px;
  color: var(--color-ink-muted);
}

/* ---------- Empty state ---------- */
.empty-state {
  font-size: 13px;
  color: var(--color-ink-muted);
  text-align: center;
  padding: 18px 8px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
}

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