/* 10X Water – Icon Rail & Layout Overrides */

/* Colors are driven entirely from the DaisyUI theme tokens (nexus.css):
   - surface  → --color-base-300 (a distinct neutral panel beside base-100 content)
   - text     → --color-base-content (full / reduced via color-mix alpha)
   - accent   → --color-primary (active state, logo, focus ring, indicator bar)
   This keeps the nav on-brand and makes it adapt to every theme automatically,
   instead of the previous hard-coded values that only handled light vs dark. */

/* ── Semantic z-index scale ────────────────────────────────────── */
/* One ordered scale for app chrome, so layers stack predictably instead of
   escalating to arbitrary values like 999999. (DaisyUI's modal sits at 999;
   toasts are placed above it so confirmations are never hidden behind a modal.) */
:root {
  --z-sticky: 10;      /* topbar (set in nexus.css) */
  --z-rail: 40;        /* icon rail */
  --z-bottom-nav: 50;  /* mobile bottom nav */
  --z-modal: 999;      /* DaisyUI modal */
  --z-toast: 1100;     /* flash messages, above modal */
}

/* ── Hide the old nexus sidebar ────────────────────────────────── */
#layout-sidebar,
#layout-sidebar-toggle-trigger,
#layout-sidebar-hover-trigger,
#layout-sidebar-hover,
#layout-sidebar-backdrop {
  display: none !important;
}

/* ── Icon Rail ─────────────────────────────────────────────────── */
.icon-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
  min-width: 72px;
  height: 100vh;
  height: 100dvh;
  background: var(--color-base-300);
  border-inline-end: 1px solid color-mix(in oklab, var(--color-base-content) 8%, transparent);
  padding: 12px 10px;
  gap: 8px;
  z-index: var(--z-rail);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.icon-rail:hover {
  scrollbar-color: color-mix(in oklab, var(--color-base-content) 30%, transparent) transparent;
}

.icon-rail-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  color: var(--color-primary);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.icon-rail-logo:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.icon-rail-divider {
  width: 36px;
  height: 1px;
  background: color-mix(in oklab, var(--color-base-content) 12%, transparent);
  margin: 8px 0;
}

.icon-rail-spacer {
  flex: 1;
}

/* Rail nav items */
.icon-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 56px;
  padding: 6px 0;
  border-radius: 12px;
  color: color-mix(in oklab, var(--color-base-content) 72%, transparent);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.icon-rail-item::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--color-primary);
  opacity: 0;
  transition: opacity 0.15s;
}
.icon-rail-item:hover,
.icon-rail-item:focus-visible {
  background: color-mix(in oklab, var(--color-base-content) 10%, transparent);
  color: var(--color-base-content);
}
.icon-rail-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.icon-rail-item:focus-visible::before {
  opacity: 1;
}
.icon-rail-item.active {
  /* Brand colour is carried by the wash + indicator bar (both --color-primary);
     the text/icon stay neutral so the 12px label keeps its contrast. */
  background: color-mix(in oklab, var(--color-primary) 15%, transparent);
  color: var(--color-base-content);
}
.icon-rail-item.active .icon-rail-label {
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .icon-rail-item,
  .icon-rail-item::before {
    transition: none;
  }
}

.icon-rail-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 56px;
}

/* Icon sizes */
.icon-rail-icon {
  width: 20px;
  height: 20px;
}
.icon-rail-icon-lg {
  width: 24px;
  height: 24px;
}


/* ── App Main (content area alongside icon rail) ───────────────── */
.app-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: auto;
}

.icon-rail-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

/* ── App Shell (flex wrapper for icon rail + main) ───────────── */
.app-shell {
  display: flex;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}

/* ── Bottom Nav (mobile) ─────────────────────────────────────── */
.bottom-nav {
  display: none;
}

.bottom-nav-item-wrapper {
  flex: 1;
  display: flex;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 2px;
  padding: 6px 0;
  color: color-mix(in oklab, var(--color-base-content) 72%, transparent);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item.active {
  color: var(--color-base-content);
  background: color-mix(in oklab, var(--color-primary) 12%, transparent);
}
.bottom-nav-item.active .bottom-nav-label {
  font-weight: 600;
}
.bottom-nav-item:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  border-radius: 8px;
}

.bottom-nav-icon {
  width: 22px;
  height: 22px;
}

.bottom-nav-logo {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.5px;
  line-height: 22px;
  color: var(--color-primary);
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

/* ── Mobile: hide sidebar, show bottom nav ───────────────────── */
@media (max-width: 639px) {
  .icon-rail {
    display: none;
  }

  .app-shell {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
  }

  .app-main {
    height: auto;
    flex: 1;
    min-height: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav {
    display: flex;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--color-base-300);
    border-top: 1px solid color-mix(in oklab, var(--color-base-content) 10%, transparent);
    z-index: var(--z-bottom-nav);
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bottom-nav-item {
    transition: none;
  }
}

/* ── Missing max-width utilities ───────────────────────────────── */
/* The vendored nexus.css is a partial Tailwind build that omitted several base
   max-w-* utilities (the --container-* vars exist, but the classes were never
   emitted). Without these, e.g. `max-w-3xl` is a no-op and content stretches
   full-width — which also lets wide tables overflow the viewport horizontally.
   Restored here against the same container tokens nexus.css already defines. */
.max-w-xl {
  max-width: var(--container-xl);
}
.max-w-3xl {
  max-width: var(--container-3xl);
}
.max-w-5xl {
  max-width: var(--container-5xl);
}
.max-w-6xl {
  max-width: var(--container-6xl);
}
.max-w-7xl {
  max-width: 80rem;
}

/* ── Section Tabs ──────────────────────────────────────────────── */
.section-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
.section-tabs:hover {
  scrollbar-color: color-mix(in oklab, var(--color-base-content) 30%, transparent) transparent;
}
