@import url('https://fonts.googleapis.com/css2?family=Bai+Jamjuree:wght@600;700;800&family=Sarabun:wght@400;500;600;700&display=swap');

/*
 * CONSTAFI UX compatibility layer
 * Loaded after page styles so the multi-page app shares one visual language
 * without changing its PHP/JS contracts.
 */
:root {
  --ux-primary: #1e3a8a;
  --ux-primary-strong: #172554;
  --ux-primary-soft: #eef2ff;
  --ux-signal: #0369a1;
  --ux-bg: #f8fafc;
  --ux-surface: #ffffff;
  --ux-ink: #0f172a;
  --ux-muted: #64748b;
  --ux-line: #e2e8f0;
  --ux-success: #15803d;
  --ux-warning: #a16207;
  --ux-danger: #b91c1c;
  --ux-radius-sm: 8px;
  --ux-radius-md: 12px;
  --ux-radius-lg: 16px;
  --ux-shadow-card: 0 6px 20px rgba(2, 6, 23, .045);
  --ux-shadow-overlay: 0 20px 48px rgba(2, 6, 23, .24);
  --ux-ring: 0 0 0 4px rgba(30, 58, 138, .16);
  --ux-content: 1180px;

  /* Compatibility aliases used throughout legacy page CSS. */
  --primary: var(--ux-primary);
  --primary-ink: var(--ux-primary-strong);
  --navy-900: var(--ux-primary-strong);
  --navy-800: #1e3a8a;
  --navy-700: #274690;
  --navy: var(--ux-primary);
  --royal: var(--ux-primary);
  --gold: var(--ux-primary);
  --gold-2: #274690;
  --gold-soft: #c7d2fe;
  --blue-900: var(--ux-primary-strong);
  --blue-800: var(--ux-primary);
  --blue-700: #274690;
  --blue-500: #3b5baa;
  --blue-400: #6479bd;
  --blue-200: #c7d2fe;
  --blue-100: #e0e7ff;
  --blue-50: var(--ux-primary-soft);
  --cs-blue-900: var(--ux-primary-strong);
  --cs-blue-800: var(--ux-primary);
  --cs-blue-700: #274690;
  --serif: 'Bai Jamjuree', 'Noto Sans Thai', sans-serif;
  --sans: 'Sarabun', 'Noto Sans Thai', system-ui, sans-serif;
  color-scheme: light;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  background: var(--ux-bg);
  color: var(--ux-ink);
  font-family: var(--sans) !important;
  font-size: 1rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6,
.title,
.h,
.panel-title,
.topbar-title,
.cs-title,
.stat-num,
.cs-stat-value {
  color: var(--ux-ink);
  font-family: var(--serif) !important;
  letter-spacing: -.01em;
}

p,
li,
td,
th,
label,
input,
select,
textarea,
button,
a {
  line-height: 1.55;
}

a,
button,
input,
select,
textarea,
[tabindex]:not([tabindex='-1']) {
  -webkit-tap-highlight-color: transparent;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--ux-primary);
  outline-offset: 2px;
  box-shadow: var(--ux-ring);
}

:where(button, .btn, .chip, .tab, .preset, .pgtab, .stab, .cartbtn) {
  min-height: 44px;
  border-radius: var(--ux-radius-md);
  font-family: var(--sans) !important;
  font-weight: 600;
}

:where(input:not([type='checkbox']):not([type='radio']), select, textarea, .input, .select, .form-input) {
  min-height: 44px;
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-md);
  background: var(--ux-surface);
  color: var(--ux-ink);
  font-size: .9375rem;
}

:where(input, select, textarea)::placeholder {
  color: #64748b;
  opacity: 1;
}

:where(input, select, textarea):disabled,
:where(button, .btn):disabled {
  cursor: not-allowed;
  opacity: .62;
}

:where(.card, .panel, .stat-card, .cs-stat, .scard, .pg-card) {
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-lg);
  background: var(--ux-surface);
  box-shadow: var(--ux-shadow-card);
}

:where(.muted, .sub, .panel-sub, .stat-label, .cs-stat-label) {
  color: var(--ux-muted) !important;
}

