/* ==========================================================================
   nav-sidebar.css — Left-side collapsible navigation sidebar
   Aesthetic: scientific-monitor style matching DNA Monitor sidebar
   ========================================================================== */

/* ---- CSS Variables ---- */
:root {
  --nav-sidebar-width: 240px;
  --nav-sidebar-collapsed: 60px;
  --nav-sidebar-bg: rgba(10, 10, 18, 0.96);
  --nav-sidebar-border: rgba(97, 175, 239, 0.15);
  --nav-sidebar-glow-primary: #61afef;
  --nav-sidebar-glow-secondary: #a78bfa;
  --nav-sidebar-glow-accent: #00ff88;
  --nav-sidebar-glow-warm: #ff6b6b;
  --nav-sidebar-text: #c0caf5;
  --nav-sidebar-text-muted: #565f89;
  --nav-sidebar-card-bg: rgba(30, 30, 46, 0.6);
  --nav-sidebar-z: 100;
  --nav-sidebar-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Sidebar Container ---- */

.nav-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 28px;
  width: var(--nav-sidebar-width);
  background: var(--nav-sidebar-bg);
  border-right: 1px solid var(--nav-sidebar-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: var(--nav-sidebar-z);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--nav-sidebar-transition);
}

.nav-sidebar::-webkit-scrollbar { width: 4px; }
.nav-sidebar::-webkit-scrollbar-track { background: transparent; }
.nav-sidebar::-webkit-scrollbar-thumb {
  background: rgba(97, 175, 239, 0.2);
  border-radius: 2px;
}

/* ---- Collapsed State ---- */

.nav-sidebar.collapsed {
  width: var(--nav-sidebar-collapsed);
}

.nav-sidebar.collapsed .nav-sidebar-label,
.nav-sidebar.collapsed .nav-sidebar-brand-text,
.nav-sidebar.collapsed .nav-sidebar-group-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.1s ease;
}

.nav-sidebar:not(.collapsed) .nav-sidebar-label,
.nav-sidebar:not(.collapsed) .nav-sidebar-brand-text,
.nav-sidebar:not(.collapsed) .nav-sidebar-group-label {
  opacity: 1;
  transition: opacity 0.2s ease 0.1s;
}

/* ---- Toggle Button (frosty glowing bar, fixed on left edge) ---- */

.nav-sidebar-toggle {
  position: fixed;
  left: var(--nav-sidebar-width);
  top: 50%;
  transform: translateY(-50%);
  z-index: 101;
  width: 22px;
  height: 88px;

  /* Neon core with frost overlay */
  background:
    /* Frost crystal layer 1 */
    linear-gradient(135deg,
      rgba(255, 255, 255, 0.1) 0%,
      transparent 35%,
      rgba(255, 255, 255, 0.06) 55%,
      transparent 100%),
    /* Frost crystal layer 2 */
    linear-gradient(-45deg,
      rgba(200, 230, 255, 0.08) 0%,
      transparent 25%,
      rgba(180, 210, 245, 0.1) 65%,
      transparent 100%),
    /* Neon glow core */
    linear-gradient(180deg,
      rgba(97, 175, 239, 0.1) 0%,
      rgba(97, 175, 239, 0.25) 50%,
      rgba(167, 139, 250, 0.18) 100%);

  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);

  /* Ice crystal border */
  border: 1px solid rgba(200, 230, 255, 0.22);
  border-left: none;
  border-radius: 0 8px 8px 0;

  /* Neon underglow + frost shimmer */
  box-shadow:
    0 0 15px rgba(97, 175, 239, 0.15),
    0 0 4px rgba(200, 230, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);

  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Vertical text */
  writing-mode: vertical-rl;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-family: 'Courier New', monospace;
  color: rgba(180, 220, 255, 0.6);
  text-shadow: 0 0 8px rgba(97, 175, 239, 0.3);

  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  animation: frost-neon-pulse 4s ease-in-out infinite;
}

