/**
 * htbx|club Navigation System
 * Mobile: Bottom navigation bar (app-style)
 * Desktop: Top navigation bar (traditional)
 */

/* ========================================
   TOP NAV (Desktop Only)
   ======================================== */

.nav-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height-top);
  background: rgba(76, 29, 149, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border-light);
  z-index: 1998; /* Above modal scrim (1999) but below modal content (2000) - keeps brand visible */
  /* Hidden on mobile, shown on desktop */
  display: none;
}

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

.nav-top-container {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: visible; /* Allow dropdowns to extend beyond container */
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  text-decoration: none;
}

.nav-top-menu {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  overflow: visible; /* Allow dropdowns to extend beyond menu */
}

.nav-top-link {
  color: var(--color-text);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.nav-top-link:hover {
  color: var(--color-primary);
}

.nav-top-link.active {
  color: var(--color-primary);
}

/* ========================================
   BOTTOM NAV (Mobile Only - App Style)
   ======================================== */

.nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height-bottom);
  /* Balanced purple-tinted glass: maintains glass effect with better contrast */
  background: rgba(76, 29, 149, 0.7);
  backdrop-filter: blur(var(--glass-blur-2));
  -webkit-backdrop-filter: blur(var(--glass-blur-2));
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2), 
              0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  z-index: 1998; /* Above modal scrim (1999) but below modal content (2000) - keeps brand visible */
  /* Shown on mobile, hidden on desktop */
  display: flex;
  /* Safe area for iPhone notch/home indicator */
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--space-2));
  /* Ensure nav is always visible - prevent any transforms or positioning issues */
  transform: translateZ(0); /* Force hardware acceleration and ensure proper rendering */
  will-change: transform; /* Optimize for rendering */
}

@supports not (backdrop-filter: blur(1px)) {
  .nav-bottom {
    background: rgba(76, 29, 149, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
  }
}

.no-glass .nav-bottom {
  background: rgba(76, 29, 149, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
}

@media (min-width: 768px) {
  .nav-bottom {
    display: none;
  }
}

.nav-bottom-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--space-2) var(--space-4) 0;
  position: relative;
}

/* Ensure Journal button takes up space in flex layout for proper spacing */
/* Note: Journal button styling is defined below, this is just for flex spacing */

.nav-bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border-radius: var(--radius-sm);
  /* Minimum touch target */
  min-height: 48px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  /* Subtle text shadow for legibility without being heavy */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.nav-bottom-item:active {
  transform: scale(0.95);
}

.nav-bottom-item.active {
  color: var(--color-highlight);
  background: rgba(245, 158, 11, 0.12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-weight: var(--font-weight-semibold);
}

.nav-bottom-item:not(.active):hover {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ========================================
   JOURNAL BUTTON - FLAGSHIP PRODUCT
   Circular button elegantly elevated above nav bar
   ======================================== */

.nav-bottom-journal {
  /* Circular button that sits above the nav bar */
  position: relative; /* Keep in flex flow for spacing */
  flex: 0 0 auto; /* Don't flex - maintain fixed size */
  width: 64px;
  height: 64px;
  min-width: 64px; /* Prevent shrinking */
  max-width: 64px; /* Prevent growing */
  aspect-ratio: 1; /* Ensure perfect circle */
  border-radius: 50%;
  background: var(--color-primary);
  color: white !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: var(--space-2) 0 var(--space-1);
  margin: 0 auto; /* Center within its flex space */
  /* Elevate above nav bar */
  transform: translateY(-8px);
  /* Elegant shadow for depth */
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4),
              0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
  /* Remove default nav item styling */
  border-radius: 50% !important;
  min-height: auto;
  box-sizing: border-box; /* Include padding in width/height */
}

/* Icon - larger and centered in top portion */
.nav-bottom-journal .nav-bottom-icon {
  font-size: 1.75rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: none;
  margin-top: var(--space-1);
  flex-shrink: 0;
}

.nav-bottom-journal .nav-bottom-icon svg {
  width: 28px;
  height: 28px;
  fill: white;
  flex-shrink: 0; /* Prevent icon from shrinking */
  /* Ensure icon maintains aspect ratio */
  object-fit: contain;
}

/* Show label below circular button */
.nav-bottom-journal .nav-bottom-label {
  display: block !important;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  color: white !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  line-height: 1;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Hover state - subtle lift and glow */
.nav-bottom-journal:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5),
              0 4px 12px rgba(0, 0, 0, 0.3);
  background: var(--color-primary-hover);
}

/* Active state - slightly pressed in */
.nav-bottom-journal.active {
  transform: translateY(-6px);
  box-shadow: 0 2px 12px rgba(236, 72, 153, 0.4),
              0 1px 4px rgba(0, 0, 0, 0.2);
  background: var(--color-primary);
}

/* Pressed state */
.nav-bottom-journal:active {
  transform: translateY(-4px) scale(0.95);
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3),
              0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Icon container */
.nav-bottom-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* Subtle filter for icon contrast */
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* SVG icons in nav */
.nav-bottom-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  /* Ensure icons inherit the filter */
  filter: inherit;
}

/* Badge on nav items (for notifications) - positioned at top-right of entire nav item */
.nav-bottom-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  color: white;
  border-radius: 9px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 10;
  line-height: 1;
}

/* Label */
.nav-bottom-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  white-space: nowrap;
  /* Inherit text shadow from parent for consistency */
  text-shadow: inherit;
}