:where(.badge, [class*='badge']) {
  gap: 5px;
  line-height: 1.35;
}

:where(.btn.primary, .btn.brand, .btn-primary, .btn.solid, .acct-login) {
  border-color: var(--ux-primary) !important;
  background: var(--ux-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}

:where(.btn.primary, .btn.brand, .btn-primary, .btn.solid, .acct-login):hover {
  background: var(--ux-primary-strong) !important;
  border-color: var(--ux-primary-strong) !important;
}

.btn.gold {
  border-color: var(--ux-primary) !important;
  background: var(--ux-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}

.btn.gold:hover {
  border-color: var(--ux-primary-strong) !important;
  background: var(--ux-primary-strong) !important;
}

:where(.btn.outline, .btn-ghost, .btn.ghost) {
  border: 1px solid var(--ux-line) !important;
  background: #fff !important;
  color: var(--ux-primary) !important;
}

:where(.modal, .drawer, .mmenu) [role='dialog'],
:where(.modal-card, .drawer > .panel, .modal .card) {
  border-radius: var(--ux-radius-lg);
  box-shadow: var(--ux-shadow-overlay);
}

/* Public navigation ------------------------------------------------------- */
.ubar {
  background: var(--ux-primary-strong) !important;
}

.nav {
  z-index: 20 !important;
  border-bottom: 1px solid var(--ux-line) !important;
  box-shadow: 0 2px 10px rgba(2, 6, 23, .035);
}

.nav::after {
  height: 1px !important;
  background: var(--ux-primary) !important;
}

.nav .wrap {
  width: 100%;
  min-width: 0;
}

.nav .brand {
  min-width: 0;
}

.nav .brand .bt,
.nav .brand .t {
  color: var(--ux-ink) !important;
  font-family: var(--serif) !important;
}

.nav .brand .bs {
  color: var(--ux-muted) !important;
}

.nav .links a:hover,
.nav .links a.active {
  color: var(--ux-primary) !important;
  border-bottom-color: var(--ux-primary) !important;
}

.nav .burger,
.cartbtn,
.acct-btn {
  min-width: 44px;
  min-height: 44px;
  border-color: var(--ux-line) !important;
  color: var(--ux-primary) !important;
}

.acct-av {
  background: var(--ux-primary) !important;
}

.acct-menu {
  z-index: 30 !important;
  border-color: var(--ux-line) !important;
  border-radius: var(--ux-radius-md) !important;
  box-shadow: var(--ux-shadow-overlay) !important;
}

/* Home keeps its photographic hero, but uses the product palette for UI. */
.hero .kick,
.hero h1 .g,
.hero .feat .fi {
  color: #bfdbfe !important;
}

.hero .kick::before {
  background: #bfdbfe !important;
}

.hero .hero-mask::after {
  border-color: rgba(255, 255, 255, .24) !important;
}

.hero .hero-mask {
  background: rgba(15, 23, 42, .68) !important;
}

.hero .btn.gold {
  border-color: #fff !important;
  background: #fff !important;
  color: var(--ux-primary-strong) !important;
}

.hero .btn.gold:hover {
  background: #eff6ff !important;
}

.shead {
  padding-left: 0 !important;
  border-left: 0 !important;
}

.shead::before {
  content: '';
  width: 32px;
  height: 2px;
  margin-right: 12px;
  align-self: flex-start;
  margin-top: 10px;
  background: var(--ux-primary);
}

.panel .ph {
  border-bottom-width: 1px !important;
  border-bottom-color: var(--ux-line) !important;
}

/* Authentication and registration: opaque, legible surfaces instead of glass. */
:where(.main-container, .login-container) {
  background: rgba(15, 23, 42, .56) !important;
  backdrop-filter: none !important;
}

.bg-slider .slide {
  transform: none !important;
  transition: opacity .6s ease !important;
}

:where(.main-container, .login-container) .glass-card {
  border: 1px solid var(--ux-line) !important;
  border-radius: var(--ux-radius-lg) !important;
  background: #fff !important;
  color: var(--ux-ink) !important;
  box-shadow: var(--ux-shadow-overlay) !important;
  backdrop-filter: none !important;
}

.main-container .card-header {
  border-bottom: 1px solid var(--ux-line) !important;
  background: #f8fafc !important;
}

:where(.main-container, .login-container) h1 {
  background: none !important;
  color: var(--ux-ink) !important;
  font-family: var(--serif) !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: currentColor !important;
}

:where(.main-container, .login-container) :where(p.desc, label, .links, .links a) {
  color: var(--ux-muted) !important;
}

.main-container .section-title {
  color: var(--ux-primary) !important;
  font-family: var(--serif) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.main-container .section-title::after {
  background: var(--ux-line) !important;
}

:where(.main-container, .login-container) .input-glass {
  border: 1px solid var(--ux-line) !important;
  background-color: #fff !important;
  color: var(--ux-ink) !important;
}

:where(.main-container, .login-container) .input-glass:focus {
  border-color: var(--ux-primary) !important;
  background-color: #fff !important;
  box-shadow: var(--ux-ring) !important;
}

.main-container select.input-glass option {
  background: #fff !important;
  color: var(--ux-ink) !important;
}

:where(.main-container, .login-container) .btn-submit {
  min-height: 48px;
  border-radius: var(--ux-radius-md) !important;
  background: var(--ux-primary) !important;
  box-shadow: none !important;
}

:where(.main-container, .login-container) .btn-submit:hover {
  background: var(--ux-primary-strong) !important;
  transform: none !important;
}

.main-container .btn-outline {
  min-height: 46px;
  border-color: var(--ux-line) !important;
  color: var(--ux-primary) !important;
}

/* Standalone sign-in page. */
.login-panel .glass-card {
  border: 1px solid var(--ux-line) !important;
  border-radius: var(--ux-radius-lg) !important;
  background: #fff !important;
  box-shadow: var(--ux-shadow-overlay) !important;
}

.login-panel .logo-ring {
  border: 1px solid var(--ux-line) !important;
  background: var(--ux-primary-soft) !important;
  box-shadow: none !important;
  animation: none !important;
}

.login-panel .card-title {
  color: var(--ux-ink) !important;
  font-family: var(--serif) !important;
}

.login-panel :where(.input-label, .links a) {
  color: var(--ux-primary) !important;
}

.login-panel .input-field {
  min-height: 46px;
  border: 1px solid var(--ux-line) !important;
  border-radius: var(--ux-radius-md) !important;
  background: #fff !important;
  color: var(--ux-ink) !important;
}

.login-panel .input-field:focus {
  border-color: var(--ux-primary) !important;
  box-shadow: var(--ux-ring) !important;
}

.login-panel .btn-login {
  min-height: 48px;
  border-radius: var(--ux-radius-md) !important;
  background: var(--ux-primary) !important;
  box-shadow: none !important;
  font-family: var(--sans) !important;
}

.login-panel .btn-login:hover {
  background: var(--ux-primary-strong) !important;
  transform: none !important;
}

body > .ad-overlay {
  background: rgba(2, 6, 23, .42) !important;
}

body > .ad-slider .slide-fallback {
  background: var(--ux-primary-strong) !important;
}

/* Member identity card: institutional and restrained inside the app. */
.mcard {
  border-color: rgba(255, 255, 255, .18) !important;
  background: var(--ux-primary) !important;
  box-shadow: var(--ux-shadow-card) !important;
}

.mcard::before,
.mcard::after {
  display: none !important;
}

.mcard-chip {
  background: rgba(255, 255, 255, .9) !important;
  box-shadow: none !important;
}

.mcard :where(.mcard-club-sub, .mcard-code) {
  color: #dbeafe !important;
}

.head {
  background-color: var(--ux-primary) !important;
  background-image: none !important;
}

.head::after {
  border-color: rgba(255, 255, 255, .18) !important;
}

.slide-counter,
.nav-btn {
  backdrop-filter: none !important;
}

.mmenu {
  z-index: 40 !important;
}

/* Admin shell ------------------------------------------------------------- */
body > :where(.sidebar, .cs-sidebar) {
  z-index: 30 !important;
  background: var(--ux-primary-strong) !important;
  box-shadow: 4px 0 18px rgba(2, 6, 23, .14) !important;
  transition: transform .2s ease;
}

body > :where(.sidebar, .cs-sidebar) :where(.sidebar-name, .cs-brand-name),
body > :where(.sidebar, .cs-sidebar) :where(.nav-section, .cs-nav-section) {
  font-family: var(--serif) !important;
}

body > :where(.sidebar, .cs-sidebar) :where(.nav-item, .cs-nav-item) {
  min-height: 44px;
  border-radius: 10px;
  color: rgba(255, 255, 255, .8);
  font-family: var(--sans) !important;
}

body > :where(.sidebar, .cs-sidebar) :where(.nav-item, .cs-nav-item).active {
  background: rgba(255, 255, 255, .14) !important;
  box-shadow: none !important;
  color: #fff !important;
}

:where(.main, .cs-main) > :where(.topbar, .cs-topbar) {
  z-index: 20 !important;
  min-height: 68px;
  border-bottom-color: var(--ux-line) !important;
  box-shadow: 0 1px 10px rgba(2, 6, 23, .04) !important;
}

.main .hero {
  background: var(--ux-primary) !important;
}

.main .hero::before {
  display: none !important;
}

.stats-grid .stat-card {
  border-top: 1px solid var(--ux-line) !important;
}

:where(.pgtab, .stab, .preset, .filter-tab, .chip, .tab).active {
  border-color: var(--ux-primary) !important;
  background: var(--ux-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}

:where(.scard, .admin-card, .order-card) {
  border-top-color: var(--ux-line) !important;
  border-top-width: 1px !important;
}

:where(.modal, .drawer, .pp-lb) {
  z-index: 50 !important;
}

:where(.empty, .state, .bookings-empty, .pg-empty) {
  min-height: 150px;
  padding: 28px 18px;
  border: 1px dashed var(--ux-line) !important;
  border-radius: var(--ux-radius-md) !important;
  background: #fff !important;
  color: var(--ux-muted) !important;
  text-align: center;
}

:where(.topbar-title, .cs-title) {
  color: var(--ux-ink) !important;
  font-size: 1.25rem !important;
}

.admin-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-md);
  background: #fff;
  color: var(--ux-primary);
  cursor: pointer;
}

.admin-menu-toggle svg {
  width: 22px;
  height: 22px;
}

.admin-shell-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  display: none;
  background: rgba(2, 6, 23, .55);
}

.admin-shell-backdrop.is-open {
  display: block;
}

/* Tables and async states ------------------------------------------------- */
.table-wrap {
  border-radius: var(--ux-radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  color: var(--ux-ink);
}

thead th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-family: var(--sans) !important;
  font-size: .8125rem !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

tbody td {
  border-color: var(--ux-line) !important;
}

.ux-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 180px;
  padding: 32px 20px;
  place-content: center;
  text-align: center;
}

.ux-state__icon {
  display: grid;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ux-primary-soft);
  color: var(--ux-primary);
  place-items: center;
}