/* Frost crystal line pattern overlay */
.nav-sidebar-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    repeating-linear-gradient(
      -55deg,
      transparent,
      transparent 3px,
      rgba(255, 255, 255, 0.04) 3px,
      rgba(255, 255, 255, 0.04) 4px),
    repeating-linear-gradient(
      55deg,
      transparent,
      transparent 5px,
      rgba(200, 230, 255, 0.03) 5px,
      rgba(200, 230, 255, 0.03) 6px);
  pointer-events: none;
}

/* Tooltip on hover */
.nav-sidebar-toggle[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  writing-mode: horizontal-tb;
  background: rgba(10, 10, 18, 0.95);
  color: var(--nav-sidebar-text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  z-index: 200;
  border: 1px solid var(--nav-sidebar-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.nav-sidebar-toggle:hover {
  background:
    linear-gradient(135deg,
      rgba(255, 255, 255, 0.14) 0%,
      transparent 35%,
      rgba(255, 255, 255, 0.09) 55%,
      transparent 100%),
    linear-gradient(-45deg,
      rgba(200, 230, 255, 0.12) 0%,
      transparent 25%,
      rgba(180, 210, 245, 0.14) 65%,
      transparent 100%),
    linear-gradient(180deg,
      rgba(97, 175, 239, 0.2) 0%,
      rgba(97, 175, 239, 0.4) 50%,
      rgba(167, 139, 250, 0.3) 100%);

  box-shadow:
    0 0 24px rgba(97, 175, 239, 0.3),
    0 0 8px rgba(200, 230, 255, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06);

  color: rgba(210, 240, 255, 0.9);
  text-shadow: 0 0 12px rgba(97, 175, 239, 0.5);
  width: 28px;
}

@keyframes frost-neon-pulse {
  0%, 100% {
    box-shadow:
      0 0 15px rgba(97, 175, 239, 0.15),
      0 0 4px rgba(200, 230, 255, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  }
  50% {
    box-shadow:
      0 0 20px rgba(97, 175, 239, 0.22),
      0 0 6px rgba(200, 230, 255, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(255, 255, 255, 0.05);
  }
}

/* Collapsed state: toggle moves to collapsed width */
body.nav-sidebar-collapsed .nav-sidebar-toggle {
  left: var(--nav-sidebar-collapsed);
}

/* ---- Brand Header ---- */

.nav-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--nav-sidebar-border);
  background: linear-gradient(180deg,
    rgba(97, 175, 239, 0.06) 0%,
    transparent 100%);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  min-height: 56px;
}

.nav-sidebar-brand::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(97, 175, 239, 0.35),
    transparent);
  animation: nav-scanline 4s linear infinite;
}

@keyframes nav-scanline {
  0% { top: 0; }
  100% { top: 100%; }
}

.nav-sidebar-brand-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  filter: drop-shadow(0 0 4px rgba(97, 175, 239, 0.4));
}

.nav-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.nav-sidebar-brand-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  background: linear-gradient(90deg,
    var(--nav-sidebar-glow-primary),
    var(--nav-sidebar-glow-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
}

.nav-sidebar-brand-version {
  font-size: 9px;
  color: var(--nav-sidebar-text-muted);
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

/* ---- Frost Bites Balance Display (below brand, above nav body) ---- */

.nav-sidebar-balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 0;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  background: linear-gradient(135deg,
    rgba(97, 175, 239, 0.1),
    rgba(167, 139, 250, 0.06));
  border-top: 1px solid rgba(97, 175, 239, 0.08);
  border-bottom: 1px solid rgba(97, 175, 239, 0.2);
  box-shadow:
    inset 0 0 20px rgba(97, 175, 239, 0.06),
    0 2px 12px rgba(97, 175, 239, 0.1);
  transition: all 0.3s ease;
}

.nav-sidebar-balance:hover {
  background: linear-gradient(135deg,
    rgba(97, 175, 239, 0.18),
    rgba(167, 139, 250, 0.12));
  box-shadow:
    inset 0 0 24px rgba(97, 175, 239, 0.1),
    0 2px 20px rgba(97, 175, 239, 0.2),
    0 0 30px rgba(97, 175, 239, 0.08);
}

.nav-sidebar-balance-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(97, 175, 239, 0.5));
  animation: nav-balance-icon-pulse 4s ease-in-out infinite;
}

