/* Navigation Bar Tactical Design System */

.navbar {
  background-color: rgba(17, 19, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  height: var(--navbar-height);
  position: sticky;
  top: 0;
  z-index: 3001;
  box-shadow: 0 1px 0 rgba(62, 73, 73, 0.15), 0 24px 48px rgba(0, 0, 0, 0.4);
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.navbar.is-scrolled {
  background-color: rgba(17, 19, 22, 0.92);
  box-shadow: 0 1px 0 rgba(62, 73, 73, 0.2), 0 24px 48px rgba(0, 0, 0, 0.5);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  gap: 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.navbar-brand__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.navbar-brand__link:hover {
  opacity: 0.85;
}

.navbar-brand__text {
  font-family: var(--font-family-heading);
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--t-primary-bright);
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.navbar-logo {
  height: 44px;
  width: auto;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-family: var(--font-family-heading);
  color: rgba(226, 226, 230, 0.90);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
  border: none;
  background: none;
  cursor: pointer;
  font: inherit;
}

.nav-link:hover {
  color: var(--t-on-surface);
  background: rgba(255, 255, 255, 0.05);
}

.navbar-links button.nav-link {
  display: inline-flex;
  align-items: center;
}

.nav-link.current,
.nav-link.active {
  color: var(--t-primary);
  border-bottom: 2px solid var(--t-primary);
  border-radius: 0;
  padding-bottom: calc(0.5rem - 2px);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
}

.cart-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: var(--t-on-surface);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}

.cart-link:hover {
  color: var(--t-primary);
  background: rgba(76, 214, 255, 0.08);
}

.cart-icon {
  width: 22px;
  height: 22px;
}

.cart-link-label {
  font-family: var(--font-family-heading);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--t-primary);
  color: var(--t-on-primary);
  font-size: 0.6rem;
  font-weight: 900;
  height: 16px;
  min-width: 16px;
  padding: 0 3px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 2px solid var(--t-surface);
}

.cart-badge.inline-flex {
  display: inline-flex;
}

.burger-menu {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.burger-menu:hover {
  background: rgba(255, 255, 255, 0.06);
}

.burger-bar {
  width: 22px;
  height: 2px;
  background-color: var(--t-on-surface);
  transition: all 0.25s;
}

@media (max-width: 768px) {
  .navbar-inner {
    justify-content: space-between;
    padding: 0 1rem;
  }

  .navbar-brand__text {
    font-size: 1rem;
  }

  .cart-link-label {
    display: none;
  }

  .navbar-logo {
    height: 40px;
  }

  .navbar-menu {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    right: 0;
    background-color: rgba(17, 19, 22, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.5rem 2rem;
    transform: translateY(-100%);
    transition: transform 0.25s ease-in-out, opacity 0.25s ease-in-out;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
    z-index: 2999;
    opacity: 0;
    pointer-events: none;
    gap: 0.25rem;
  }

  .navbar-menu.is-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .navbar-links {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0;
  }

  .nav-link {
    width: 100%;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(62, 73, 73, 0.2);
    border-radius: 0;
    font-size: 1rem;
  }

  .nav-link.current,
  .nav-link.active {
    border-bottom: 1px solid rgba(62, 73, 73, 0.2);
    border-left: 3px solid var(--t-primary);
    padding-left: 0.875rem;
    color: var(--t-primary);
  }

  .burger-menu {
    display: flex;
  }

  .burger-menu[aria-expanded='true'] .burger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .burger-menu[aria-expanded='true'] .burger-bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .burger-menu[aria-expanded='true'] .burger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ==========================================================================
   Theme Toggle Button
   ========================================================================== */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--t-on-surface);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
  padding: 0;
}

.theme-toggle:hover {
  color: var(--t-primary);
  background: rgba(var(--t-primary-rgb), 0.08);
}

.theme-icon--sun {
  display: none;
}

.theme-icon--moon {
  display: block;
}

:root[data-theme="light"] .theme-icon--sun {
  display: block;
}

:root[data-theme="light"] .theme-icon--moon {
  display: none;
}

/* Light mode overrides — navbar stays dark, so force light text */
:root[data-theme="light"] .cart-link {
  color: rgba(226, 226, 230, 0.90);
}

:root[data-theme="light"] .burger-bar {
  background-color: rgba(226, 226, 230, 0.90);
}

:root[data-theme="light"] .cart-link:hover {
  color: #a8b89e;
  background: rgba(168, 184, 158, 0.1);
}

:root[data-theme="light"] .theme-toggle {
  color: rgba(226, 226, 230, 0.8);
  border: none;
}

:root[data-theme="light"] .theme-toggle:hover {
  color: #a8b89e;
  background: rgba(168, 184, 158, 0.1);
}

:root[data-theme="light"] .navbar {
  background-color: rgba(17, 19, 22, 0.95);
}

:root[data-theme="light"] .navbar.is-scrolled {
  background-color: rgba(17, 19, 22, 0.98);
}

:root[data-theme="light"] .navbar-inner {
  background: transparent;
}

/* Active links need a lighter color on the always-dark navbar */
:root[data-theme="light"] .nav-link.active,
:root[data-theme="light"] .nav-link.current {
  color: #a8b89e;
  border-bottom-color: #a8b89e;
}

/* Dropdown must stay dark in light mode — it sits against the dark navbar */
:root[data-theme="light"] .nav-dropdown-menu {
  background: rgba(17, 19, 22, 0.97);
  border-color: rgba(80, 90, 80, 0.35);
}

:root[data-theme="light"] .nav-dropdown-menu .nav-link {
  color: rgba(226, 226, 230, 0.90);
}

:root[data-theme="light"] .nav-dropdown-menu .nav-link:hover {
  color: #E1E3DC;
  background: rgba(255, 255, 255, 0.07);
}

:root[data-theme="light"] .nav-dropdown-menu .nav-link.active,
:root[data-theme="light"] .nav-dropdown-menu .nav-link.current {
  color: #a8b89e;
  border-bottom: none;
  border-left: 2px solid #a8b89e;
  padding-left: calc(1rem - 2px);
}

/* ==========================================================================
   Nav Dropdown
   ========================================================================== */
.nav-dropdown {
  position: relative;
  list-style: none;
}

.nav-dropdown::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 0.5rem;
}

.nav-dropdown>button.nav-link {
  cursor: pointer;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-dropdown-caret {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  transition: transform 0.18s ease;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--t-surface-low, rgba(17, 19, 22, 0.97));
  border: 1px solid rgba(62, 73, 73, 0.25);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem 0;
  z-index: 4000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  list-style: none;
  margin: 0;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-dropdown:hover .nav-dropdown-caret,
.nav-dropdown:focus-within .nav-dropdown-caret,
.nav-dropdown.is-open .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown:hover>.nav-dropdown-trigger,
.nav-dropdown:focus-within>.nav-dropdown-trigger,
.nav-dropdown.is-open>.nav-dropdown-trigger {
  color: #a8b89e;
}

.nav-dropdown-menu li {
  list-style: none;
}

.nav-dropdown-menu .nav-link {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  font-size: 0.75rem;
  border-radius: 0;
  border-bottom: none;
}

.nav-dropdown-menu .nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--t-on-surface);
}

.nav-user-dropdown .nav-dropdown-menu {
  left: auto;
  right: 0;
}

.nav-user-dropdown .admin-nav-email {
  cursor: default;
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 768px) {
  .nav-user-dropdown .nav-dropdown-menu {
    left: auto;
    right: auto;
  }

  .nav-dropdown::after {
    display: none;
  }

  .nav-dropdown-trigger {
    width: 100%;
    justify-content: space-between;
  }

  .nav-dropdown-menu {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 3px solid rgba(62, 73, 73, 0.3);
    border-radius: 0;
    padding: 0 0 0 1rem;
    background: transparent;
  }

  .nav-dropdown-menu .nav-link {
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(62, 73, 73, 0.15);
  }
}

/* ===== Mobile menu slide-down animation ===== */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu.is-open {
  max-height: 600px;
}

/* ===== Hamburger → X morphing (CSS only) ===== */
.hamburger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  transform-origin: center;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.hamburger-icon.is-open .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-icon.is-open .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-icon.is-open .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}