/* public/nav.css */
.navbar {
  background-color: #fff;
  border-bottom: 1px solid #e0e0e0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  padding: 0; /* Avoid double padding with styles.css */
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  backdrop-filter: saturate(180%) blur(6px);
}

/* Reserve space to avoid layout shift when sticky */
body {
  /* Keep this in sync with body padding-top in styles.css */
  --nav-height: 80px;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  max-width: 1200px;
  margin: 0 auto;
  min-height: var(--nav-height);
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #333;
  text-decoration: none;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav-toggle .bar {
  width: 22px;
  height: 2px;
  background: #333;
  margin: 3px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-menu {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  gap: 1rem;
}

.nav-menu li {
  margin: 0;
}

.nav-link {
  text-decoration: none;
  color: #555;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-link:hover {
  color: #007bff;
  background-color: rgba(0, 123, 255, 0.08);
}

.nav-link.active {
  color: #0a58ca;
  background-color: rgba(13, 110, 253, 0.12);
}

.nav-login-button {
  background-color: #007bff;
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.05s ease;
}

.nav-login-button:hover {
  background-color: #0056b3;
}

/* Mobile */
@media (max-width: 768px) {
  /* Match the body padding-top defined in styles.css mobile breakpoint */
  body {
    --nav-height: 70px;
  }
  .nav-container {
    height: auto;
    padding: 0.5rem 1rem;
  }
  .nav-toggle {
    display: flex;
  }
  .nav-menu {
    position: absolute;
    /* Position the dropdown directly below the navbar, independent of a hardcoded height */
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 0.75rem 1rem 1rem;
    gap: 0.5rem;
    display: none !important; /* ensure hidden until toggled */
    animation: slideDown 180ms ease-out;
  }
  .nav-menu.show {
    display: flex !important;
  }
  #nav-logged-in,
  #nav-logged-out {
    display: none;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
