/* components/nav/nav.css
   Clean, modern navbar — mobile-first.
   Uses CSS variables from base.css.
   ──────────────────────────────────── */

/* ── Navbar shell ─────────────────────────────────────────────────────────── */
.navbar {
  height: 4rem;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  padding: 0 1rem;
  /* tighter padding on mobile */
  background: white;
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  /* Allow dropdown menus to extend beyond navbar bounds */
  overflow: visible;
  /* Stick to viewport top so back arrow and user menu are always reachable.
     -webkit-sticky required for older Android WebViews (Huawei, AOSP).
     z-index 1002: must exceed settings-view--active (1001) so the user
     dropdown panel is never painted behind a slide-in settings view. */
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1002;
}

/* ── Back button (shown on sub-pages; absent on home) ────────────────────── */
.navbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  /* 44px touch target — matches iOS HIG minimum */
  min-width: 44px;
  min-height: 44px;
  margin-right: 0.25rem;
  margin-left: -0.25rem;
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  flex-shrink: 0;
  transition: background-color 0.15s, color 0.15s;
}

.navbar__back:hover {
  background-color: var(--color-background-alt, #f0f0f0);
  color: var(--color-primary);
}

/* ── Logo / brand ─────────────────────────────────────────────────────────── */
.navbar__logo {
  height: 100%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  /* never shrink the logo */
}

.navbar__logo a {
  display: flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
  /* Prevent "NETPIX" or any inline brand text from wrapping on narrow screens */
  white-space: nowrap;
}

.brand {
  height: 36px;
  width: 36px;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.brand:hover {
  transform: scale(1.05);
}

/* ── Nav links (hidden on mobile) ─────────────────────────────────────────── */
.navlink__container {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  /* Prevent link text wrapping */
  white-space: nowrap;
}

.navlink {
  font-size: var(--font-size-base);
  font-weight: 500;
}

.navlink a {
  text-decoration: none;
  color: var(--color-text);
  transition: color 0.2s;
  font-weight: 500;
}

.navlink a:hover {
  color: var(--color-primary);
}

/* ── Auth buttons area ────────────────────────────────────────────────────── */
.auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
  /* keep auth buttons visible, never shrink them off screen */
}

/* Log in button — outline style */
.primary-btn {
  padding: 0.5rem 1rem;
  background-color: white;
  border: 1px solid var(--color-blue);
  color: var(--color-blue);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.primary-btn:hover {
  background-color: var(--color-blue-light);
  transform: translateY(-1px);
}

/* Sign up button — filled style */
.signup-btn {
  padding: 0.5rem 1rem;
  border: none;
  background-color: var(--color-blue);
  color: white;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  white-space: nowrap;
}

.signup-btn:hover {
  background-color: #357ABD;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
}

/* ── Mobile — hide nav links ──────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
  .navlink__container {
    display: none;
  }

  .navbar {
    padding: 0 1rem;
  }
}

/* ── Desktop — wider padding ──────────────────────────────────────────────── */
@media screen and (min-width: 769px) {
  .navbar {
    padding: 0 2rem;
  }

  .brand {
    height: 40px;
    width: 40px;
  }

  .primary-btn,
  .signup-btn {
    font-size: 0.95rem;
    padding: 0.6rem 1.5rem;
  }
}

/* ── Bottom tab bar (mobile only) ─────────────────────────────────────────── */

/* Hidden on desktop — the media query below enables it */
.bottom-tab-bar {
  display: none;
}

@media screen and (max-width: 768px) {
  /* Push page content above the fixed bar so nothing hides beneath it */
  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* 56px bar + iOS home-indicator clearance */
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: white;
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    /* Below modals/overlays (9998+) but above normal page content */
    z-index: 900;
  }

  .bottom-tab-bar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding-top: 6px;
    text-decoration: none;
    color: var(--color-text-light, #888);
    font-size: 10px;
    font-weight: 500;
    /* Minimum 44px touch target per iOS HIG */
    min-height: 44px;
    transition: color 0.15s;
  }

  .bottom-tab-bar__item--active {
    color: var(--color-accent, #2ECC71);
  }

  /* Icon wrapper — needed to position the cart badge relative to the icon */
  .bottom-tab-bar__icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Cart badge: small red dot, top-right of the shop icon */
  .bottom-tab-bar__icon-wrap .shop-cart-badge {
    position: absolute;
    top: -5px;
    right: -9px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
    background: #e74c3c;
    color: white;
    border-radius: 8px;
    /* Override any inherited display/positioning from global .shop-cart-badge */
    display: block !important;
  }

  /* Avatar in Account tab — circle crop matching icon size */
  .bottom-tab-bar__avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--color-border);
  }

  /* Hide on scroll-down, reveal on scroll-up (Reddit pattern).
     transform instead of display/height so the transition animates.
     The bar stays within the page flow at all times; only its
     visual position shifts. */
  .bottom-tab-bar--hidden {
    transform: translateY(100%);
    /* Slightly faster hide than the default to feel snappy */
    transition: transform 0.22s ease-in;
  }

  .bottom-tab-bar {
    /* Smooth reveal on scroll-up */
    transition: transform 0.28s ease-out;
  }
}