/* Navbar Styles */

/* Base Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0;
  margin: 0;
  width: 100%;
  box-shadow: 0 2px 4px var(--shadow);
}

[data-theme="dark"] .navbar {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--accent-border);
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  max-width: 100%;
  overflow: visible;
}

/* Hamburger Menu Button (Mobile Only) */
.nav-hamburger {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-hamburger:hover {
  background: var(--bg-hover);
  border-color: var(--accent-border);
}

.nav-hamburger:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hamburger-icon {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s ease;
}

.hamburger-icon::before {
  transform: translateY(-6px);
}

.hamburger-icon::after {
  transform: translateY(6px);
}

.nav-hamburger[aria-expanded="true"] .hamburger-icon {
  background: transparent;
}

.nav-hamburger[aria-expanded="true"] .hamburger-icon::before {
  transform: translateY(0) rotate(45deg);
}

.nav-hamburger[aria-expanded="true"] .hamburger-icon::after {
  transform: translateY(0) rotate(-45deg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Brand/Home Link */

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
  max-width: clamp(200px, 40vw, 420px);
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-brand:hover {
  color: var(--accent);
}

/* Sponsor Switch */
.nav-sponsor-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-sponsor-form {
  margin: 0;
}

.nav-sponsor-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-secondary);
  box-shadow: 0 4px 12px var(--shadow-sm);
  min-width: 190px;
  max-width: 260px;
}

[data-theme="dark"] .nav-sponsor-pill {
  background: var(--glass-bg);
  border-color: var(--accent-border);
}

.nav-sponsor-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.16);
  color: var(--accent);
  flex-shrink: 0;
}

.nav-sponsor-pill-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.nav-sponsor-pill-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-sponsor-pill-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-sponsor-pill-chevron {
  color: var(--text-muted);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-sponsor-pill--single {
  max-width: none;
  padding-right: 18px;
}

.nav-sponsor-pill--drawer {
  width: 100%;
}

.nav-sponsor-pill--select {
  position: relative;
  cursor: pointer;
}

.nav-sponsor-pill-trigger {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  opacity: 0;
  cursor: pointer;
}

.nav-sponsor-pill-trigger:focus-visible {
  outline: none;
  border-radius: 12px;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.nav-sponsor-pill-trigger option {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

[data-theme="dark"] .nav-sponsor-pill-trigger option {
  color: var(--text-primary);
  background: #2d2d39;
}

.drawer-sponsor-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-sponsor-form .nav-sponsor-pill {
  width: 100%;
  max-width: 100%;
}

@media (max-width: 768px) {
  .nav-sponsor-switch {
    display: none;
  }
}

/* Primary Navigation */
.nav-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.nav-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-pill:hover,
.nav-pill:focus {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--accent);
  outline: none;
}

.nav-pill i {
  font-size: 1rem;
}

.nav-item.active {
  background: var(--bg-hover);
  color: var(--accent);
}

.nav-item i {
  font-size: 1rem;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-text {
  display: inline;
}

/* Badge for counts (cart, notifications) */
.nav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--error);
  color: var(--text-inverse);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
  min-width: 18px;
  padding: 0 2px;
}

/* Right Side Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(148, 163, 184, 0.08);
  color: var(--text-primary);
  text-decoration: none;
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.nav-icon:hover,
.nav-icon:focus {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.45);
  color: var(--accent);
  outline: none;
}

@media (max-width: 1150px) {
  .nav-primary {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-brand {
    display: none;
  }

  .nav-actions {
    margin-left: auto;
  }

  .nav-actions .nav-icon,
  .nav-actions .nav-logout {
    display: none;
  }

  .nav-container {
    gap: 12px;
  }
}

/* Points Badge */
.nav-points {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--accent);
  color: var(--text-inverse);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.nav-points strong {
  margin-left: 4px;
}

.nav-points .nav-points-suffix {
  margin-left: 4px;
  font-weight: 600;
}

.nav-points:hover,
.nav-points:focus {
  filter: brightness(1.05);
  transform: translateY(-1px);
  outline: none;
}

/* Profile */
.nav-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.nav-profile:hover {
  background: var(--bg-hover);
}

.nav-profile:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-profile img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.nav-profile-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.nav-profile-initial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

/* Logout Button */
.nav-logout {
  padding: 6px 12px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-logout:hover {
  background: var(--bg-hover);
  border-color: var(--accent-border);
  color: var(--accent);
}

.nav-logout:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Theme Toggle */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--accent-border);
}

.theme-toggle:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Mobile Drawer */
.nav-drawer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  pointer-events: none;
}

.nav-drawer.open {
  display: block;
  pointer-events: auto;
}

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.nav-drawer.open .drawer-overlay {
  opacity: 1;
}

.drawer-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 85vw;
  height: 100%;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 20px var(--shadow-lg);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text-primary);
  z-index: 1;
}

[data-theme="dark"] .drawer-content {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right-color: var(--accent-border);
}

.nav-drawer.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.drawer-close {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.2s ease;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drawer-close:hover {
  background: var(--bg-hover);
  border-color: var(--accent-border);
}

.drawer-close:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.drawer-section {
  margin-bottom: 24px;
}

.drawer-section h3 {
  margin: 0 0 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  position: relative;
  z-index: 2;
}

.drawer-item span,
.drawer-item i {
  color: inherit;
}

.drawer-item:hover {
  background: var(--bg-hover);
  border-left-color: var(--accent);
}

.drawer-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.drawer-item.active {
  background: var(--bg-hover);
  border-left-color: var(--accent);
  color: var(--accent);
}

.drawer-item i {
  width: 20px;
  text-align: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.drawer-item-badge {
  margin-left: auto;
  background: var(--error);
  color: var(--text-inverse);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Body scroll lock when drawer is open */
body.drawer-open {
  overflow: hidden;
}

body.drawer-open .app-content,
body.drawer-open #app-content {
  filter: blur(4px);
  transition: filter 0.3s ease;
  pointer-events: none;
}

/* Responsive Breakpoints */

/* Desktop (≥1280px) - Icon + Text */
@media (min-width: 1280px) {
  .nav-item {
    padding: 8px 14px;
  }

  .nav-text {
    display: inline;
  }

  .nav-profile-name {
    display: inline;
    max-width: 150px;
  }
}

/* Medium (768-1279px) - Icon Only */
@media (min-width: 768px) and (max-width: 1279px) {
  .nav-text {
    display: none;
  }

  .nav-item {
    padding: 8px 10px;
    min-width: 44px;
    justify-content: center;
  }

  .nav-profile-name {
    display: none;
  }

  .nav-points {
    padding: 6px 10px;
    font-size: 0.8rem;
  }
}

/* Mobile (<768px) - Hamburger Menu */
@media (max-width: 767px) {
  .nav-hamburger {
    display: flex;
  }

  .nav-primary {
    display: none;
  }

  .nav-logout {
    display: none;
  }

  .nav-points {
    font-size: 0.75rem;
    padding: 6px 8px;
  }

  .nav-profile-name {
    display: none;
  }

  .nav-container {
    padding: 10px 12px;
    gap: 8px;
  }

}

/* Very Small Mobile (<480px) */
@media (max-width: 479px) {
  .nav-points {
    display: none;
  }

  .nav-profile {
    padding: 2px;
  }

  .nav-profile img,
  .nav-profile-initial {
    width: 28px;
    height: 28px;
  }
}

