/* ═══════════════════════════════════════════════════════════════
   LWServers V2 — nav.css
   Mobile: bottom tab bar + top app header
   Desktop: left sidebar
   Requires: base.css
═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────
   APP SHELL
───────────────────────────────────────────────────────────── */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Main content area — offsets for sidebar on desktop */
.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ─────────────────────────────────────────────────────────────
   TOP APP BAR — mobile primary nav element
───────────────────────────────────────────────────────────── */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 56px;
  padding: 0 var(--page-px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  background: var(--glass-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-bottom: 1px solid var(--glass-border);
  /* top shine edge */
  box-shadow: inset 0 1px 0 var(--glass-shine);
}

/* Logo */
.app-bar-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  flex-shrink: 0;
}

.app-bar-logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent), 0 0 20px rgba(0,232,122,0.3);
  flex-shrink: 0;
  animation: pulse-glow 3s ease-in-out infinite;
}

.app-bar-logo-img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(0, 232, 122, 0.25));
}

.app-bar-logo-text {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-1);
}

/* Right side controls */
.app-bar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Theme toggle (sun / moon) */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--glass-bg-3);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.theme-toggle:hover {
  color: var(--text-1);
  border-color: var(--border-2);
  background: var(--hover-overlay);
}
.theme-toggle:active { transform: scale(0.94); }

.theme-icon {
  position: absolute;
  inset: 0;
  margin: auto;
  transition: opacity var(--t-base) var(--ease),
              transform var(--t-base) var(--ease);
}

/* Dark theme → show moon, hide sun */
:root[data-theme="dark"] .theme-icon-sun,
:root:not([data-theme="light"]) .theme-icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}
:root[data-theme="dark"] .theme-icon-moon,
:root:not([data-theme="light"]) .theme-icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Light theme → show sun, hide moon */
:root[data-theme="light"] .theme-icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}
:root[data-theme="light"] .theme-icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
  color: #c87a06;
}

/* Sidebar variant — pill-shaped, has label */
.theme-toggle-sidebar {
  width: 100%;
  height: auto;
  padding: 10px 14px 10px 38px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--glass-bg-3);
  margin-bottom: 8px;
  justify-content: flex-start;
  position: relative;
}
.theme-toggle-sidebar .theme-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  margin: -8px 0 0;       /* recenter — icons are 16px tall */
  inset: auto;
}
.theme-toggle-sidebar .theme-toggle-label { white-space: nowrap; }

/* Segment chip in top bar */
.seg-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.3px;
  padding: 6px 11px;
  border-radius: var(--r-md);
  background: rgba(0, 232, 122, 0.08);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  cursor: pointer;
  transition: background var(--t-base), box-shadow var(--t-base);
  white-space: nowrap;
}

.seg-chip:hover {
  background: rgba(0, 232, 122, 0.14);
  box-shadow: 0 0 12px rgba(0, 232, 122, 0.12);
}

.seg-chip-arrow {
  font-size: 9px;
  opacity: 0.7;
  transition: transform var(--t-base);
}

.seg-chip.open .seg-chip-arrow { transform: rotate(180deg); }

/* ─────────────────────────────────────────────────────────────
   BOTTOM NAV — mobile
───────────────────────────────────────────────────────────── */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 300;
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  display: flex;
  align-items: flex-start;
  padding-top: 6px;
  /* Glass effect */
  background: var(--glass-bg-2);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border-top: 1px solid var(--glass-border-2);
  /* Top shine */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), var(--shadow-lg);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  cursor: pointer;
  position: relative;
  text-decoration: none;
  transition: opacity var(--t-base);
  -webkit-tap-highlight-color: transparent;
}

.nav-tab-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform var(--t-base) var(--ease);
}

/* Active tab background pill */
.nav-tab.active .nav-tab-icon::before {
  content: '';
  position: absolute;
  inset: -6px -14px;
  background: var(--accent-glow-2);
  border-radius: 20px;
  border: 1px solid var(--accent-border);
}

.nav-tab-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-3);
  fill: none;
  stroke-width: 1.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--t-base), transform var(--t-base) var(--ease);
  position: relative;
  z-index: 1;
}

.nav-tab.active .nav-tab-icon svg { stroke: var(--accent); }

.nav-tab:active .nav-tab-icon { transform: scale(0.88); }

.nav-tab-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--t-base);
  font-family: var(--font-ui);
  letter-spacing: 0.2px;
}

.nav-tab.active .nav-tab-label { color: var(--accent); }

/* Active indicator line (top of nav bar) */
.nav-tab::after {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 24px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  transition: transform var(--t-base) var(--ease);
  box-shadow: 0 0 8px var(--accent);
}

