/* ============================================================
   SUKOON — Widgets & Overlays: tables, alerts, toasts, modal,
   drawer, cart drawer, accordion, booking calendar, time slots,
   skeleton, timeline, progress, empty states
   Source of truth: DESIGN-sentry.md
   ============================================================ */

/* ============ TABLES ============ */
.sk-table-wrap { overflow-x: auto; border: 1px solid var(--sk-hairline-cloud); border-radius: var(--sk-rounded-xl); }
.sk-table { width: 100%; border-collapse: collapse; font-size: 16px; font-weight: 500; line-height: 1.5; }
.sk-table th {
  text-align: left;
  font-size: 10px; font-weight: 600; letter-spacing: 0.25px; text-transform: uppercase; line-height: 1.8;
  padding: var(--sk-space-md) var(--sk-space-lg);
  border-bottom: 1px solid var(--sk-hairline-cloud);
  background: var(--sk-surface-press-light);
}
.sk-table td { padding: var(--sk-space-md) var(--sk-space-lg); border-bottom: 1px solid var(--sk-hairline-cloud); }
.sk-table tbody tr:last-child td { border-bottom: 0; }
.sk-table tbody tr:hover { background: var(--sk-surface-press-light); }
.sk-table caption { text-align: left; font-size: 14px; padding: var(--sk-space-md) var(--sk-space-lg); }

/* dark-canvas table (dashboard) */
.sk-table-dark .sk-table th { background: var(--sk-surface-night); border-bottom-color: var(--sk-hairline-violet); color: var(--sk-on-dark-muted); }
.sk-table-dark { border-color: var(--sk-hairline-violet); }
.sk-table-dark .sk-table td { border-bottom-color: var(--sk-hairline-violet); color: var(--sk-on-dark-muted); }
.sk-table-dark .sk-table tbody tr:hover { background: var(--sk-on-dark-faint); }

/* ============ ALERTS ============ */
.sk-alert {
  display: flex; gap: var(--sk-space-md); align-items: flex-start;
  border-radius: var(--sk-rounded-md);
  padding: var(--sk-space-md) var(--sk-space-lg);
  font-size: 16px; font-weight: 500; line-height: 1.5;
  border: 1px solid transparent;
}
.sk-alert .bi { font-size: 20px; flex: none; }
.sk-alert-success { background: var(--sk-status-success-tint); color: var(--sk-status-success); border-color: currentColor; }
.sk-alert-error   { background: var(--sk-status-error-tint);   color: var(--sk-status-error);   border-color: currentColor; }
.sk-alert-warning { background: var(--sk-status-warning-tint); color: var(--sk-status-warning); border-color: currentColor; }
.sk-alert-info    { background: var(--sk-status-info-tint);    color: var(--sk-status-info);    border-color: currentColor; }

/* ============ TOASTS ============ */
.sk-toast-region {
  position: fixed;
  bottom: var(--sk-space-xl); right: var(--sk-space-xl);
  z-index: 1000;
  display: flex; flex-direction: column; gap: var(--sk-space-sm);
  max-width: min(380px, calc(100vw - 48px));
}
.sk-toast {
  display: flex; align-items: flex-start; gap: var(--sk-space-md);
  background: var(--sk-surface-night);
  color: var(--sk-on-primary);
  border-radius: var(--sk-rounded-md);
  padding: var(--sk-space-md) var(--sk-space-lg);
  box-shadow: var(--sk-shadow-2);
  font-size: 14px; line-height: 1.43;
  animation: sk-toast-in var(--sk-motion-overlay);
}
.sk-toast .bi { font-size: 18px; flex: none; }
.sk-toast-success .bi { color: var(--sk-accent-lime); }
.sk-toast-error .bi { color: var(--sk-accent-pink); }
.sk-toast .sk-toast-close { margin-left: auto; background: none; border: 0; color: var(--sk-on-dark-muted); cursor: pointer; font-size: 16px; padding: 0; }
@keyframes sk-toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
/* bottom nav is visible up to 767px — keep toasts above it across that whole range */
@media (max-width: 767px) { .sk-toast-region { left: var(--sk-space-lg); right: var(--sk-space-lg); bottom: 76px; } }

/* ============ MODAL / DIALOG ============ */
.sk-modal { border: 0; padding: 0; background: transparent; max-width: min(560px, calc(100vw - 32px)); width: 100%; }
.sk-modal::backdrop { background: rgba(21, 15, 35, 0.6); }
.sk-modal-panel {
  background: var(--sk-surface-canvas-light);
  color: var(--sk-ink-deep);
  border-radius: var(--sk-rounded-xl);
  box-shadow: var(--sk-shadow-2);
  padding: var(--sk-space-xxl);
  display: flex; flex-direction: column; gap: var(--sk-space-lg);
}
.sk-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sk-space-lg); }
.sk-modal-foot { display: flex; justify-content: flex-end; gap: var(--sk-space-md); }
.sk-modal[open] { animation: sk-toast-in var(--sk-motion-overlay); }