@keyframes nav-balance-icon-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(97, 175, 239, 0.4)); }
  50% { filter: drop-shadow(0 0 8px rgba(97, 175, 239, 0.7)); }
}

.nav-sidebar-balance-text {
  display: flex;
  align-items: baseline;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}

.nav-sidebar-balance-amount {
  font-size: 16px;
  font-weight: 700;
  color: #e0e8ff;
  font-family: 'Courier New', monospace;
  text-shadow: 0 0 10px rgba(97, 175, 239, 0.5);
  letter-spacing: 0.5px;
}

.nav-sidebar-balance-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(97, 175, 239, 0.7);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Balance: collapsed state */
.nav-sidebar.collapsed .nav-sidebar-balance-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.1s ease;
}

.nav-sidebar:not(.collapsed) .nav-sidebar-balance-text {
  opacity: 1;
  transition: opacity 0.2s ease 0.1s;
}

.nav-sidebar.collapsed .nav-sidebar-balance {
  justify-content: center;
  padding: 10px;
}

/* Balance: collapsed tooltip */
.nav-sidebar.collapsed .nav-sidebar-balance:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 10, 18, 0.95);
  color: var(--nav-sidebar-text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 200;
  border: 1px solid var(--nav-sidebar-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* ---- Navigation Body (scrollable) ---- */

.nav-sidebar-body {
  flex: 1;
  padding: 4px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(97, 175, 239, 0.15) transparent;
}

.nav-sidebar-body::-webkit-scrollbar { width: 4px; }
.nav-sidebar-body::-webkit-scrollbar-track { background: transparent; }
.nav-sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(97, 175, 239, 0.2);
  border-radius: 2px;
}

/* ---- Groups ---- */

.nav-sidebar-group {
  padding: 4px 0;
}

.nav-sidebar-group + .nav-sidebar-group {
  border-top: 1px solid rgba(97, 175, 239, 0.06);
}

.nav-sidebar-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--nav-sidebar-text-muted);
  font-family: 'Courier New', monospace;
  padding: 10px 16px 4px;
  white-space: nowrap;
  overflow: hidden;
}

/* ---- Navigation Items ---- */

.nav-sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  margin: 1px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--nav-sidebar-text);
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
  font-family: inherit;
  width: calc(100% - 16px);
  box-sizing: border-box;
}

.nav-sidebar-item:hover {
  background: rgba(97, 175, 239, 0.08);
  border-color: rgba(97, 175, 239, 0.12);
  color: #e0e0e0;
}

/* Active state with glow */
.nav-sidebar-item.active {
  background: linear-gradient(135deg,
    rgba(97, 175, 239, 0.15),
    rgba(167, 139, 250, 0.1));
  border-color: rgba(97, 175, 239, 0.3);
  color: var(--nav-sidebar-glow-primary);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(97, 175, 239, 0.1),
              inset 0 0 12px rgba(97, 175, 239, 0.05);
}

/* Active glow bar on left edge */
.nav-sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg,
    var(--nav-sidebar-glow-primary),
    var(--nav-sidebar-glow-secondary));
  box-shadow: 0 0 8px var(--nav-sidebar-glow-primary);
  animation: nav-glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes nav-glow-pulse {
  0% { box-shadow: 0 0 6px var(--nav-sidebar-glow-primary); }
  100% { box-shadow: 0 0 14px var(--nav-sidebar-glow-primary); }
}

.nav-sidebar-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.nav-sidebar-item:hover .nav-sidebar-icon {
  opacity: 0.9;
}

.nav-sidebar-item.active .nav-sidebar-icon {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(97, 175, 239, 0.4));
}

/* DNA-ready glow on Twin sidebar tab */
.nav-sidebar-item.nav-dna-glow {
  animation: nav-dna-tab-glow 2s ease-in-out infinite;
  border-color: rgba(97, 175, 239, 0.3);
}
@keyframes nav-dna-tab-glow {
  0%, 100% {
    background: rgba(97, 175, 239, 0.06);
    box-shadow: inset 0 0 6px rgba(97, 175, 239, 0.08);
  }
  50% {
    background: rgba(97, 175, 239, 0.14);
    box-shadow: inset 0 0 12px rgba(97, 175, 239, 0.15);
  }
}