/* Badge on nav items (for notifications) - consolidated with above */

/* More button styling - make it look normal, not disabled */
.nav-bottom-more {
  color: rgba(255, 255, 255, 0.75) !important;
  background: none;
  border: none;
  font-family: inherit;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.nav-bottom-more.active {
  color: var(--color-highlight) !important;
  background: rgba(245, 158, 11, 0.12);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  font-weight: var(--font-weight-semibold);
}

/* ========================================
   MOBILE HEADER (Logo Only)
   ======================================== */

.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height-top);
  background: rgba(76, 29, 149, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border-light);
  z-index: 1998; /* Above modal scrim (1999) but below modal content (2000) - keeps brand visible */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  /* Fixed positioning creates positioning context for absolutely positioned children */
}

.mobile-header .offline-status-indicator {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
}

@media (min-width: 768px) {
  .mobile-header {
    display: none;
  }
}

.mobile-header-back {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  padding: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  z-index: 1;
  -webkit-tap-highlight-color: transparent;
}

.mobile-header-back:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 1);
}

.mobile-header-back:active {
  transform: translateY(-50%) scale(0.95);
}

.mobile-header-back svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

.mobile-header-logo {
  font-size: 1.25rem;
  flex: 1;
  text-align: center;
  font-weight: 700;
  background-clip: unset;
  -webkit-background-clip: unset;
  color: rgba(255, 255, 255, 1);
}

/* Header Profile Avatar (Mobile & Desktop) */
.header-profile-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #EC4899, #F59E0B);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  font-weight: var(--font-weight-bold);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.header-profile-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.header-profile-avatar:active {
  transform: scale(0.95);
}

.header-profile-avatar.active {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.7), 0 6px 14px rgba(245, 158, 11, 0.35);
  border-color: rgba(245, 158, 11, 0.9);
  transform: scale(1.05);
}

/* Golden background square behind the circular avatar when active */
.header-profile-avatar.active::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(246, 173, 85, 0.85));
  z-index: -1;
}

.header-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.25rem;
  line-height: 1;
}

/* Mobile header avatar positioning */
.mobile-header .header-profile-avatar {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
}

/* Desktop nav avatar positioning */
.nav-top-menu .header-profile-avatar {
  margin-right: var(--space-2);
}

/* Header Login Button (shown when user is not authenticated) */
.header-login-btn {
  padding: var(--space-2) var(--space-4);
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-md);
  color: var(--color-highlight);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.header-login-btn:hover {
  background: rgba(245, 158, 11, 0.3);
  border-color: rgba(245, 158, 11, 0.6);
  transform: translateY(-1px);
}

.header-login-btn:active {
  transform: translateY(0);
}

/* Mobile header login button positioning */
.mobile-header .header-login-btn {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
}

/* Desktop nav login button positioning */
.nav-top-menu .header-login-btn {
  margin-right: var(--space-2);
}

/* ========================================
   NOTIFICATION BELL (Integrated in Nav)
   ======================================== */

/* Desktop: In top nav */
.nav-notification-bell {
  position: relative;
}

.notification-bell-button {
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-bell-button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

.notification-bell-button svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.notification-bell-button.open {
  color: var(--color-highlight);
}

/* ========================================
   MORE MENU OVERLAY - Compact, Clean Design
   ======================================== */

.more-menu-overlay {
  position: fixed;
  bottom: var(--nav-height-bottom);
  left: 0;
  right: 0;
  z-index: 2001; /* above bottom nav (1999) and under modals (2000+) */
  display: none;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  pointer-events: none; /* allow clicks to pass when closed */
}

.more-menu-overlay.open {
  display: block;
  animation: slideUpFade 0.2s ease;
  pointer-events: auto;
}

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.more-menu-content {
  /* Use glass Level 2 for menu */
  background: var(--glass-bg-2);
  backdrop-filter: blur(var(--glass-blur-2));
  -webkit-backdrop-filter: blur(var(--glass-blur-2));
  border-top: 1px solid var(--glass-border-2);
  box-shadow: var(--glass-elevation-2);
  padding: var(--space-2);
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
}

@supports not (backdrop-filter: blur(1px)) {
  .more-menu-content {
    background: rgba(76, 29, 149, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
  }
}

.no-glass .more-menu-content {
  background: rgba(76, 29, 149, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
}

.more-menu-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-1);
}

.more-menu-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  font-size: var(--font-size-xs);
  min-height: 70px;
  text-align: center;
}

.more-menu-link:hover,
.more-menu-link:active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

.more-menu-link.active {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-highlight);
  font-weight: var(--font-weight-semibold);
}

.more-menu-link.more-menu-logout {
  background: rgba(239, 68, 68, 0.1);
  color: #EF4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.more-menu-link.more-menu-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
}

.more-menu-icon {
  font-size: 1.75rem;
  line-height: 1;
}

/* Hide More menu on desktop */
@media (min-width: 768px) {
  .more-menu-overlay {
    display: none !important;
  }
}

/* ========================================
   RESPONSIVE BEHAVIOR
   ======================================== */

/* Prevent scrolling behind nav */
body.nav-open {
  overflow: hidden;
}

/* Safe area handling for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .nav-bottom {
    padding-bottom: calc(env(safe-area-inset-bottom) + var(--space-2));
  }
}

