/*
 * Sprint UI/UX 1: mobile-first rendering hotfix.
 * Shared by all static frontend pages. Keep this file UI-only.
 */
:root {
  --app-font-family: Inter, Roboto, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --app-safe-top: env(safe-area-inset-top, 0px);
  --app-safe-right: env(safe-area-inset-right, 0px);
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-safe-left: env(safe-area-inset-left, 0px);
  --app-backdrop: rgba(15, 23, 42, 0.58);
  --app-backdrop-strong: rgba(2, 6, 23, 0.68);
  --app-surface: #ffffff;
  --app-surface-soft: rgba(255, 255, 255, 0.96);
  --app-border-soft: rgba(148, 163, 184, 0.24);
  --app-sheet-radius: 22px;
  --app-sheet-shadow: 0 -22px 52px rgba(15, 23, 42, 0.28);
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  max-width: 100%;
}

body,
button,
input,
select,
textarea {
  font-family: var(--app-font-family) !important;
  font-synthesis-weight: none;
}

body {
  overflow-x: clip;
}

img,
video,
canvas,
svg,
iframe {
  max-width: 100%;
}

button,
[role="button"],
.btn,
.button,
.cta,
.nav-tab,
.quick-btn,
.chip,
.tab,
.sub-tab,
.action-btn,
.filter-btn,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  touch-action: manipulation;
}

.modal-overlay,
.overlay,
.popup-overlay,
.drawer-overlay,
.co-overlay,
.mc-overlay,
.pd-modal,
.pd-action-sheet,
.pd-cart-overlay,
.tm-modal-overlay,
.aip-library-overlay,
.dialog-backdrop,
.session-panel-overlay,
.menu-overlay {
  background: var(--app-backdrop) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal,
.modal-content,
.dialog-shell,
.co-modal,
.co-content,
.aip-library-modal,
.tm-modal,
.pd-modal-card,
.pd-sheet-panel,
.menu-sheet,
.session-panel,
.product-sheet {
  background-color: var(--app-surface-soft) !important;
  color: inherit;
  border-color: var(--app-border-soft);
  overflow-wrap: anywhere;
}

.mobile-sheet-open {
  overflow: hidden !important;
  touch-action: none;
}

@media (max-width: 768px) {
  body {
    min-width: 0;
    padding-left: var(--app-safe-left);
    padding-right: var(--app-safe-right);
  }

  button,
  [role="button"],
  .btn,
  .button,
  .cta,
  .nav-tab,
  .quick-btn,
  .chip,
  .tab,
  .sub-tab,
  .action-btn,
  .filter-btn,
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    min-height: 44px !important;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .modal-overlay,
  .overlay,
  .popup-overlay,
  .drawer-overlay,
  .co-overlay,
  .pd-modal,
  .pd-action-sheet,
  .tm-modal-overlay,
  .aip-library-overlay,
  .dialog-backdrop,
  .session-panel-overlay,
  .menu-overlay {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: max(10px, var(--app-safe-top)) 0 0 !important;
    z-index: 10000 !important;
  }

  .mobile-sheet-overlay {
    display: flex !important;
  }

  .modal-overlay > .modal,
  .overlay > .modal,
  .popup-overlay > .popup,
  .drawer-overlay > .drawer,
  .co-overlay > .co-modal,
  .co-overlay > .co-content,
  .tm-modal-overlay > .tm-modal,
  .aip-library-overlay > .aip-library-modal,
  .dialog-backdrop > .dialog-shell,
  .session-panel-overlay > .session-panel,
  .menu-overlay > .menu-sheet,
  .pd-modal > .pd-modal-card,
  .pd-action-sheet > .pd-sheet-panel,
  .mobile-bottom-sheet {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(92dvh - var(--app-safe-top)) !important;
    margin: 0 !important;
    border-radius: var(--app-sheet-radius) var(--app-sheet-radius) 0 0 !important;
    box-shadow: var(--app-sheet-shadow) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding-bottom: max(16px, var(--app-safe-bottom)) !important;
  }

  .mobile-bottom-sheet::before,
  .modal-overlay > .modal::before,
  .overlay > .modal::before,
  .co-overlay > .co-modal::before,
  .co-overlay > .co-content::before,
  .tm-modal-overlay > .tm-modal::before,
  .aip-library-overlay > .aip-library-modal::before,
  .dialog-backdrop > .dialog-shell::before,
  .pd-modal > .pd-modal-card::before,
  .pd-action-sheet > .pd-sheet-panel::before {
    content: "";
    display: block;
    width: 44px;
    height: 5px;
    margin: 10px auto 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.55);
    flex: 0 0 auto;
  }

  .mc-overlay,
  .pd-cart-overlay {
    background: var(--app-backdrop-strong) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 10000 !important;
  }

  .mc-drawer,
  .pd-cart-drawer {
    top: auto !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(92dvh - var(--app-safe-top)) !important;
    border-radius: var(--app-sheet-radius) var(--app-sheet-radius) 0 0 !important;
    box-shadow: var(--app-sheet-shadow) !important;
    transform: translateY(105%) !important;
    transition: transform 0.24s ease !important;
    z-index: 10001 !important;
    padding-bottom: var(--app-safe-bottom) !important;
  }

  .mc-drawer.open,
  .pd-cart-drawer.is-open {
    transform: translateY(0) !important;
  }

  .booking-topbar,
  .main-header,
  .chat-header,
  .pos-topbar,
  .header,
  nav {
    padding-left: max(12px, var(--app-safe-left)) !important;
    padding-right: max(12px, var(--app-safe-right)) !important;
  }

  .input-area,
  .app-bottom-nav,
  .menu-sheet-footer,
  .pd-sheet-footer,
  .mc-footer,
  .co-actions,
  .cart-footer,
  .sticky-actions {
    padding-bottom: max(12px, var(--app-safe-bottom)) !important;
  }

  .table-wrap,
  .data-table,
  table,
  pre,
  code {
    max-width: 100%;
  }

  .table-wrap,
  .data-table,
  pre {
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Progressive Disclosure / Declutter UI */
.pd-accordion {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
  overflow: hidden;
}

.pd-accordion > summary {
  min-height: 44px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 800;
  color: var(--text, #0f172a);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.pd-accordion > summary::-webkit-details-marker {
  display: none;
}

.pd-accordion > summary::before {
  content: "+";
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 900;
  flex: 0 0 auto;
}

.pd-accordion[open] > summary::before {
  content: "−";
}

.pd-accordion-body {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.pd-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 5px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
  font-weight: 900;
  cursor: help;
}

.pd-tip:hover::after,
.pd-tip:focus::after {
  content: attr(data-tip);
  position: absolute;
  z-index: 10020;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  width: min(260px, 78vw);
  padding: 9px 10px;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.22);
}

.pd-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 42px 18px;
  border: 1px dashed rgba(148, 163, 184, 0.42);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.94));
  color: var(--text2, #64748b);
}

.pd-empty-state .pd-empty-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.pd-empty-state h3 {
  margin: 0 0 8px;
  color: var(--text, #0f172a);
  font-size: 18px;
}

.pd-empty-state p {
  margin: 0 auto 16px;
  max-width: 420px;
  font-size: 14px;
  line-height: 1.55;
}