.nav-sidebar-label {
  white-space: nowrap;
  overflow: hidden;
}

/* ---- Collapsed: center icons, hide labels ---- */

.nav-sidebar.collapsed .nav-sidebar-item {
  justify-content: center;
  padding: 10px;
  margin: 1px 4px;
  width: calc(100% - 8px);
}

.nav-sidebar.collapsed .nav-sidebar-group-label {
  height: 0;
  padding: 0;
  margin: 0;
}

/* ---- Collapsed Tooltips ---- */

.nav-sidebar.collapsed .nav-sidebar-item[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: rgba(10, 10, 18, 0.95);
  color: var(--nav-sidebar-text);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 200;
  border: 1px solid var(--nav-sidebar-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* ---- Footer (Guide, Account, Logout) ---- */

.nav-sidebar-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--nav-sidebar-border);
  padding: 8px 0;
  background: linear-gradient(0deg,
    rgba(97, 175, 239, 0.03) 0%,
    transparent 100%);
}

/* Logout special hover */
.nav-sidebar-item.nav-logout:hover {
  background: rgba(255, 107, 107, 0.08);
  border-color: rgba(255, 107, 107, 0.15);
  color: var(--nav-sidebar-glow-warm);
}

.nav-sidebar-item.nav-logout:hover .nav-sidebar-icon {
  opacity: 1;
  filter: drop-shadow(0 0 3px rgba(255, 107, 107, 0.4));
}

/* ---- Storyboard Highlight (frost blue sparkle) ---- */

.nav-sidebar-item.nav-storyboard-highlight {
  color: #7ec8f0;
  font-weight: 600;
  position: relative;
  background: linear-gradient(135deg,
    rgba(97, 175, 239, 0.08),
    rgba(140, 200, 255, 0.04));
  border-color: rgba(97, 175, 239, 0.15);
}

.nav-sidebar-item.nav-storyboard-highlight .nav-sidebar-icon {
  opacity: 1;
  font-size: 15px;
  filter: drop-shadow(0 0 4px rgba(97, 175, 239, 0.5));
  animation: sb-icon-sparkle 3s ease-in-out infinite;
}

.nav-sidebar-item.nav-storyboard-highlight .nav-sidebar-label {
  background: linear-gradient(90deg, #7ec8f0, #a3d8f4, #7ec8f0);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: sb-text-shimmer 4s ease-in-out infinite;
}

.nav-sidebar-item.nav-storyboard-highlight:hover {
  background: linear-gradient(135deg,
    rgba(97, 175, 239, 0.18),
    rgba(140, 200, 255, 0.10));
  border-color: rgba(97, 175, 239, 0.3);
  box-shadow: 0 0 14px rgba(97, 175, 239, 0.15),
              inset 0 0 10px rgba(97, 175, 239, 0.06);
}

.nav-sidebar-item.nav-storyboard-highlight.active {
  background: linear-gradient(135deg,
    rgba(97, 175, 239, 0.18),
    rgba(140, 200, 255, 0.10));
  border-color: rgba(97, 175, 239, 0.3);
  box-shadow: 0 0 14px rgba(97, 175, 239, 0.2),
              inset 0 0 12px rgba(97, 175, 239, 0.06);
}

@keyframes sb-icon-sparkle {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(97, 175, 239, 0.4)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 8px rgba(140, 200, 255, 0.7)); transform: scale(1.1); }
}

@keyframes sb-text-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---- Community Button (neon green/cyan glow) ---- */

.nav-sidebar-item.nav-community-highlight {
  font-weight: 700;
  position: relative;
  background: linear-gradient(135deg,
    rgba(0, 255, 170, 0.06),
    rgba(0, 230, 255, 0.04));
  border-color: rgba(0, 255, 200, 0.15);
}

.nav-sidebar-item.nav-community-highlight .nav-sidebar-icon {
  opacity: 1;
  font-size: 15px;
  filter: drop-shadow(0 0 5px rgba(0, 255, 200, 0.6));
  animation: community-icon-pulse 3s ease-in-out infinite;
}

