/* Self-contained navbar0 styles. Removing its markup also removes the layout
   spacing, even if this stylesheet remains loaded. All component rules are
   scoped to [data-navbar0] so they do not style another navbar or the app. */

body:has([data-navbar0]) {
  padding-top: 4.1rem; /* Make room for the fixed top navbar on mobile */
}

/* Inject padding to body on desktop to make room for the side rail */
@media (min-width: 640px) {
  body:has([data-navbar0]) {
    padding-top: 0; /* Reset top padding when nav moves to the side */
    padding-left: 14rem;
  }
}
@media (min-width: 1024px) {
  body:has([data-navbar0]) {
    padding-left: 14rem; /* Expand for large screens */
  }
}

[data-navbar0].global-nav-wrapper {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: #ffffff;
  position: fixed;
  z-index: 50;
  box-sizing: border-box;
  width: 100%;
  
  /* Mobile default: Top Bar */
  top: 0;
  left: 0;
  border-bottom: 1px solid #e2e8f0;
}

[data-navbar0] * {
  box-sizing: inherit;
}

[data-navbar0] .global-nav-content {
  max-width: 48rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
  padding: 0 1rem;
}

/* Brand Logo */
[data-navbar0] .global-nav-brand {
  display: block; /* Shown on mobile top bar */
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
  letter-spacing: -0.025em;
}
[data-navbar0] .global-nav-brand span.short-text { display: none; }
[data-navbar0] .global-nav-brand span.full-text { display: block; }

/* Desktop Nav Links Container (Hidden on mobile) */
[data-navbar0] .global-nav-links {
  display: none;
}

/* Desktop Nav Link Styles */
[data-navbar0] .global-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease;
  gap: 0.35rem;
  flex: 1;
  height: 100%;
}