.nav-tab.active::after { transform: translateX(-50%) scaleX(1); }

/* ─────────────────────────────────────────────────────────────
   SIDEBAR — desktop
───────────────────────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  display: none;               /* hidden on mobile */
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: var(--blur-md);
  -webkit-backdrop-filter: var(--blur-md);
  border-right: 1px solid var(--glass-border);
  /* Right edge shine */
  box-shadow: inset -1px 0 0 var(--glass-shine);
  z-index: 100;
  overflow: hidden;
}

/* Sidebar ambient glow */
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 200px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,232,122,0.06) 0%, transparent 70%);
  pointer-events: none;
}

/* Sidebar header / logo area */
.sidebar-header {
  padding: 24px 18px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  background: var(--accent-glow-2);
  border: 1px solid var(--accent-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
}

.sidebar-logo-img {
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(0, 232, 122, 0.3));
}

.sidebar-logo-text {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-1);
}

.sidebar-logo-version {
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-top: 1px;
}

/* Sidebar scroll area */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-3) 10px;
  scrollbar-width: none;
}
.sidebar-scroll::-webkit-scrollbar { display: none; }

/* Nav group label */
.sidebar-group-label {
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

/* Sidebar nav item */
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
  white-space: nowrap;
}

.sidebar-item:hover {
  color: var(--text-1);
  background: var(--glass-bg-3);
}

.sidebar-item.active {
  color: var(--accent);
  background: var(--accent-glow-2);
  border: 1px solid var(--accent-border);
}

/* Active left accent bar */
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent);
}

.sidebar-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-item-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Sidebar segment switcher */
.sidebar-segment {
  margin: var(--sp-2) 10px var(--sp-3);
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--accent-glow-2);
  border: 1px solid var(--accent-border);
  cursor: pointer;
  transition: all var(--t-base);
}

.sidebar-segment:hover {
  background: rgba(0, 232, 122, 0.12);
  box-shadow: 0 0 12px rgba(0, 232, 122, 0.1);
}

.sidebar-segment-label {
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 3px;
}

.sidebar-segment-value {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.sidebar-support-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-base);
  text-decoration: none;
}

.sidebar-support-btn:hover {
  color: var(--amber);
  background: var(--amber-glow);
}

/* ─────────────────────────────────────────────────────────────
   SEGMENT BOTTOM SHEET — mobile
───────────────────────────────────────────────────────────── */

.seg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 15, 0.8);
  backdrop-filter: var(--blur-sm);
  -webkit-backdrop-filter: var(--blur-sm);
  z-index: 400;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow) var(--ease);
}

.seg-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.seg-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0 var(--page-px) calc(var(--nav-h) + var(--safe-bottom) + var(--sp-4));
  transform: translateY(100%);
  transition: transform var(--t-slow) var(--ease);
}

.seg-overlay.open .seg-sheet { transform: translateY(0); }

.seg-sheet-inner {
  background: var(--glass-bg-2);
  backdrop-filter: var(--blur-lg);
  -webkit-backdrop-filter: var(--blur-lg);
  border: 1px solid var(--glass-border-2);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  /* Inner shine */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), var(--shadow-xl);
  /* Scrollable when many segments */
  max-height: 70vh;
  display: flex;
  flex-direction: column;
}

.seg-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 0 auto var(--sp-5);
}

.seg-sheet-title {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: var(--sp-2);
}

.seg-sheet-sub {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: var(--sp-5);
  line-height: 1.5;
}

.seg-options { display: flex; flex-direction: column; gap: var(--sp-3); overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

.seg-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-2);
  background: var(--glass-bg);
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
}

.seg-option:hover { border-color: var(--border-3); }

.seg-option.active {
  border-color: var(--accent-border);
  background: var(--accent-glow-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 16px rgba(0,232,122,0.08);
}

.seg-option-range {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.3px;
}

.seg-option.active .seg-option-range { color: var(--accent); }

.seg-option-meta {
  font-family: var(--font-data);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 3px;
}

.seg-option-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

/* ─────────────────────────────────────────────────────────────
   "MORE" SHEET (mobile) — all-pages grid inside a seg-sheet
───────────────────────────────────────────────────────────── */

/* The More tab is a <button>; strip UA button chrome so it matches
   its sibling <a class="nav-tab"> elements. */
button.nav-tab {
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  padding: 4px 0;
}

.more-scroll {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
  padding-bottom: var(--sp-4);
}

.more-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: var(--sp-3);
  border-radius: var(--r-lg);
  border: 1px solid var(--border-2);
  background: var(--glass-bg);
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease);
}

.more-search:hover { border-color: var(--border-3); }