.nav-sidebar-item.nav-community-highlight .nav-sidebar-label {
  background: linear-gradient(90deg, #00ffaa, #00e6ff, #00ffaa);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: community-text-shimmer 3s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(0, 255, 200, 0.4));
}

.nav-sidebar-item.nav-community-highlight:hover {
  background: linear-gradient(135deg,
    rgba(0, 255, 170, 0.15),
    rgba(0, 230, 255, 0.10));
  border-color: rgba(0, 255, 200, 0.35);
  box-shadow: 0 0 18px rgba(0, 255, 200, 0.15),
              inset 0 0 12px rgba(0, 255, 200, 0.06);
}

.nav-sidebar-item.nav-community-highlight.active {
  background: linear-gradient(135deg,
    rgba(0, 255, 170, 0.15),
    rgba(0, 230, 255, 0.10));
  border-color: rgba(0, 255, 200, 0.35);
  box-shadow: 0 0 18px rgba(0, 255, 200, 0.2),
              inset 0 0 14px rgba(0, 255, 200, 0.06);
}

@keyframes community-icon-pulse {
  0%, 100% { filter: drop-shadow(0 0 3px rgba(0, 255, 200, 0.4)); transform: scale(1); }
  50% { filter: drop-shadow(0 0 10px rgba(0, 255, 200, 0.8)); transform: scale(1.1); }
}

@keyframes community-text-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ---- Guide Button Glow (frosty blue pulsating) ---- */

.nav-sidebar-item.guide-glow {
  animation: guide-frost-glow 2s ease-in-out infinite;
  border-color: rgba(97, 175, 239, 0.3);
}

.nav-sidebar-item.guide-glow .nav-sidebar-icon {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(97, 175, 239, 0.6));
}

@keyframes guide-frost-glow {
  0%, 100% {
    background: rgba(97, 175, 239, 0.06);
    box-shadow: 0 0 6px rgba(97, 175, 239, 0.1), inset 0 0 8px rgba(97, 175, 239, 0.04);
  }
  50% {
    background: rgba(97, 175, 239, 0.15);
    box-shadow: 0 0 16px rgba(97, 175, 239, 0.25), inset 0 0 14px rgba(97, 175, 239, 0.08);
  }
}

/* ---- Content & Status Bar Adjustments ---- */

body.nav-sidebar-active .content {
  margin-top: 0;
  margin-left: var(--nav-sidebar-width);
  transition: margin-left var(--nav-sidebar-transition);
}

body.nav-sidebar-collapsed .content {
  margin-left: var(--nav-sidebar-collapsed);
}

body.nav-sidebar-active .status-bar {
  left: var(--nav-sidebar-width);
  transition: left var(--nav-sidebar-transition);
}

body.nav-sidebar-collapsed .status-bar {
  left: var(--nav-sidebar-collapsed);
}

/* DNA sidebar: remove top offset since no top nav bar */
body.nav-sidebar-active .dna-monitor {
  top: 0;
}

/* ---- Backdrop (mobile/tablet overlay) ---- */

