/* ARSES shared global navbar component */

:root {
  --header-height: 72px;
  --arses-mobile-nav-breakpoint: 900px;
}

#arses-navbar {
  display: block;
  min-height: 0;
}

/* Fixed header offset — skip pages that already include header height in their layout */
#arses-navbar ~ main:not(.categories-page) {
  padding-top: var(--header-height, 72px);
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  transition: background 250ms ease, box-shadow 250ms ease, backdrop-filter 250ms ease;
}

.header.is-scrolled {
  background: rgba(246, 247, 245, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.arses-navbar .container,
#arses-navbar .container {
  width: 100%;
  max-width: var(--container, 1400px);
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 768px) {
  .arses-navbar .container,
  #arses-navbar .container {
    padding: 0 24px;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #111);
  flex: 0 1 auto;
  flex-shrink: 0;
}

.logo__text {
  letter-spacing: 0.08em;
}

.nav {
  display: none;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted, #6b7280);
  border-radius: 8px;
  transition: color 250ms ease, background 250ms ease;
  text-decoration: none;
}

.nav__link:hover {
  color: var(--primary, #1f7a5c);
  background: var(--primary-light, #e8f5ef);
}

.nav__link--active {
  color: var(--primary, #1f7a5c);
  background: var(--primary-light, #e8f5ef);
  font-weight: 600;
}

.header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.location-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted, #6b7280);
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 100px;
  transition: border-color 250ms ease;
}

.location-btn:hover {
  border-color: var(--primary, #1f7a5c);
  color: var(--primary, #1f7a5c);
}

.location-btn .arses-cart-count {
  background: var(--primary, #1f7a5c);
  color: #fff;
}

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 10px;
  transition: background 250ms ease;
}

.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text, #111);
  border-radius: 2px;
  transition: transform 250ms ease, opacity 250ms ease;
}

.hamburger.is-active span:nth-child(1),
.hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.is-active span:nth-child(2),
.hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.hamburger.is-active span:nth-child(3),
.hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav.is-open {
  display: block;
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  width: 100%;
  background: rgba(246, 247, 245, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.nav.is-open .nav__list {
  flex-direction: column;
  align-items: stretch;
}

.nav.is-open .nav__link {
  display: block;
  padding: 12px 16px;
  font-size: 1rem;
}

.arses-mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(17, 17, 17, 0.35);
  border: 0;
  padding: 0;
  margin: 0;
}

.arses-mobile-nav-overlay[hidden] {
  display: none !important;
}

body.nav-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .hamburger {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .avatar-btn {
    display: inline-flex;
    flex: 0 0 auto;
  }

  .location-btn {
    display: none;
  }

  header.header.is-open {
    z-index: 1001;
  }

  header.header.is-open .nav.is-open,
  .nav.is-open {
    display: block;
    pointer-events: auto;
    z-index: 1000;
  }
}

@media (min-width: 901px) {
  .nav {
    display: block;
  }

  .location-btn {
    display: flex;
  }

  .hamburger {
    display: none !important;
  }

  body.nav-open {
    overflow: auto;
  }

  .arses-mobile-nav-overlay {
    display: none !important;
  }
}

@media (min-width: 1024px) {
  .nav__list {
    gap: 4px;
  }
}

.nav__item--mobile-cart {
  display: none;
}

@media (max-width: 900px) {
  .nav__item--mobile-cart {
    display: list-item;
  }

  .nav__link--mobile-cart {
    display: flex !important;
    align-items: center;
    gap: 10px;
  }

  .nav__cart-count {
    margin-left: auto;
    flex: 0 0 auto;
  }

  .nav__link--mobile-cart .nav__cart-count {
    background: var(--primary, #1f7a5c);
    color: #fff;
  }
}

@media (min-width: 901px) {
  .nav__item--mobile-cart {
    display: none !important;
  }
}
