/* Zynoloop — custom styles layered on top of Tailwind (via CDN).
   Keep this file lean: prefer Tailwind utilities in templates. */

[x-cloak] {
  display: none !important;
}
html {
  scroll-behavior: smooth;
  font-size: 16px !important;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
body {
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.6;
  font-weight: 400;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  line-height: 1.15;
  font-weight: 700;
}

/* ── Theme tokens (light / dark) ───────────────────────────────────────── */
:root {
  --zl-bg: #eef2f6;
  --zl-surface: #ffffff;
  --zl-surface-2: #f8fafc;
  --zl-border: #dde4ec;
  --zl-text: #020617;
  --zl-muted: #58708f;
  --zl-glass: #ffffff;
  --zl-glass-brd: rgba(15, 23, 42, 0.08);
  --zl-brand: #4f46e5;
  --zl-brand-soft: rgba(79, 70, 229, 0.1);
  --zl-shadow:
    0 22px 60px -42px rgba(15, 23, 42, 0.8), 0 1px 3px rgba(15, 23, 42, 0.12);
  --zl-shadow-soft:
    0 16px 40px -32px rgba(15, 23, 42, 0.65), 0 1px 2px rgba(15, 23, 42, 0.1);
}

html.dark {
  --zl-bg: #0b1220;
  --zl-surface: #121a2a;
  --zl-surface-2: #172033;
  --zl-border: rgba(226, 232, 240, 0.1);
  --zl-text: #f8fafc;
  --zl-muted: #9fb0c7;
  --zl-glass: #121a2a;
  --zl-glass-brd: rgba(226, 232, 240, 0.12);
  --zl-brand-soft: rgba(99, 102, 241, 0.18);
  --zl-shadow:
    0 22px 60px -40px rgba(0, 0, 0, 0.9), 0 1px 3px rgba(0, 0, 0, 0.42);
  --zl-shadow-soft:
    0 16px 40px -32px rgba(0, 0, 0, 0.85), 0 1px 2px rgba(0, 0, 0, 0.32);
}

.zl-surface {
  background: var(--zl-bg);
}
.zl-card {
  background: var(--zl-surface);
  color: var(--zl-text);
}
.zl-text {
  color: var(--zl-text);
}
.zl-border {
  border-color: var(--zl-border);
}
.zl-aside,
.zl-topbar {
  background: var(--zl-surface);
  border-color: var(--zl-border);
  color: var(--zl-text);
}
.zl-content {
  color: var(--zl-text);
}

.zl-input {
  background: var(--zl-surface);
  color: var(--zl-text);
  border-color: var(--zl-border);
  min-height: 44px;
  border-radius: 14px;
  font-size: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}
.zl-input::placeholder {
  color: var(--zl-muted);
}

.zl-popover {
  background: var(--zl-surface);
  border-color: var(--zl-border);
  color: var(--zl-text);
}

.zl-shell-aside {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.72),
    rgba(255, 255, 255, 0.5)
  );
  border-right: 1px solid rgba(15, 23, 42, 0.04);
  overflow-x: hidden;
}
html.dark .zl-shell-aside {
  background: linear-gradient(
    180deg,
    rgba(18, 26, 42, 0.98),
    rgba(15, 23, 42, 0.98)
  );
  border-right-color: rgba(226, 232, 240, 0.08);
}
.zl-mobile-drawer.zl-shell-aside {
  background: #ffffff;
}
html.dark .zl-mobile-drawer.zl-shell-aside {
  background: #121a2a;
}
.zl-topbar {
  background: rgba(238, 242, 246, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
html.dark .zl-topbar {
  background: rgba(11, 18, 32, 0.9);
}
.zl-search-pill,
.zl-icon-btn,
.zl-account-pill {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: var(--zl-shadow-soft);
}
html.dark .zl-search-pill,
html.dark .zl-icon-btn,
html.dark .zl-account-pill {
  background: rgba(18, 26, 42, 0.92);
  border-color: rgba(226, 232, 240, 0.12);
}
.zl-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  transition:
    transform 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}
.zl-icon-btn:hover {
  color: var(--zl-brand);
  border-color: rgba(79, 70, 229, 0.22);
  transform: translateY(-1px);
}
.zl-primary-pill:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
.zl-primary-pill {
  font-size: 0.95rem;
}
.zl-collapse-expand {
  background: rgba(255, 255, 255, 0.86);
  border-color: rgba(15, 23, 42, 0.08);
  box-shadow: var(--zl-shadow-soft);
}
html.dark .zl-collapse-expand {
  background: rgba(18, 26, 42, 0.92);
  border-color: rgba(226, 232, 240, 0.12);
}

/* ── Sidebar nav ───────────────────────────────────────────────────────── */
.zl-nav-item {
  color: var(--zl-muted);
  font-size: 0.95rem;
}
.zl-shell-aside nav {
  overflow-x: hidden;
  scrollbar-width: thin;
}
.zl-nav-item:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--zl-brand);
}
.zl-nav-active {
  background: #ffffff;
  color: var(--zl-brand);
  font-weight: 800;
  box-shadow: var(--zl-shadow-soft);
}
html.dark .zl-nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
html.dark .zl-nav-active {
  background: rgba(255, 255, 255, 0.08);
  color: #c7d2fe;
}

