/* ══════════════════════════════════════════════════════
   JANE'S HOME - Left Sidebar Navigation
   Slim sidebar with collapsible groups, tiered sizing.
   ══════════════════════════════════════════════════════ */

/* ── Background effects: removed grid + sweep ── */
.bg-grid { display: none; }
.sweep { display: none; }

/* ── Sidebar container ── */
#site-nav {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 48px;
  z-index: 1000;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  transition: width 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
}
#site-nav:hover {
  width: 200px;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.4);
}

/* ── Inner sidebar ── */
.nav-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: rgba(22, 22, 27, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border-dim, rgba(255,255,255,0.05));
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}
.nav-sidebar::-webkit-scrollbar { width: 4px; }
.nav-sidebar::-webkit-scrollbar-track { background: transparent; }
.nav-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }
#site-nav:hover .nav-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }

/* ── Brand ── */
.nav-brand {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 0 0 14px;
  text-decoration: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-dim, rgba(255,255,255,0.05));
}
.nav-brand-text {
  font-family: 'DM Serif Display', Georgia, serif;
  font-size: 1.1rem;
  color: var(--text-1, #d4d1ca);
  letter-spacing: 0.02em;
  font-weight: 400;
  white-space: nowrap;
  transition: color 0.2s;
}
.nav-brand:hover .nav-brand-text { color: var(--amber, #c4a060); }

/* ── Group labels ── */
.nav-group-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted, #5e5c56);
  margin: 0.3rem 0 0;
  padding: 0 14px;
  height: 1.1rem;
  min-height: 1.1rem;
  opacity: 0;
  transition: opacity 0.2s ease 0s;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  flex-shrink: 0;
}
#site-nav:hover .nav-group-label {
  opacity: 1;
  transition: opacity 0.2s ease 0.15s;
}

/* Color-coded group labels */
.nav-group-label[data-group="living"]  { color: rgba(255, 158, 205, 0.7); }  /* sakura */
.nav-group-label[data-group="home"]    { color: rgba(196, 160, 96, 0.7); }   /* amber */
.nav-group-label[data-group="explore"] { color: rgba(142, 176, 204, 0.7); }  /* blue */
.nav-group-label[data-group="system"]  { color: rgba(143, 163, 135, 0.7); }  /* green */

/* Chevron */
.nav-group-label .group-chevron {
  font-size: 8px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  margin-right: 4px;
}
#site-nav:hover .nav-group-label .group-chevron { opacity: 0.6; }
.nav-group-label.collapsed .group-chevron { transform: rotate(-90deg); }

/* Collapsible group items */
.nav-group-items {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
  max-height: 500px;
  opacity: 1;
}
.nav-group-items.collapsed {
  max-height: 0;
  opacity: 0;
}

/* ── Links (base — tier 2 default) ── */
.nav-sidebar a.nav-link {
  display: flex;
  align-items: center;
  height: 1.6rem;
  padding: 0 0 0 14px;
  gap: 10px;
  color: var(--text-2, #908d85);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  position: relative;
  flex-shrink: 0;
}
.nav-sidebar a.nav-link:hover {
  color: var(--text-1, #d4d1ca);
  background: rgba(255, 255, 255, 0.04);
}
.nav-sidebar a.nav-link.active {
  color: var(--text-1, #d4d1ca);
  background: rgba(255, 255, 255, 0.06);
  border-left-color: var(--amber, #c4a060);
}

/* ── Tier 1 (primary) — bigger, bolder ── */
.nav-sidebar a.nav-link[data-tier="1"] {
  height: 1.85rem;
  color: var(--text-1, #d4d1ca);
}
.nav-sidebar a.nav-link[data-tier="1"] .nav-link-label {
  font-size: 0.78rem;
  font-weight: 600;
}
.nav-sidebar a.nav-link[data-tier="1"] .nav-link-icon svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* ── Tier 3 (utility) — smaller, muted ── */
.nav-sidebar a.nav-link[data-tier="3"] {
  height: 1.4rem;
  color: var(--text-muted, #5e5c56);
}
.nav-sidebar a.nav-link[data-tier="3"] .nav-link-label {
  font-size: 0.62rem;
  font-weight: 400;
}
.nav-sidebar a.nav-link[data-tier="3"] .nav-link-icon svg {
  width: 0.7rem;
  height: 0.7rem;
}
.nav-sidebar a.nav-link[data-tier="3"]:hover {
  color: var(--text-2, #908d85);
}

/* ── Icon container ── */
.nav-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.nav-link-icon svg {
  width: 0.8rem;
  height: 0.8rem;
}

/* ── Label ── */
.nav-link-label {
  opacity: 0;
  transition: opacity 0.15s ease 0.05s;
}
#site-nav:hover .nav-link-label {
  opacity: 1;
}

/* ── Special link colors ── */
.nav-sidebar a.nav-link.nav-health { color: var(--green, #8fa387); }
.nav-sidebar a.nav-link.nav-health:hover { background: rgba(143, 163, 135, 0.06); color: var(--green, #8fa387); }
.nav-sidebar a.nav-link.nav-health.active { color: var(--text-1); background: rgba(143, 163, 135, 0.1); border-left-color: var(--green, #8fa387); }

.nav-sidebar a.nav-link.nav-dev { color: var(--amber, #c4a060); }
.nav-sidebar a.nav-link.nav-dev:hover { background: rgba(196, 160, 96, 0.06); }
.nav-sidebar a.nav-link.nav-dev.active { color: var(--text-1); background: rgba(196, 160, 96, 0.1); border-left-color: var(--amber, #c4a060); }

/* ── Bottom utilities (font-size + search + account) ── */
.nav-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border-dim, rgba(255,255,255,0.05));
  padding: 6px 0;
  flex-shrink: 0;
}

/* ── Font-size buttons (A- / A+) ──
   Dimensions stay in px so both buttons fit inside the 48px collapsed
   sidebar. Font-size stays in rem so the letter glyphs scale with the
   global font scale (which is what these buttons control). */
.nav-font-size {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 2px 4px 8px;
  height: 30px;
}
.nav-fs-btn {
  background: none;
  border: 1px solid var(--border-dim, rgba(255,255,255,0.06));
  color: var(--text-2, #908d85);
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 22px;
  border-radius: 3px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.15s;
  flex-shrink: 0;
}
.nav-fs-btn:hover {
  color: var(--text-1, #d4d1ca);
  border-color: var(--amber, #c4a060);
  background: rgba(196, 160, 96, 0.08);
}
.nav-fs-btn:nth-child(1) { font-size: 0.6rem; } /* A- slightly smaller */
.nav-fs-btn:nth-child(2) { font-size: 0.72rem; } /* A+ slightly larger */

/* ── Search ── */
.nav-search-box {
  position: relative;
  display: flex;
  align-items: center;
  height: 1.9rem;
  padding: 0 0 0 14px;
  gap: 10px;
}
.nav-search-btn {
  background: none;
  border: none;
  color: var(--text-3, #5e5c56);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: color 0.2s;
}
.nav-search-btn:hover { color: var(--text, #c8c5be); }

.nav-search-input {
  padding: 0.2rem 0.5rem;
  font-size: 0.78rem;
  font-family: 'DM Sans', sans-serif;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text, #c8c5be);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 4px;
  width: 0;
  opacity: 0;
  outline: none;
  transition: width 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
}
.nav-search-box.open .nav-search-input {
  width: 120px;
  opacity: 1;
  pointer-events: auto;
}
.nav-search-box.open .nav-search-btn { color: var(--text, #c8c5be); }

.nav-search-results {
  position: absolute;
  left: 100%;
  top: 0;
  width: 260px;
  background: var(--bg-2, #212127);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 6px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 200;
  margin-left: 4px;
  display: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.nav-search-result {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border-dim, rgba(255,255,255,0.05));
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-2, #908d85);
  transition: all 0.15s;
}
.nav-search-result:hover { background: rgba(255, 255, 255, 0.04); color: var(--text, #c8c5be); }
.nav-search-result:last-child { border-bottom: none; }

/* ── Account link ── */
.nav-sidebar a.nav-account {
  display: flex;
  align-items: center;
  height: 1.9rem;
  padding: 0 0 0 14px;
  gap: 10px;
  color: var(--text-3, #5e5c56);
  text-decoration: none;
  font-size: 0.7rem;
  transition: color 0.2s;
}
.nav-sidebar a.nav-account:hover { color: var(--text, #c8c5be); }

/* ── Global body offset for sidebar ── */
body {
  padding-left: 52px;
  transition: padding-left 0.2s;
}

/* ── Container overrides for sidebar layout ── */
.container {
  margin-top: 0 !important;
  padding-top: 0.75rem;
}

/* ── Shell overrides for sidebar (chat pages use position:fixed) ── */
.shell {
  left: 52px !important;
  top: 0 !important;
  right: 0 !important;
  transition: left 0.2s;
}

/* ── Health shell override ── */
.health-shell {
  left: 52px !important;
  top: 0 !important;
  right: 0 !important;
  transition: left 0.2s;
}

/* ── Hamburger (mobile) ── */
.nav-hamburger {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(22, 22, 27, 0.95);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-2, #908d85);
  border-radius: 1px;
  transition: all 0.2s;
}

/* ── Mobile overlay ── */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.nav-overlay.open { display: block; }

/* ── Mobile ── */
@media (max-width: 768px) {
  #site-nav {
    width: 0;
    transform: translateX(-200px);
    transition: transform 0.25s ease, width 0.25s ease;
  }
  #site-nav:hover {
    width: 0;
    box-shadow: none;
  }
  #site-nav.mobile-open {
    width: 200px;
    transform: translateX(0);
  }
  #site-nav.mobile-open .nav-link-label { opacity: 1; }
  #site-nav.mobile-open .nav-group-label { opacity: 1; }
  #site-nav.mobile-open .nav-group-label .group-chevron { opacity: 0.6; }

  .nav-hamburger { display: flex; }

  body { padding-left: 0 !important; }
  .container { padding-top: 0.5rem; }
  .shell { left: 0 !important; top: 0 !important; }
  .health-shell { left: 0 !important; top: 0 !important; }
}
