/* =========================================
   HEADER & NAVBAR STYLES - COMPLETE
   ========================================= */

header {
  background: var(--bg-header);
  box-shadow: var(--shadow-header);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  transition: background 0.3s ease;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  position: relative;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  width: 100px;
  height: 25px;
  display: flex;
  align-items: center;
}

.logo img {
  width: 100%;
  height: auto;
}

/* Dark mode logo */
body.dark-mode .logo img {
  filter: brightness(0) invert(1);
}

/* Navigation Links */
.nav-links {
  display: flex;
  align-items: center;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--text-nav);
  padding: 10px 4px;
  margin-left: 18px;
  transition: color 0.2s;
}

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

body.dark-mode .nav-links a:hover {
  color: var(--accent);
}

/* Right side buttons */
.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sign In Button */
.nav-btn {
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.9rem;
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  text-align: center;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.nav-btn.primary {
  background: #000000;
  color: #ffffff;
}

.nav-btn.primary:hover {
  background: var(--primary);
}

body.dark-mode .nav-btn.primary {
  background: var(--accent);
  color: #111111;
}

body.dark-mode .nav-btn.primary:hover {
  background: #cc8a2a;
}

.nav-btn.outline {
  border-color: var(--border-color);
  color: var(--text-main);
  background: transparent;
}

.nav-btn.outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(44, 47, 120, 0.1);
}

body.dark-mode .nav-btn.outline {
  border-color: var(--border-color);
  color: var(--text-main);
}

body.dark-mode .nav-btn.outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(251, 176, 64, 0.1);
}

/* =========================================
   MOBILE MENU BUTTON (Hamburger)
   ========================================= */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  z-index: 102;
  position: relative;
}

.hamburger {
  width: 24px;
  height: 18px;
  position: relative;
}

.hamburger span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: var(--text-main);
  border-radius: 9px;
  opacity: 1;
  left: 0;
  transition: .25s ease-in-out;
  transform-origin: center;
}

.hamburger span:nth-child(1) {
  top: 0px;
}

.hamburger span:nth-child(2) {
  top: 8px;
}

.hamburger span:nth-child(3) {
  top: 16px;
}

/* Animate to X when open */
.mobile-toggle.is-open .hamburger span:nth-child(1) {
  top: 8px;
  transform: rotate(135deg);
}

.mobile-toggle.is-open .hamburger span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.mobile-toggle.is-open .hamburger span:nth-child(3) {
  top: 8px;
  transform: rotate(-135deg);
}

/* =========================================
   MOBILE NAVIGATION MENU (Slide from Left)
   ========================================= */
.mobile-nav-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 80%;
  max-width: 320px;
  height: 100vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
  padding: 100px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateX(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 101;
}

/* THIS IS THE CRITICAL RULE - Menu slides in when has .is-open class */
.mobile-nav-menu.is-open {
  transform: translateX(0);
}

/* Dark mode mobile menu */
body.dark-mode .mobile-nav-menu {
  background: rgba(18, 18, 24, 0.95);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.mobile-nav-menu a {
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-main);
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
  display: block;
  transition: color 0.2s, transform 0.2s;
}

.mobile-nav-menu a:hover {
  color: var(--primary);
  padding-left: 10px;
}

body.dark-mode .mobile-nav-menu a:hover {
  color: var(--accent);
}

/* Overlay when mobile menu is open */
.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* =========================================
   THEME TOGGLE (Dark/Light Mode)
   ========================================= */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
  stroke: #888888;
}

body.dark-mode .theme-toggle .icon-sun {
  display: block;
  stroke: #fbb040;
}

body.dark-mode .theme-toggle .icon-moon {
  display: none;
}

/* =========================================
   PROFILE DROPDOWN (When logged in)
   ========================================= */
.profile-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.profile-wrapper:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .profile-wrapper:hover {
  background: rgba(255, 255, 255, 0.05);
}

.header-profile-img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

.dropdown-arrow {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.profile-dropdown {
  position: absolute;
  top: 55px;
  right: 0;
  width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.profile-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--text-main);
  transition: background 0.2s;
  text-decoration: none;
}

.dropdown-item:hover {
  background: var(--bg-input);
  color: var(--primary);
}

body.dark-mode .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent);
}

/* =========================================
   RESPONSIVE HEADER
   ========================================= */
@media (max-width: 900px) {
  .nav-links {
    display: none;
  }
  
  .mobile-toggle {
    display: flex;
  }
  
  .nav-btn.outline {
    display: none;
  }
  
  .nav {
    flex-wrap: nowrap;
    height: 72px;
  }
  
  .nav-left {
    order: 1;
    flex: 0 0 auto;
  }
  
  .nav-right {
    order: 2;
    flex: 0 0 auto;
  }
  
  .nav-btn.primary {
    display: flex;
    padding: 8px 16px;
    font-size: 0.85rem;
  }
}

@media (max-width: 600px) {
  .nav-btn.primary {
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .profile-wrapper {
    padding: 4px 8px;
  }
  
  .header-profile-img {
    width: 32px;
    height: 32px;
  }
}