/*
============================================================
  Crimson Crown - Header Styles (header.css)
============================================================
  UPDATED: This file is now fully responsive,
  includes a mobile hamburger menu, and a 'min-height'
  to prevent content-jump on load.
*/

#main-header {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 1rem 0;
  transition: background-color 0.3s ease;

  /* THIS IS THE "SLOW LOAD" FIX.
    It reserves 80px of space so the content
    below doesn't "jump" when the header loads.
  */
  min-height: 80px;
  display: flex;
  align-items: center;
  background-color: var(--bg-color);
  /* Default bg */
}

/* This class is added by JavaScript on scroll */
#main-header.scrolled {
  background-color: rgba(10, 10, 10, 0.8);
  /* Dark bg with 80% opacity */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  /* For Safari */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 1536px;
  /* Use the wider container */
  margin: 0 auto;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
  /* Don't let logo shrink */
}

.nav-logo img {
  height: 40px;
  width: 40px;
  object-fit: contain;
}

.nav-logo span {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-color);
  /* Hide text on very small screens */
  display: none;
}

@media (min-width: 420px) {
  .nav-logo span {
    display: block;
  }
}

/* --- Desktop Navigation --- */
.nav-menu-desktop {
  display: none;
  /* Hidden on mobile */
  align-items: center;
  gap: 1.5rem;
}

@media (min-width: 992px) {

  /* Show on 'lg' and up */
  .nav-menu-desktop {
    display: flex;
  }
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--secondary-text);
  padding: 0.5rem 0;
  position: relative;
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--primary-color);
}

/* Active underline effect */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-color);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

/* Login Button */
.login-btn {
  background-color: var(--primary-color);
  color: var(--text-color);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 0.3s ease;
  font-size: 1rem;
  white-space: nowrap;
  /* Prevents wrapping */
  text-align: center;
}

.login-btn:hover {
  background-color: var(--primary-dark);
  color: var(--text-color);
}

/* Profile Button */
.profile-btn {
  position: relative;
  cursor: pointer;
}

.profile-avatar {
  height: 40px;
  width: 40px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  object-fit: cover;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: 130%;
  right: 0;
  width: 200px;
  background-color: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 8px;
  border: 1px solid #333;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  z-index: 1001;
}

.profile-dropdown.active {
  display: block;
}

.dropdown-header {
  padding: 1rem;
  border-bottom: 1px solid #444;
}

.dropdown-header span {
  font-weight: 600;
  color: var(--text-color);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-header small {
  color: var(--secondary-text);
  font-size: 0.8rem;
  text-transform: capitalize;
}

.profile-dropdown ul {
  list-style: none;
  padding: 0.5rem 0;
}

.profile-dropdown ul a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--secondary-text);
  font-weight: 500;
  text-decoration: none;
}

.profile-dropdown ul a:hover {
  background-color: var(--primary-color);
  color: var(--text-color);
}


/* --- Mobile Hamburger Menu --- */
.mobile-menu-toggle {
  display: block;
  /* Show on mobile */
  background: none;
  border: none;
  color: var(--text-color);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
  /* Make sure it's on top */
}

@media (min-width: 992px) {

  /* Hide on 'lg' and up */
  .mobile-menu-toggle {
    display: none;
  }
}

.mobile-menu {
  display: none;
  /* Hidden by default */
  position: fixed;
  top: 80px;
  /* Below the header */
  left: 0;
  width: 100%;
  height: calc(100vh - 80px);
  background-color: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 999;

  flex-direction: column;
  align-items: center;
  padding: 2rem;
  gap: 1.5rem;

  /* Fade-in animation */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu.open {
  display: flex;
  opacity: 1;
}

.mobile-menu .nav-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.mobile-menu .nav-links a {
  font-size: 1.5rem;
  padding: 0.5rem;
  color: var(--text-color);
}

.mobile-menu .nav-links a::after {
  display: none;
  /* No underlines on mobile */
}

/* Mobile Auth Button */
.mobile-auth-container {
  margin-top: 2rem;
  width: 100%;
  max-width: 300px;
  display: flex;
  justify-content: center;
}

.mobile-auth-container .login-btn {
  width: 100%;
}

.mobile-auth-container .profile-btn {
  /* Center the profile button on mobile */
  margin: 0 auto;
}