/* payment-success variant */
.sk-modal-success .sk-success-mark {
  width: 72px; height: 72px;
  margin-inline: auto;
  display: grid; place-items: center;
  border-radius: var(--sk-rounded-full);
  background: var(--sk-status-success-tint);
  color: var(--sk-status-success);
  font-size: 36px;
}

/* ============ DRAWER (incl. cart) ============ */
.sk-drawer-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(21, 15, 35, 0.6);
  opacity: 0; visibility: hidden;
  transition: opacity var(--sk-motion-overlay), visibility var(--sk-motion-overlay);
}
.sk-drawer {
  position: fixed; top: 0; bottom: 0; right: 0; z-index: 901;
  width: min(420px, 100vw);
  background: var(--sk-surface-canvas-light);
  color: var(--sk-ink-deep);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  visibility: hidden; /* removes off-canvas content from tab order */
  transition: transform var(--sk-motion-overlay), visibility var(--sk-motion-overlay);
  box-shadow: var(--sk-shadow-2);
}
.sk-drawer.is-open { visibility: visible; }
.sk-drawer-left { right: auto; left: 0; transform: translateX(-100%); }
.sk-drawer.is-open { transform: none; }
.sk-drawer.is-open + .sk-drawer-backdrop,
.sk-drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.sk-drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sk-space-lg);
  padding: var(--sk-space-lg) var(--sk-space-xl);
  border-bottom: 1px solid var(--sk-hairline-cloud);
}
.sk-drawer-body { flex: 1; overflow-y: auto; padding: var(--sk-space-xl); }
.sk-drawer-foot { border-top: 1px solid var(--sk-hairline-cloud); padding: var(--sk-space-lg) var(--sk-space-xl); display: grid; gap: var(--sk-space-md); }

/* cart line item */
.sk-cart-item { display: grid; grid-template-columns: 72px 1fr auto; gap: var(--sk-space-md); align-items: center; padding-block: var(--sk-space-md); border-bottom: 1px solid var(--sk-hairline-cloud); }
.sk-cart-item img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--sk-rounded-md); }
.sk-cart-total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 600; }

/* ============ ACCORDION (FAQ) ============ */
.sk-accordion { border: 1px solid var(--sk-hairline-cloud); border-radius: var(--sk-rounded-xl); overflow: hidden; }
.sk-accordion-item + .sk-accordion-item { border-top: 1px solid var(--sk-hairline-cloud); }
.sk-accordion-trigger {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sk-space-lg);
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1.5; text-align: left;
  background: var(--sk-surface-canvas-light); color: inherit;
  border: 0; cursor: pointer;
  padding: var(--sk-space-lg) var(--sk-space-xl);
  min-height: 44px;
  transition: background-color var(--sk-motion-micro);
}
.sk-accordion-trigger:hover { background: var(--sk-surface-press-light); }
.sk-accordion-trigger .bi { transition: transform var(--sk-motion-micro); flex: none; }
.sk-accordion-trigger[aria-expanded="true"] .bi { transform: rotate(180deg); }
.sk-accordion-panel { padding: 0 var(--sk-space-xl) var(--sk-space-lg); font-weight: 400; line-height: 2.0; }
.sk-accordion-panel[hidden] { display: none; }

/* ============ BOOKING CALENDAR ============ */
.sk-calendar { display: inline-block; width: 100%; max-width: 380px; }
.sk-calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sk-space-md); }
.sk-calendar-head .sk-cal-title { font-size: 16px; font-weight: 600; }
.sk-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sk-space-xxs); }
.sk-calendar-grid .sk-cal-dow { text-align: center; font-size: 10px; font-weight: 600; letter-spacing: 0.25px; text-transform: uppercase; color: var(--sk-accent-violet-mid); padding: var(--sk-space-xs) 0; }
.sk-cal-day {
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 500;
  background: none; border: 0; color: inherit; cursor: pointer;
  border-radius: var(--sk-rounded-md);
  transition: background-color var(--sk-motion-micro);
  min-height: 40px;
}
.sk-cal-day:hover { background: var(--sk-surface-press-light); }
.sk-cal-day:disabled { color: var(--sk-hairline-cool); cursor: not-allowed; background: none; }
.sk-cal-day.is-today { box-shadow: inset 0 0 0 1px var(--sk-accent-violet-mid); }
.sk-cal-day[aria-pressed="true"], .sk-cal-day.is-selected { background: var(--sk-primary); color: var(--sk-on-primary); }
/* WCAG touch targets on touch devices */
@media (pointer: coarse) { .sk-cal-day { min-height: 44px; } }

