/* ==========================================================================
   NAVIGATION
   ========================================================================== */

/* --- Auth Container Animations --- */
/* Defines the style for auth containers with animation. */
#user-logged-in, #user-logged-out {
    opacity: 0;
    transform: translateY(-0.5rem);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* Defines the style for auth containers when they become visible. */
#user-logged-in.visible, #user-logged-out.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Base Navigation Styles --- */
#main-nav {
  padding: 0 2rem;
  border-bottom: 1px solid #30363d;
  background-color: #0d1117;
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: transform 0.3s ease-in-out;
}

#main-nav.nav-hidden {
    transform: translateY(-100%);
}

#main-nav.nav-scrolled {
    background-color: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(0.625rem);
}

.nav-content-wrapper {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 2rem; /* This now controls the spacing around the logo */
  height: 4.6875rem;
  max-width: 100rem;
  margin: 0 auto;
  position: relative;
}

.logo-center {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.25rem;
  letter-spacing: 0.0938rem;
  padding: 0 2rem;
  flex-shrink: 0; /* Prevents logo from being squished */
  white-space: nowrap; /* Prevents the logo text from wrapping */
}

.logo-center a {
  color: #fff;
  text-decoration: none;
}

.nav-group {
  display: flex;
  align-items: center;
  flex: 1; /* Key for making left/right groups take equal space */
}

.nav-left {
  justify-content: flex-start;
  justify-self: end;
}
.nav-right-content {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-right {
  justify-content: flex-end;
}



.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-grow: 1;
}

.nav-links.nav-right {
    flex-grow: 0;
}

.nav-links a {
  padding: 0.5rem 0.75rem;
  color: #8b949e;
  text-decoration: none;
  font-weight: 500;
  border-radius: 0.375rem;
  transition: background-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover {
  background-color: #21262d;
  color: #fff;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-auth.auth-loading {
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

.nav-auth.auth-loading #user-logged-in,
.nav-auth.auth-loading #user-logged-out {
  display: none;
}

.nav-auth-desktop {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1.5rem;
}

/* --- Responsive Adjustments for Medium Screens --- */
@media (max-width: 81.25rem) and (min-width: 64.0625rem) {
  .nav-content-wrapper {
    gap: 1.5rem; /* Reduce gap on medium screens */
  }
  .logo-center {
    font-size: 2rem; /* Slightly smaller logo */
  }
  .nav-links a {
    padding: 0.5rem 0.6rem; /* Adjust padding */
    font-size: 0.9rem; /* Smaller font for links */
  }
}

/* --- Mobile Navigation Styles --- */
.menu-toggle {
  display: none;
}
.mobile-menu {
  display: none;
}

@media (max-width: 64rem) {
  #main-nav {
    padding: 0 1.5rem;
  }
  .nav-links.nav-left,
  .nav-right-content {
    display: none;
  }
  .logo-center {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0;
  }
  .menu-toggle {
    display: block;
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
  }
  .menu-toggle svg {
    width: 1.75rem;
    height: 1.75rem;
  }
}

.mobile-menu {
    display: none; /* Hidden by default */
    padding: 1.25rem;
    background-color: #0D1117; /* Match your dark theme */
    border-top: 1px solid #30363D;
}

.mobile-menu.is-open {
    display: block; /* Show when active */
}

/* Style the cloned elements for mobile view */
.mobile-menu .nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9375rem;
    margin-bottom: 1.25rem;
}

.mobile-menu .nav-links a {
    font-size: 1.2rem;
}

.nav-auth-mobile {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    border-top: 1px solid #30363D;
    padding-top: 1.25rem;
}
.nav-auth-mobile #user-logged-in,
.nav-auth-mobile #user-logged-out {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}
.nav-auth-mobile .btn-primary,
.nav-auth-mobile .btn-secondary {
    width: 100%;
    text-align: center;
}

.no-scroll {
    overflow: hidden;
}

#user-logged-in {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#user-email {
  font-weight: 500;
  color: var(--text-secondary);
}

/* --- Profile Link Avatar --- */
.nav-profile-link {
    display: flex;
    align-items: center;
    gap: 0.625rem; /* Space between avatar and name */
}

.nav-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover; /* Ensures the image covers the area without distortion */
    border: 0.125rem solid #30363d;
    transition: border-color 0.2s;
}

.nav-profile-link:hover .nav-avatar {
    border-color: #8b949e;
}

/* Dropdown Menu Styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    background-color: #161b22;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 100;
    border-radius: 6px;
    padding: 5px 0;
    margin-top: 5px;
    border: 1px solid #30363d;
}

.dropdown-menu a {
    color: #8b949e;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-weight: 500;
    font-size: 0.9rem;
}

.dropdown-menu a:hover {
    background-color: #21262d;
    color: #fff;
}

.dropdown.is-active .dropdown-menu {
    display: block;
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 0.7em;
    vertical-align: middle;
    margin-left: 5px;
    display: inline-block;
}