.ux-state__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  font-weight: 700;
}

.ux-state__body {
  max-width: 48ch;
  margin: 0;
  color: var(--ux-muted);
}

/* Toasts and confirmations ------------------------------------------------ */
.ux-toast-host {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  width: min(380px, calc(100vw - 36px));
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.ux-toast {
  padding: 13px 16px;
  transform: translateY(8px);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-md);
  background: #fff;
  color: var(--ux-ink);
  box-shadow: var(--ux-shadow-overlay);
  font-family: var(--sans);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.5;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

.ux-toast.is-visible { transform: none; opacity: 1; }
.ux-toast--success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.ux-toast--warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.ux-toast--error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.ux-toast--info { border-color: #bfdbfe; background: #eff6ff; color: #1e3a8a; }

.ux-confirm {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(2, 6, 23, .58);
  opacity: 0;
  transition: opacity .16s ease;
}

.ux-confirm.is-visible { opacity: 1; }

.ux-confirm__card {
  width: min(440px, 100%);
  padding: 26px;
  transform: translateY(8px);
  border: 1px solid var(--ux-line);
  border-radius: var(--ux-radius-lg);
  background: #fff;
  box-shadow: var(--ux-shadow-overlay);
  text-align: center;
  transition: transform .16s ease;
}

.ux-confirm.is-visible .ux-confirm__card { transform: none; }

.ux-confirm__icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #fef3c7;
  color: #92400e;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 800;
  place-items: center;
}

.ux-confirm__title { margin: 0; font-size: 1.25rem; }
.ux-confirm__body { margin: 8px auto 22px; color: var(--ux-muted); }
.ux-confirm__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn.danger { border-color: var(--ux-danger) !important; background: var(--ux-danger) !important; color: #fff !important; }
.btn.danger:hover { background: #991b1b !important; }

@media (max-width: 1160px) {
  .nav .wrap {
    gap: 10px !important;
  }

  .nav .brand {
    flex: 1 1 auto;
    overflow: hidden;
  }

  .nav .brand > div {
    min-width: 0;
  }

  .nav .brand .bt,
  .nav .brand .t,
  .nav .brand .bs {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .shop-tools {
    flex: 0 0 auto;
    margin-left: auto;
  }
}

@media (max-width: 900px) {
  .ubar {
    display: none !important;
  }

  .nav .wrap {
    height: 68px !important;
    padding: 0 12px !important;
  }

  .nav .brand {
    gap: 8px !important;
  }

  .nav .brand img {
    width: 42px !important;
    height: 42px !important;
    border-width: 1px !important;
  }

  .nav .brand .bt,
  .nav .brand .t {
    display: -webkit-box;
    font-size: .875rem !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .nav .brand .bs {
    display: none !important;
  }

  .nav .burger {
    display: inline-flex !important;
    flex: 0 0 44px;
    margin-left: 0 !important;
  }

  .shop-tools {
    gap: 4px !important;
  }

  .shop-tools .cartbtn {
    width: 44px;
    padding: 0 !important;
    justify-content: center;
  }

  .shop-tools .lbl-wide {
    display: none !important;
  }

  body > :where(.sidebar, .cs-sidebar) {
    width: min(300px, 86vw) !important;
    transform: translateX(-105%) !important;
  }

  body > :where(.sidebar, .cs-sidebar).is-open {
    transform: translateX(0) !important;
  }

  :where(.main, .cs-main) {
    margin-left: 0 !important;
  }

  :where(.main, .cs-main) > :where(.topbar, .cs-topbar) {
    flex-wrap: nowrap !important;
    padding: 10px 16px !important;
  }

  .main > .topbar .topbar-title {
    flex: 1 1 auto;
    white-space: nowrap;
  }

  .main > .topbar .topbar-right {
    display: none !important;
  }

  :where(.topbar-title, .cs-title) {
    min-width: 0;
    font-size: 1.0625rem !important;
  }

  :where(.topbar-title, .cs-title) > span {
    display: none;
  }

  .admin-menu-toggle {
    display: inline-flex;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  .stats-grid .stat-card {
    min-width: 0;
    padding: 14px !important;
  }

  .stats-grid .stat-icon {
    width: 40px !important;
    height: 40px !important;
  }

  :where(.content, main.container) {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  :where(.card, .panel) {
    padding: 18px;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
    min-width: 0 !important;
  }

  .responsive-table tr {
    margin-bottom: 12px;
    padding: 8px 14px;
    border: 1px solid var(--ux-line);
    border-radius: var(--ux-radius-md);
    background: #fff;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) 1fr;
    gap: 12px;
    padding: 9px 0 !important;
    border-bottom: 1px solid var(--ux-line);
  }

  .responsive-table td:last-child {
    border-bottom: 0;
  }

  .responsive-table td::before {
    content: attr(data-th);
    color: var(--ux-muted);
    font-weight: 600;
  }
}

@media (max-width: 420px) {
  .nav .brand img {
    width: 38px !important;
    height: 38px !important;
  }

  .nav .brand .bt,
  .nav .brand .t {
    font-size: .8125rem !important;
  }

  .shop-tools .cartbtn {
    width: 40px;
    min-width: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