/* ============ TIME SLOT SELECTOR ============ */
.sk-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--sk-space-sm); }
.sk-slot {
  font: inherit; font-size: 14px; font-weight: 500; letter-spacing: 0.2px;
  background: var(--sk-surface-canvas-light); color: var(--sk-ink-deep);
  border: 1px solid var(--sk-hairline-cool);
  border-radius: var(--sk-rounded-md);
  padding: var(--sk-space-sm) var(--sk-space-md);
  min-height: 44px;
  cursor: pointer;
  transition: background-color var(--sk-motion-micro);
}
.sk-slot:hover { background: var(--sk-surface-press-light); }
.sk-slot[aria-pressed="true"] { background: var(--sk-primary); color: var(--sk-on-primary); border-color: var(--sk-primary); }
.sk-slot:disabled { color: var(--sk-hairline-cool); text-decoration: line-through; cursor: not-allowed; background: var(--sk-surface-press-light); }

/* ============ SKELETON LOADER ============ */
.sk-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--sk-surface-press-light);
  border-radius: var(--sk-rounded-md);
  min-height: 16px;
}
.sk-skeleton::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  transform: translateX(-100%);
  animation: sk-shimmer 1.4s infinite;
}
.sk-skeleton-text { height: 14px; }
.sk-skeleton-title { height: 24px; width: 60%; }
.sk-skeleton-avatar { width: 44px; height: 44px; border-radius: var(--sk-rounded-full); }
.sk-skeleton-media { aspect-ratio: 1 / 1; border-radius: var(--sk-rounded-xl); }
@keyframes sk-shimmer { to { transform: translateX(100%); } }

/* ============ TIMELINE (order tracking / consultation history) ============ */
.sk-timeline { list-style: none; margin: 0; padding: 0; }
.sk-timeline li { position: relative; padding: 0 0 var(--sk-space-xl) var(--sk-space-xxl); }
.sk-timeline li::before {
  content: "";
  position: absolute; left: 9px; top: 22px; bottom: 0;
  width: 2px; background: var(--sk-hairline-cloud);
}
.sk-timeline li:last-child::before { display: none; }
.sk-timeline li::after {
  content: "";
  position: absolute; left: 4px; top: 6px;
  width: 12px; height: 12px;
  border-radius: var(--sk-rounded-full);
  background: var(--sk-hairline-cool);
}
.sk-timeline li.is-done::after { background: var(--sk-status-success); }
.sk-timeline li.is-current::after { background: var(--sk-accent-violet-deep); box-shadow: 0 0 0 4px var(--sk-status-info-tint); }
.sk-timeline .sk-timeline-time { font-size: 14px; color: var(--sk-accent-violet-mid); }

/* ============ PROGRESS ============ */
.sk-progress { height: 8px; background: var(--sk-surface-press-light); border-radius: var(--sk-rounded-full); overflow: hidden; }
.sk-progress-bar { height: 100%; background: var(--sk-accent-violet-deep); border-radius: var(--sk-rounded-full); transition: width var(--sk-motion-overlay); }

/* step indicator (checkout) — wraps on narrow screens, connectors hide when wrapped */
.sk-steps { display: flex; align-items: center; gap: var(--sk-space-sm); list-style: none; margin: 0; padding: 0; flex-wrap: wrap; justify-content: center; }
@media (max-width: 575px) { .sk-steps li + li::before { display: none; } }
.sk-steps li { display: flex; align-items: center; gap: var(--sk-space-sm); font-size: 14px; font-weight: 500; }
.sk-step-dot {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--sk-rounded-full);
  border: 1px solid var(--sk-hairline-cool);
  font-size: 12px; font-weight: 700;
}
.sk-steps li.is-done .sk-step-dot { background: var(--sk-status-success); border-color: var(--sk-status-success); color: #fff; }
.sk-steps li.is-current .sk-step-dot { background: var(--sk-primary); border-color: var(--sk-primary); color: var(--sk-on-primary); }
.sk-steps li + li::before { content: ""; width: 32px; height: 1px; background: var(--sk-hairline-cloud); }

/* ============ EMPTY STATE ============ */
.sk-empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--sk-space-md);
  padding: var(--sk-space-section) var(--sk-space-xl);
}
.sk-empty .bi { font-size: 48px; color: var(--sk-accent-violet-mid); }
.sk-empty p { margin: 0; font-weight: 400; line-height: 2.0; color: rgba(31, 22, 51, 0.65); max-width: 42ch; }
