/* =========================================
   NAVBAR.CSS - FIXED DROPDOWN POSITIONING
   Desktop navigation with responsive behavior
   ========================================= */

/* =========================================
   BASE NAVBAR STYLES (DESKTOP)
   ========================================= */

.navbar {
  position: relative;
  z-index: 1000;
}

.desktop-nav {
  position: relative;
  z-index: 1001;
  margin-right: 5px;
}

.desktop-nav ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.desktop-nav li {
  position: relative;
  font-size: 16px;
  height: auto;
  display: flex;
  align-items: center;
}

.desktop-nav a {
  text-decoration: none;
  font-weight: bold;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px; /* Touch-friendly */
  padding: 8px 10px; /* Increased left and right padding */
  border: 2px solid transparent;
  border-radius: 5px;
  transition: background-color 0.3s ease, border 0.3s ease, color 0.3s ease;
  box-sizing: border-box;
}

.desktop-nav a:hover {
  background-color: white;
  border: 2px solid white;
  border-radius: 5px;
  color: black;
}

.desktop-nav li:nth-child(3) a {
  padding: 8px 10px;
}

/* =========================================
   SOCIAL ICONS
   ========================================= */

.social-icon-nav-container {
  display: flex;
  align-items: center;
}

.social-icon-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: background-color 0.3s ease, border 0.3s ease, color 0.3s ease;
  color: white;
  text-decoration: none;
  font-weight: bold;
  height: 50px;
  width: 50px;
  min-height: 44px;
  min-width: 44px;
  box-sizing: border-box;
}

.social-icon-nav svg {
  stroke: currentcolor;
  width: 30px;
  height: 30px;
  fill: none;
  stroke-width: 2;
  padding-right: 1px;
}

.social-icon-nav:hover {
  background-color: white;
  border: 2px solid white;
  color: black;
}

/* =========================================
   ACCOUNT DROPDOWN - FIXED POSITIONING
   ========================================= */

.account-dropdown {
  position: relative;
  display: inline-block;
  z-index: 3000;
}

/* CRITICAL FIX: Ensure dropdown content is positioned correctly */
.account-dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 8px); /* Position below the trigger with gap */
  right: 0; /* Align to right edge of parent */
  background-color: black;
  padding: 8px;
  border: 3px solid white;
  border-radius: 8px;
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 9999; /* Very high z-index to ensure it's on top */
  min-width: 160px;
  white-space: nowrap;
  box-sizing: border-box;
  /* CRITICAL: Prevent clipping by parent containers */
  overflow: visible;
}

/* Show dropdown on hover */
.account-dropdown:hover .account-dropdown-content {
  display: block;
}

/* Invisible hover area to prevent dropdown from disappearing */
.account-dropdown-content::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 20px;
  background: transparent;
  z-index: 9998;
}

.account-dropdown-content a {
  color: white;
  font-weight: bold;
  text-decoration: none;
  padding: 10px 12px;
  display: flex; /* Use flexbox for better vertical centering */
  align-items: center; /* Center vertically */
  justify-content: flex-start; /* Default: align text to the left */
  transition: all 0.3s ease;
  text-align: left; /* Default: text left-aligned */
  border: 2px solid transparent;
  box-sizing: border-box;
  width: 100%;
  background: none;
  font-size: 16px;
  cursor: pointer;
  margin: 2px 0;
  border-radius: 5px;
  min-height: 44px; /* Touch-friendly */
  min-width: 300px;
  line-height: 1.2;
}

/* Logged out state - center align login/register text */
.account-dropdown-content a[href*="login"] {
  justify-content: center;
  text-align: center;
}

.account-dropdown-content a:hover {
  background-color: white;
  border: 2px solid white;
  color: black;
}

/* Username display in dropdown */
.username-display {
  padding: 12px;
  font-weight: bold;
  border-bottom: 2px solid white;
  margin-bottom: 8px;
  color: white;
  font-size: 14px;
  text-align: left;
}

/* =========================================
   HEADER CONTAINER FIXES
   ========================================= */

/* CRITICAL: Ensure header doesn't clip dropdown */
header {
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 100%;
  height: 100px;
  box-sizing: border-box;
  margin: 0;
  background-color: inherit;
  z-index: 3002;
  /* IMPORTANT: Allow overflow for dropdown */
  overflow: visible;
}

.header-container {
  max-width: 1200px;
  width: calc(100% - 40px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0;
  box-sizing: border-box;
  /* IMPORTANT: Allow overflow for dropdown */
  overflow: visible;
}

/* =========================================
   NAVBAR LINK STYLES
   ========================================= */

.navbar-link a {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: background-color 0.3s ease, border 0.3s ease;
  min-height: 44px;
  box-sizing: border-box;
}

.navbar-link a:hover {
  background-color: white;
  border: 2px solid white;
  border-radius: 5px;
  color: black;
}

.navbar-link a.active {
  background-color: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

/* =========================================
   LOGIN BUTTON STYLES
   ========================================= */

.nav-login-button {
  background: none;
  border: 2px solid transparent;
  color: white;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 5px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
  min-height: 44px;
  box-sizing: border-box;
}

.nav-login-button:hover {
  background-color: white;
  border: 2px solid white;
  color: black;
}

/* =========================================
   VISIBILITY CONTROLS - REMOVED
   Note: All visibility now controlled explicitly by JavaScript
   ========================================= */

/* =========================================
   RESPONSIVE BREAKPOINTS
   ========================================= */

/* Large tablets and below (992px and below) */
@media (max-width: 992px) {
  .desktop-nav ul {
    gap: 1.5rem;
  }

  .desktop-nav li {
    font-size: 16px;
  }

  .desktop-nav a {
    font-size: 16px;
  }

  .account-dropdown-content {
    min-width: 140px;
    right: 0; /* Keep aligned to right */
  }

  .account-dropdown-content a {
    padding: 8px 10px;
    font-size: 15px;
  }

  .social-icon-nav svg {
    width: 30px;
    height: 30px;
  }
}

/* Small tablets and large phones (850px and below) */
@media (max-width: 850px) {
  .navbar {
    display: none;
  }

  .desktop-nav {
    display: none !important;
  }
}

/* Tablets (768px and below) */
@media (max-width: 768px) {
  .account-dropdown-content {
    right: 0;
    min-width: 130px;
    padding: 6px;
  }

  .account-dropdown-content a {
    padding: 8px;
    font-size: 14px;
    min-height: 40px;
  }

  .username-display {
    padding: 8px;
    font-size: 13px;
  }
}

/* Small phones (480px and below) */
@media (max-width: 480px) {
  .account-dropdown-content {
    right: 0;
    min-width: 120px;
    padding: 4px;
  }

  .account-dropdown-content a {
    padding: 6px 8px;
    font-size: 13px;
    min-height: 38px;
  }

  .username-display {
    padding: 6px;
    font-size: 12px;
  }
}

/* Show desktop nav on larger screens */
@media (min-width: 851px) {
  .desktop-nav {
    display: block !important;
  }

  .navbar {
    display: block;
  }
}