.nav-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.nav-sidebar-backdrop.visible {
  display: block;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* ---- Wide Desktop (>1200px): expanded by default, pushes content ---- */
@media (min-width: 1201px) {
  /* Both sidebars pushing content */
  body.nav-sidebar-active.dna-monitor-open .content {
    margin-right: var(--dna-sidebar-width, 340px);
  }

  body.nav-sidebar-collapsed.dna-monitor-open .content {
    margin-left: var(--nav-sidebar-collapsed);
    margin-right: var(--dna-sidebar-width, 340px);
  }

  body.nav-sidebar-active.dna-monitor-open .status-bar {
    right: var(--dna-sidebar-width, 340px);
  }
}

/* ---- Tablet (769-1200px): collapsed by default, overlay on expand ---- */
@media (max-width: 1200px) and (min-width: 769px) {
  .nav-sidebar {
    width: var(--nav-sidebar-collapsed);
  }

  .nav-sidebar.expanded {
    width: var(--nav-sidebar-width);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 150;
  }

  .nav-sidebar:not(.expanded) .nav-sidebar-label,
  .nav-sidebar:not(.expanded) .nav-sidebar-brand-text,
  .nav-sidebar:not(.expanded) .nav-sidebar-group-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }

  .nav-sidebar:not(.expanded) .nav-sidebar-item {
    justify-content: center;
    padding: 10px;
    margin: 1px 4px;
    width: calc(100% - 8px);
  }

  .nav-sidebar:not(.expanded) .nav-sidebar-group-label {
    height: 0;
    padding: 0;
    margin: 0;
  }

  /* Tooltips in collapsed tablet state */
  .nav-sidebar:not(.expanded) .nav-sidebar-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 18, 0.95);
    color: var(--nav-sidebar-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 200;
    border: 1px solid var(--nav-sidebar-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
  }

  /* Balance: tablet collapsed state */
  .nav-sidebar:not(.expanded) .nav-sidebar-balance-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
  }
  .nav-sidebar:not(.expanded) .nav-sidebar-balance {
    justify-content: center;
    padding: 10px;
  }
  .nav-sidebar:not(.expanded) .nav-sidebar-balance:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(10, 10, 18, 0.95);
    color: var(--nav-sidebar-text);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 200;
    border: 1px solid var(--nav-sidebar-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
  }

  body.nav-sidebar-active .content {
    margin-left: var(--nav-sidebar-collapsed);
  }

  body.nav-sidebar-active .status-bar {
    left: var(--nav-sidebar-collapsed);
  }

  .nav-sidebar-toggle {
    left: var(--nav-sidebar-collapsed);
  }

  .nav-sidebar.expanded ~ .nav-sidebar-toggle {
    left: var(--nav-sidebar-width);
  }
}

/* ---- Mobile (<768px): fully closed by default, only tab visible ---- */
@media (max-width: 768px) {
  /* Sidebar completely hidden when collapsed - no icons, no bar, nothing */
  .nav-sidebar {
    width: 0;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: hidden;
    visibility: hidden;
    pointer-events: none;
  }

  /* Sidebar visible when expanded */
  .nav-sidebar.expanded {
    width: var(--nav-sidebar-width);
    padding: 0;
    border-right: 1px solid var(--nav-sidebar-border);
    background: var(--nav-sidebar-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    z-index: 150;
    overflow: visible;
    visibility: visible;
    pointer-events: auto;
  }

  /* Content takes full width when sidebar collapsed */
  body.nav-sidebar-active .content {
    margin-left: 0;
    padding: 20px 12px 48px;
  }

  body.nav-sidebar-active .status-bar {
    left: 0;
  }

  /* Toggle tab at left edge when collapsed */
  .nav-sidebar-toggle {
    left: 0;
  }

  /* Toggle moves with expanded sidebar */
  .nav-sidebar.expanded ~ .nav-sidebar-toggle {
    left: var(--nav-sidebar-width);
  }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .nav-sidebar,
  .nav-sidebar-item,
  .nav-sidebar-toggle,
  body.nav-sidebar-active .content,
  body.nav-sidebar-active .status-bar {
    transition: none !important;
  }

  .nav-sidebar-brand::after {
    animation: none;
    display: none;
  }

  .nav-sidebar-item.active::before {
    animation: none;
  }

  .nav-sidebar-toggle {
    animation: none !important;
  }

  .nav-sidebar-balance-icon {
    animation: none !important;
  }

  .nav-sidebar-item.guide-glow {
    animation: none !important;
    background: rgba(97, 175, 239, 0.12);
    border-color: rgba(97, 175, 239, 0.3);
  }

  .nav-sidebar-item.nav-storyboard-highlight .nav-sidebar-icon {
    animation: none !important;
  }

  .nav-sidebar-item.nav-storyboard-highlight .nav-sidebar-label {
    animation: none !important;
    -webkit-text-fill-color: #7ec8f0;
  }

  .nav-sidebar-item.nav-community-highlight .nav-sidebar-icon {
    animation: none !important;
  }

  .nav-sidebar-item.nav-community-highlight .nav-sidebar-label {
    animation: none !important;
    -webkit-text-fill-color: #00ffaa;
  }
}
