/* ==========================================================================
   Unified Navigation Bar CSS (navbar.css) - Taste-Skill Anti-Slop Edition
   Restrained, dark terminal navigation component across all pages.
   Zero framework dependencies, low-contrast navigation hierarchy.
   ========================================================================== */

/* Header Container */
.unified-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--term-border-hair, rgba(255, 255, 255, 0.08));
  margin-bottom: 20px;
}

/* Left: Title & Badge Group */
.title-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.title-group h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--term-text-primary, #f8fafc);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  line-height: 1.3;
}

.title-sub {
  color: var(--term-text-muted, #64748b);
  font-size: 12px;
  margin-top: 4px;
  font-weight: 400;
}

.badge-sub, .badge-formula {
  background: rgba(56, 189, 248, 0.08);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.25);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
}

/* Right: Navigation Actions Group */
.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Nav Button Base - Low contrast, recedes naturally */
.btn-nav {
  background: #0f172a;
  color: #94a3b8;
  border: 1px solid #1e293b;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
  box-sizing: border-box;
}

.btn-nav:hover {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

/* Active Nav State - Subtle Muted Pill, Zero Neon Glow */
.btn-nav.active {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}

/* Refresh Action Button */
.btn-nav.btn-refresh {
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.05);
}

.btn-nav.btn-refresh:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #ffffff;
  border-color: rgba(56, 189, 248, 0.4);
}

.btn-nav.btn-refresh.loading i {
  animation: navSpin 1s linear infinite;
}

@keyframes navSpin {
  100% { transform: rotate(360deg); }
}

/* Dropdown Container */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

/* Dropdown Menu Box - Crisp Flat Layering */
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 210px;
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  z-index: 99999;
  text-align: left;
  box-sizing: border-box;
}

/* Safe Hover Bridge */
.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 6px;
}

/* Display Menu on Hover & Click/Open */
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  display: block;
  animation: navMenuFadeIn 0.12s ease-out;
}

@keyframes navMenuFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Dropdown Right-Aligned */
.nav-dropdown.dropdown-right .nav-dropdown-menu,
.nav-dropdown-menu.align-right {
  right: 0;
  left: auto;
}

/* Dropdown Item Link */
.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s ease;
  white-space: nowrap;
  box-sizing: border-box;
}

.nav-dropdown-item i {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  color: #64748b;
  transition: color 0.12s ease;
}

.nav-dropdown-item:hover {
  background: #1e293b;
  color: #f8fafc;
}

.nav-dropdown-item:hover i {
  color: #94a3b8;
}

/* Dropdown Item Active - Flat border indicator */
.nav-dropdown-item.active {
  background: #1e293b !important;
  color: #f8fafc !important;
  font-weight: 600 !important;
  box-shadow: none !important;
  border-left: 2px solid #38bdf8;
  border-radius: 2px 4px 4px 2px;
}

.nav-dropdown-item.active i {
  color: #38bdf8 !important;
}

/* Dropdown Divider Line */
.nav-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

/* Mobile & Tablet Responsive Adjustments */
@media (max-width: 768px) {
  .unified-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .title-group {
    width: 100%;
    justify-content: space-between;
  }

  .title-group h1 {
    font-size: 18px;
  }

  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-nav {
    padding: 6px 10px;
    font-size: 12px;
    flex: 1 1 auto;
    justify-content: center;
  }

  .nav-dropdown {
    flex: 1 1 auto;
  }

  .nav-dropdown .btn-nav {
    width: 100%;
  }

  .nav-dropdown-menu {
    min-width: 190px;
    max-width: 92vw;
  }
}