.more-search svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9px;
  stroke-linecap: round;
}

.more-group-label {
  margin: var(--sp-4) 0 var(--sp-2);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  font-size: 10px;
}

.more-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.more-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 4px 11px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-2);
  background: var(--glass-bg);
  text-decoration: none;
  transition: all var(--t-base) var(--ease);
}

.more-tile:hover { border-color: var(--border-3); }

.more-tile.active {
  border-color: var(--accent-border);
  background: var(--accent-glow-2);
}

.more-tile-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-2);
  fill: none;
  stroke-width: 1.8px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.more-tile.active .more-tile-icon svg { stroke: var(--accent); }

.more-tile-label {
  font-family: var(--font-data);
  font-size: 10.5px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.2;
}

.more-tile.active .more-tile-label { color: var(--accent); }

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE — show sidebar, hide bottom nav on desktop
───────────────────────────────────────────────────────────── */

@media (min-width: 769px) {
  .sidebar    { display: flex; }
  .bottom-nav { display: none; }
  .app-bar    { display: none; }   /* sidebar has its own logo */

  /* Desktop content gets sidebar offset */
  .app-content { padding-left: 0; }

  /* Desktop page padding */
  .px-page { padding-left: var(--page-px-desk); padding-right: var(--page-px-desk); }
  .sec-label { padding: 0 var(--page-px-desk); }
  .h-scroll { padding: 0 var(--page-px-desk); }

  /* No bottom padding needed on desktop */
  .mobile-pb { padding-bottom: var(--sp-10); }

  /* Floating coffee is mobile-only — sidebar already has Support link */
  .coffee-fab { display: none; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
}

/* ─────────────────────────────────────────────────────────────
   FLOATING COFFEE FAB (mobile) — smoking cup
───────────────────────────────────────────────────────────── */
.coffee-fab {
  position: fixed;
  right: 14px;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(140deg, #2a1d12, #1a120a 60%, #0e0905);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #f5b454;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 350;
  text-decoration: none;
  box-shadow:
    0 6px 18px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(245, 158, 11, 0.15) inset,
    0 0 22px rgba(245, 158, 11, 0.15);
  transition: transform var(--t-base) var(--ease),
              box-shadow var(--t-base) var(--ease),
              border-color var(--t-base) var(--ease);
  animation: coffee-bob 4.5s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.coffee-fab:hover,
.coffee-fab:focus-visible {
  transform: translateY(-2px) scale(1.04);
  border-color: rgba(245, 158, 11, 0.75);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(245, 158, 11, 0.3) inset,
    0 0 30px rgba(245, 158, 11, 0.32);
  outline: none;
}

.coffee-fab:active { transform: translateY(0) scale(0.97); }

.coffee-cup {
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.35));
}

/* Steam — three rising wisps */
.coffee-steam {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 4px);
  transform: translateX(-50%);
  width: 24px;
  height: 28px;
  pointer-events: none;
}

.coffee-vapor {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 220, 0.85), rgba(255, 240, 220, 0));
  opacity: 0;
  filter: blur(1px);
  transform: translateX(-50%);
  animation: coffee-vapor 2.8s ease-in-out infinite;
}

.coffee-vapor-1 { left: 30%; animation-delay: 0s;   }
.coffee-vapor-2 { left: 50%; animation-delay: 0.8s; }
.coffee-vapor-3 { left: 70%; animation-delay: 1.5s; }

@keyframes coffee-vapor {
  0%   { opacity: 0;    transform: translate(-50%, 4px)   scale(0.6); }
  25%  { opacity: 0.85; transform: translate(-30%, -6px)  scale(1);   }
  50%  { opacity: 0.7;  transform: translate(-70%, -14px) scale(1.3); }
  75%  { opacity: 0.4;  transform: translate(-30%, -22px) scale(1.6); }
  100% { opacity: 0;    transform: translate(-50%, -30px) scale(2);   }
}

@keyframes coffee-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .coffee-fab   { animation: none; }
  .coffee-vapor { animation: none; opacity: 0.4; }
}
/* ── "hot" badge — flagship page highlight (sidebar + More sheet) ── */
.nav-hot {
  margin-left: 8px;
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1c1204;
  background: linear-gradient(120deg, #ffd98a, #f0b445);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}
.more-tile { position: relative; }   /* anchor for .nav-hot-tile */
.nav-hot-tile {
  position: absolute;
  top: 6px;
  right: 6px;
  margin: 0;
  padding: 2px 5px;
}
.nav-hot-bare {                 /* sidebar: crown only, no pill */
  background: none;
  padding: 0;
  font-size: 12px;
  filter: drop-shadow(0 0 6px rgba(240, 180, 69, 0.6));
}