.zl-tooltip {
  position: absolute;
  left: calc(100% + 0.5rem);
  top: 50%;
  transform: translateY(-50%);
  background: var(--zl-text);
  color: var(--zl-surface);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 50;
}
.zl-nav-item:hover .zl-tooltip {
  opacity: 0;
}

/* ── Glassmorphism card ────────────────────────────────────────────────── */
.zl-card {
  background: var(--zl-glass);
  border: 1px solid var(--zl-glass-brd);
  border-radius: 28px;
  box-shadow: var(--zl-shadow);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}
.zl-card:hover {
  border-color: rgba(79, 70, 229, 0.18);
  box-shadow: var(--zl-shadow);
}
.zl-card.bg-brand {
  background: var(--zl-brand);
  color: #ffffff;
  border-color: rgba(79, 70, 229, 0.2);
}

.zl-content > div,
.zl-page {
  max-width: 1180px;
}
.zl-content header h1,
.zl-page-title {
  font-size: clamp(1.9rem, 2.35vw, 2.75rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 800;
}
.zl-content header p,
.zl-page-subtitle {
  font-size: 1rem;
  line-height: 1.62;
}
.zl-content h2 {
  letter-spacing: -0.015em;
}
.zl-content label {
  color: var(--zl-text);
}
.zl-content button,
.zl-content a {
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}
.zl-content button.bg-brand,
.zl-content a.bg-brand {
  border-radius: 999px;
  box-shadow: 0 18px 36px -22px rgba(79, 70, 229, 0.75);
}
.zl-content button.bg-brand:hover,
.zl-content a.bg-brand:hover {
  transform: translateY(-1px);
}
.zl-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: fit-content;
  border: 1px solid rgba(79, 70, 229, 0.12);
  background: rgba(79, 70, 229, 0.08);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  color: var(--zl-brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.zl-stat-card {
  min-height: 138px;
}
.zl-stat-number {
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.zl-muted-panel {
  background: var(--zl-surface-2);
  border-radius: 22px;
}

/* Dashboard template compatibility layer for existing PHP views. */
.zl-content > .mx-auto {
  max-width: 1180px;
}
.zl-content > .mx-auto.space-y-6,
.zl-content > .mx-auto > .space-y-6,
.zl-content .space-y-6 {
  row-gap: 2rem;
}
.zl-content header:not(.zl-topbar) {
  margin-bottom: 1.5rem;
}
.zl-content header:not(.zl-topbar) > p:first-child:not(.zl-page-subtitle) {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(79, 70, 229, 0.12);
  background: rgba(79, 70, 229, 0.08);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  color: var(--zl-brand);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.zl-content header:not(.zl-topbar) h1 {
  margin-top: 1rem;
  font-size: clamp(1.85rem, 2.25vw, 2.6rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  font-weight: 800;
}
.zl-content header:not(.zl-topbar) h1 + p {
  margin-top: 0.75rem;
  color: var(--zl-muted);
  font-size: 1rem;
  line-height: 1.62;
}
.zl-content .zl-card {
  padding: 1.5rem;
}
.zl-content .zl-card.overflow-hidden {
  padding: 0;
}
.zl-content .zl-card > .border-b {
  padding: 1.25rem 1.5rem;
}
.zl-content .zl-card h2,
.zl-content .zl-card h3 {
  font-size: 1.2rem;
  font-weight: 800;
}
.zl-content input.zl-input,
.zl-content select.zl-input,
.zl-content textarea.zl-input {
  border-radius: 16px;
  padding: 0.78rem 0.95rem;
}
.zl-content textarea.zl-input {
  min-height: 7rem;
}
.zl-content label.text-sm,
.zl-content label .text-xs.uppercase,
.zl-content span.text-xs.uppercase,
.zl-content p.text-xs.uppercase {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.zl-content .divide-y > article,
.zl-content form.border-b,
.zl-content tbody tr {
  transition: background 0.18s ease;
}
.zl-content .divide-y > article:hover,
.zl-content form.border-b:hover,
.zl-content tbody tr:hover {
  background: rgba(79, 70, 229, 0.035);
}
.zl-content table {
  font-size: 0.9rem;
}
.zl-content .rounded-lg {
  border-radius: 14px;
}
.zl-content .rounded-xl {
  border-radius: 18px;
}
.zl-content .rounded-2xl {
  border-radius: 24px;
}
.zl-content .text-sm {
  font-size: 0.9rem;
}
.zl-content .text-xs {
  font-size: 0.75rem;
}
html.dark .zl-content .divide-y > article:hover,
html.dark .zl-content form.border-b:hover,
html.dark .zl-content tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 767px) {
  .zl-mobile-drawer {
    width: min(300px, calc(100vw - 24px));
  }
  .zl-content {
    padding: 1.25rem 1rem 1.75rem !important;
  }
  .zl-page,
  .zl-content > div,
  .zl-content > .mx-auto {
    max-width: 100%;
  }
  .zl-page-title,
  .zl-content header:not(.zl-topbar) h1 {
    font-size: 1.65rem;
    line-height: 1.1;
  }
  .zl-page-subtitle,
  .zl-content header:not(.zl-topbar) h1 + p {
    font-size: 0.94rem;
    line-height: 1.55;
  }
  .zl-content .zl-card {
    padding: 1rem;
    border-radius: 20px;
  }
  .zl-content .zl-card > .border-b {
    padding: 1rem;
  }
  .zl-content .zl-card h2,
  .zl-content .zl-card h3 {
    font-size: 1.08rem;
  }
  .zl-stat-card {
    min-height: 118px;
  }
  .zl-stat-number {
    font-size: 2rem;
  }
  .zl-topbar {
    min-height: 76px;
    height: auto;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
  }
  .zl-search-pill {
    min-height: 44px;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    padding-left: 2.75rem;
    padding-right: 2.25rem;
    font-size: 0.875rem;
  }
  .zl-search-pill + span,
  .zl-search-pill ~ span {
    right: 0.9rem;
  }
  .zl-search-pill ~ div {
    border-radius: 20px;
  }
  .zl-icon-btn {
    width: 2.65rem;
    height: 2.65rem;
    border-radius: 1rem;
  }
  .zl-account-pill {
    padding: 0.25rem;
  }
  .zl-account-pill img,
  .zl-account-pill > div {
    width: 2.45rem;
    height: 2.45rem;
  }
  .zl-content table {
    font-size: 0.84rem;
  }
}

/* Hide native scrollbar on horizontal strips */
.zl-scroll-x {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.zl-scroll-x > * {
  scroll-snap-align: start;
}

/* Settings tab strip — scrollable but no visible scrollbar */
.zl-tabs-strip {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE / Edge legacy */
}
.zl-tabs-strip::-webkit-scrollbar {
  display: none;
} /* Chrome / Safari / Opera */

/* Subtle focus ring used by interactive elements that aren't already covered
   by Tailwind's defaults. */
.focus-ring:focus-visible {
  outline: 2px solid rgb(99 102 241 / 0.6);
  outline-offset: 2px;
}

/* ── Skeleton loaders ──────────────────────────────────────────────────── */
.zl-skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    var(--zl-border) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    var(--zl-border) 100%
  );
  background-size: 200% 100%;
  animation: zl-shimmer 1.4s ease-in-out infinite;
}
html.dark .zl-skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
}
@keyframes zl-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
