/* ═══════════════════════════════════════════════════
   App navigation — desktop left list / mobile bottom bar
   Loaded last so it can override .library-* positions in generate.css.
   ═══════════════════════════════════════════════════ */

:root {
  --nav-h: 64px; /* mobile bottom-bar height, overridden in the mobile block */
}

/* ── Desktop: right dock — side panel with a horizontal nav bar beneath it.
   The dock owns the vertical centering so the pair (panel + nav) reads as one
   right-hand column. On mobile the dock collapses to display:contents (see the
   mobile block), letting the bottom sheet + floating nav pill keep their own
   fixed positioning. ── */
/* Desktop-only structural rules — kept in a min-width query so the higher
   specificity of `.right-dock .sidepanel` never overrides the mobile sheet. */
@media (min-width: 768px) {
  .right-dock {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    width: 314px;                 /* matches .sidepanel width */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  /* Side panel becomes an in-flow dock child instead of a fixed, centered box. */
  .right-dock .sidepanel {
    position: static;
    right: auto;
    top: auto;
    transform: none;
    width: 100%;
  }

  /* Horizontal glass nav bar docked under the panel. */
  .navbar {
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 5px;
    background: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(34px);
    -webkit-backdrop-filter: blur(34px);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.05) inset,
      0 24px 60px rgba(0, 0, 0, 0.5);
  }
}

.nav-item {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 6px;
  border-radius: 12px;
  color: var(--text-faint);
  font-family: 'Outfit', sans-serif;
  transition: color 0.15s, background 0.15s;
}
.nav-item:hover { color: var(--text-soft); background: var(--surface); }
.nav-item.active { color: var(--text); background: var(--surface-strong); }

.nav-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.nav-item-icon svg { width: 21px; height: 21px; }
.nav-item-label {
  max-width: 100%;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════
   Side-panel content transitions — the .sp-content wrapper is remounted (via a
   React key) whenever the panel switches mode (chat / library / node detail) or
   a different node is selected, replaying this enter animation each time.
   ═══════════════════════════════════════════════════ */
.sp-content {
  animation: sp-content-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
/* In chat mode the wrapper must fill the panel so the transcript scrolls and the
   composer sticks to the bottom (mirrors what .roadmap-chat-inner expects). */
.sidepanel-chat .sp-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
@keyframes sp-content-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-content { animation: none; }
}

/* ═══════════════════════════════════════════════════
   Roadmap chat — lives INSIDE the side panel / bottom sheet, as a third
   mutually-exclusive content mode alongside node detail and the library.
   The parent .sidepanel owns positioning; chat only fills it.
   ═══════════════════════════════════════════════════ */

/* When the side panel is in chat mode it becomes a flex column so the
   transcript scrolls internally and the composer sticks to the bottom. */
.sidepanel.sidepanel-chat {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* Desktop: give chat mode a fixed height (mobile uses the sheet-* heights). */
@media (min-width: 768px) {
  .sidepanel.sidepanel-chat {
    height: min(72vh, 620px);
  }

  /* When chat is open, stop centering the dock: anchor it just below the
     Experience card (top: 18px + card height + one 12px nav-gap) and stretch it
     down so the chat panel fills the space. The dock's own `gap: 12px` keeps the
     panel↔nav gap equal to the experience↔panel gap. */
  .right-dock:has(.sidepanel-chat) {
    top: calc(18px + var(--exp-h, 78px) + 12px);
    bottom: 20px;
    transform: none;
  }
  .right-dock:has(.sidepanel-chat) .sidepanel.sidepanel-chat {
    height: auto;
    flex: 1;
    min-height: 0;
  }
}

.roadmap-chat-inner {
  /* Neutralize the onboarding-workspace left offset the reused .gen-chat-*
     classes expect (there is no career-profile panel here). */
  --gen-profile-offset: 20px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  color: var(--text);
}

.roadmap-chat-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 8px 20px;
}
.roadmap-chat-cluster { margin-bottom: 0; }

.roadmap-chat-close {
  appearance: none;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-faint);
  font-size: 24px;
  line-height: 1;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  transition: color 0.15s, background 0.15s;
}
.roadmap-chat-close:hover { color: var(--text); background: var(--surface); }

/* ── Roadmap library rendered inside the side panel / bottom sheet ── */
.library-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 4px 0 10px;
  max-height: 46vh;
  overflow-y: auto;
}
.sidepanel-library .sp-title { margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════
   MOBILE — bottom bar
   ═══════════════════════════════════════════════════ */
@media (max-width: 767px) {
  /* Dock is a desktop-only construct — dissolve it so the bottom sheet and the
     floating nav pill position themselves against the viewport as before. */
  .right-dock { display: contents; }

  :root {
    --nav-inset: 12px;      /* uniform gap: screen edges, and sheet↔nav gap */
    --nav-pill-h: 58px;     /* fixed pill height so the sheet can sit a clean gap above it */
    --nav-h: calc(env(safe-area-inset-bottom, 0px) + var(--nav-inset) + var(--nav-pill-h));
  }

  .navbar {
    position: fixed;
    display: flex;
    left: var(--nav-inset);
    right: var(--nav-inset);
    bottom: calc(env(safe-area-inset-bottom, 0px) + var(--nav-inset));
    top: auto;
    height: var(--nav-pill-h);
    box-sizing: border-box;
    align-items: center;
    transform: none;
    z-index: 100; /* floats above the sheet/шторa (90) and everything else */
    flex-direction: row;
    gap: 4px;
    padding: 6px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(28px) saturate(1.4);
    -webkit-backdrop-filter: blur(28px) saturate(1.4);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.06) inset,
      0 16px 44px rgba(0, 0, 0, 0.5);
  }
  .nav-item {
    flex: 1;
    width: auto;
    gap: 3px;
    padding: 8px 4px;
    border-radius: 16px;
  }
  .nav-item-label { font-size: 10px; }

  /* Node-detail card floats over the nav bar; its inset is owned by mobile.css. */

  /* Chat mode of the sheet: flex column, inner transcript scrolls (not the
     sheet), leave room at the top for the drag handle. */
  .sidepanel.sidepanel-chat {
    display: flex;
    flex-direction: column;
    padding: 8px 0 0;
    overflow: hidden;
  }
  .sidepanel.sidepanel-chat.sheet-peek,
  .sidepanel.sidepanel-chat.sheet-expanded {
    overflow: hidden;
  }

  /* Roadmap chat reuses .gen-chat-* — undo the onboarding overrides that
     don't apply here: no floating collapsed header to clear, and the header
     should hug the drag handle instead of sitting far below it. */
  .roadmap-chat-inner .gen-chat-scroll {
    padding-top: 12px;
  }
  .roadmap-chat-head {
    padding: 2px 16px 6px 18px;
  }

  /* Roadmap library → bottom sheet above the nav bar */
  .library-panel {
    left: 0;
    right: 0;
    bottom: var(--nav-h);
    top: auto;
    transform: none;
    width: 100%;
    max-height: 60vh;
    border-radius: 22px 22px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }
}
