/* Shared mobile navigation — collapses the horizontal top-bar links into a
   hamburger + slide-out drawer on narrow screens. Loaded by every page
   (playlist, analytics, review, live) so the mobile menu looks & behaves the
   same everywhere. Lives in /shared so the webpack build (which cleans public/)
   can't wipe it. */

/* Prevent the top bar / content from ever forcing a horizontal scroll */
html, body { overflow-x: hidden; }

/* Hamburger button — sits at the left of the top bar, hidden on desktop */
.nav-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 38px;
  padding: 0;
  background: #111827;
  border: 1px solid #1f2937;
  color: #c7d2fe;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-hamburger:hover { background: #1a2234; color: #e0e7ff; }

/* Dimmed backdrop behind the drawer */
.nav-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 10, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease;
  z-index: 90;
}
.nav-drawer-overlay.open { opacity: 1; visibility: visible; }

/* The slide-out panel */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 264px;
  max-width: 82vw;
  background: #0a0a14;
  border-right: 1px solid #1f2937;
  box-shadow: 4px 0 28px rgba(0, 0, 0, 0.55);
  transform: translateX(-100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 16px 18px;
  overflow-y: auto;
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-close {
  position: absolute;
  top: 14px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
}
.nav-drawer-close:hover { background: #1a2234; color: #e0e7ff; }

.nav-drawer-brand {
  font-weight: 800;
  font-size: 1rem;
  color: #c7d2fe;
  padding: 2px 6px 16px;
}

.nav-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.nav-drawer .nav-link {
  display: block;
  padding: 12px 14px;
  font-size: 0.95rem;
  border-radius: 8px;
}

/* Stop-services button pinned to the bottom of the drawer */
.nav-drawer-stop {
  margin-top: auto;
  width: 100%;
  margin-bottom: 4px;
}

/* --- Narrow screens: hide the inline links, show the hamburger --- */
@media (max-width: 720px) {
  .nav { gap: 12px; padding: 11px 16px; }
  .nav .nav-links { display: none; }
  .nav > .nav-stop { display: none; }   /* the drawer carries a copy instead */
  .nav-hamburger { display: inline-flex; }
  .nav-brand { flex: 1; font-size: 0.9rem; }
}

/* --- Desktop: the drawer bits never show, even though they're in the DOM --- */
@media (min-width: 721px) {
  .nav-hamburger,
  .nav-drawer,
  .nav-drawer-overlay { display: none !important; }
}

/* --- Account chip -----------------------------------------------------------
   Who you're signed in as, and the way out. Added to .nav by session.js on the
   static pages and rendered in JSX on the playlist page; the styles live here
   because all four pages already link this stylesheet. */
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.nav-user-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c7d2fe;
  white-space: nowrap;
}
.nav-user-role {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a5b4fc;
  background: #1e1b4b;
  border: 1px solid #3730a3;
  border-radius: 999px;
  padding: 2px 7px;
}
.nav-user-signout,
.nav-user-signin {
  background: transparent;
  border: 1px solid #1f2937;
  color: #94a3b8;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: inherit;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-user-signout:hover,
.nav-user-signin:hover { background: #1a2234; color: #e0e7ff; }
.nav-user-signin { border-color: #3730a3; color: #c7d2fe; }

/* Signed-out notice on the read-only playlist page. */
.readonly-note {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #10101f;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #64748b;
  font-size: 0.83rem;
}
.readonly-note a { color: #a5b4fc; font-weight: 700; text-decoration: none; }
.readonly-note a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  /* The name is the part worth keeping when space is tight. */
  .nav-user { gap: 7px; }
  .nav-user-role { display: none; }
  .nav-user-signout, .nav-user-signin { padding: 5px 9px; font-size: 0.72rem; }
}

/* --- SoC temperature chip ---------------------------------------------------
   Built by /shared/soc-temp.js. Like the account chip above, the styles live
   here because all four pages already link this stylesheet — the Review page
   puts one in its header, and every page gets one in the mobile drawer.

   Reads as plain text at 70 °C and only earns colour as it approaches the
   thresholds that actually cost detections: amber at the 80 °C soft limit,
   red at the 85 °C hard one. */
.temp-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Follows whatever the container aligns to: flex-end in the Review header,
     stretch in the drawer. */
  align-items: inherit;
}
.temp-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  border: 1px solid #1f2937;
  border-radius: 999px;
  background: #111827;
  font-size: 0.8rem;
  color: #94a3b8;
}
/* An author `display` beats the UA stylesheet's [hidden] rule, so spell it out:
   without this, "not a Pi" still renders an empty pill. */
.temp-block[hidden], .temp-chip[hidden] { display: none; }
.temp-label { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; }
.temp-value { font-variant-numeric: tabular-nums; font-weight: 700; color: #cbd5e1; }
.temp-chip.warn { border-color: #78350f; background: #1c1207; }
.temp-chip.warn .temp-value { color: #fbbf24; }
.temp-chip.crit { border-color: #7f1d1d; background: #1c0a0a; }
.temp-chip.crit .temp-value { color: #f87171; }
.temp-chip.stale .temp-value { color: #64748b; }
.temp-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: #7f1d1d;
  color: #fecaca;
}
.temp-hint { font-size: 0.72rem; color: #64748b; max-width: 260px; text-align: right; }

/* In the drawer the chip sits at the bottom, just above "Stop services" — rig
   health next to the control that acts on it. The slot takes over the auto
   margin that was pinning the button, so the two stay together at the foot.
   Both drawers use this wrapper: the static pages build it in nav-drawer.js,
   the React playlist renders it as the ref'd mount point. */
.nav-drawer-temp {
  margin-top: auto;
  padding: 14px 6px 10px;
  border-top: 1px solid #1f2937;
}
.nav-drawer-temp + .nav-drawer-stop { margin-top: 10px; }
.nav-drawer .temp-hint { text-align: left; max-width: none; }

@media (max-width: 720px) { .temp-hint { text-align: left; } }