/* Colorful icon chips: each nav item keeps its own brand color regardless of active state. */
[data-navbar0] .global-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 0.65rem;
  transition: transform 0.2s ease;
}
[data-navbar0] .global-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
[data-navbar0] .global-nav-icon--home { background: #dbeafe; color: #2563eb; }
[data-navbar0] .global-nav-icon--questions { background: #ede9fe; color: #7c3aed; }
[data-navbar0] .global-nav-icon--news { background: #ffedd5; color: #ea580c; }
[data-navbar0] .global-nav-icon--profile { background: #ccfbf1; color: #0d9488; }
[data-navbar0] .global-nav-icon--login { background: #dcfce7; color: #16a34a; }

[data-navbar0] .global-nav-link:hover:not(.active) {
  color: #334155;
}
[data-navbar0] .global-nav-link.active {
  color: #4f46e5; /* Indigo accent */
}
[data-navbar0] .global-nav-link:hover .global-nav-icon {
  transform: scale(1.08);
}

/* Mobile Hamburger Button */
[data-navbar0] .global-nav-hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #0f172a;
  border-radius: 0.375rem;
}
[data-navbar0] .global-nav-hamburger:hover {
  background-color: #f1f5f9;
}
[data-navbar0] .global-nav-hamburger svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

/* Mobile Dropdown Menu */
[data-navbar0] .global-nav-mobile-menu {
  display: none;
  padding: 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-direction: column;
  gap: 1rem;
}
[data-navbar0] .global-nav-mobile-menu.active {
  display: flex;
}
[data-navbar0] .global-nav-mobile-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #475569;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.5rem;
  border-radius: 0.375rem;
}
[data-navbar0] .global-nav-mobile-link .global-nav-icon {
  width: 34px;
  height: 34px;
}
[data-navbar0] .global-nav-mobile-link:hover:not(.active) {
  background-color: #f1f5f9;
  color: #0f172a;
}
[data-navbar0] .global-nav-mobile-link.active {
  background-color: #e0e7ff;
  color: #4338ca;
}

/* Tablet Desktop Styles (Narrow Side Rail) */
@media (min-width: 640px) {
  [data-navbar0].global-nav-wrapper {
    top: 0;
    bottom: 0;
    left: 0;
    width: 14rem;
    border-top: none;
    border-bottom: none;
    border-right: 1px solid #e2e8f0;
  }
  
  [data-navbar0] .global-nav-content {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    height: 100%;
    padding: 2rem 1rem;
    gap: 1rem;
    margin: 0;
  }
  
  [data-navbar0] .global-nav-brand {
    font-size: 1.25rem;
    padding: 0 1rem;
    margin-bottom: 2.5rem;
  }
  [data-navbar0] .global-nav-brand span.full-text { display: block; }
  [data-navbar0] .global-nav-brand span.short-text { display: none; }
  
  [data-navbar0] .global-nav-links {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  [data-navbar0] .global-nav-hamburger {
    display: none;
  }
  [data-navbar0] .global-nav-mobile-menu {
    display: none !important;
  }
  
  [data-navbar0] .global-nav-link {
    width: auto;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    gap: 1rem;
    text-align: left;
    line-height: 1.3;
    border-radius: 0.75rem;
  }
  
  [data-navbar0] .global-nav-link:hover {
    background-color: #f8fafc;
  }
  
  [data-navbar0] .global-nav-link.active {
    background-color: #e0e7ff;
    color: #4338ca;
  }
}

/* Optional dark appearance. These rules carry their own colors and do not
   require dark-theme.css or dark-theme.js to be present. */
html.dark-mode [data-navbar0].global-nav-wrapper {
  background-color: var(--card-bg, #1c1c1e);
  border-color: var(--border-color, #343438);
}
html.dark-mode [data-navbar0] .global-nav-brand,
html.dark-mode [data-navbar0] .global-nav-hamburger {
  color: var(--text-main, #e5e5e5);
}
html.dark-mode [data-navbar0] .global-nav-hamburger:hover {
  background-color: var(--surface-hover, #29292d);
}
html.dark-mode [data-navbar0] .global-nav-link {
  color: var(--text-muted, #a1a1aa);
}
html.dark-mode [data-navbar0] .global-nav-link:hover:not(.active) {
  color: var(--text-main, #e5e5e5);
  background-color: var(--surface-hover, #29292d);
}
html.dark-mode [data-navbar0] .global-nav-link.active {
  color: var(--primary, #8ab4f8);
  background-color: var(--primary-light, #202c40);
  box-shadow: inset 0 0 0 1px var(--accent-border, #617b9e);
}
html.dark-mode [data-navbar0] .global-nav-mobile-menu {
  background-color: var(--card-bg, #1c1c1e);
  border-color: var(--border-color, #343438);
}
html.dark-mode [data-navbar0] .global-nav-mobile-link {
  color: var(--text-muted, #a1a1aa);
}
html.dark-mode [data-navbar0] .global-nav-mobile-link:hover:not(.active) {
  background-color: var(--surface-hover, #29292d);
  color: var(--text-main, #e5e5e5);
}
html.dark-mode [data-navbar0] .global-nav-mobile-link.active {
  background-color: var(--primary-light, #202c40);
  color: var(--primary, #8ab4f8);
  box-shadow: inset 0 0 0 1px var(--accent-border, #617b9e);
}

/* Pending state is owned by the navbar, not navigation-feedback.js. */
[data-navbar0].is-navigating [data-nav-path].active:not(.is-pending) {
  background-color: transparent;
  color: #64748b;
}
[data-navbar0].is-navigating [data-nav-path].active:not(.is-pending) svg {
  fill: none;
  stroke-width: 2;
}
[data-navbar0].is-navigating [data-nav-path].is-pending {
  background-color: transparent;
  color: #4338ca;
  outline: 1px dashed currentColor;
  outline-offset: -2px;
}
html.dark-mode [data-navbar0].is-navigating [data-nav-path].is-pending {
  background-color: transparent;
  color: var(--primary-hover, #aecbfa);
  box-shadow: none;
}
html.dark-mode [data-navbar0].is-navigating [data-nav-path].active:not(.is-pending) {
  background-color: transparent;
  color: var(--text-muted, #a1a1aa);
  box-shadow: none;
}
