/* ============================================
   RESPONSIVE NAVIGATION - FIXED VERSION
   ============================================ */

/* Main Navigation Wrapper */
.main-navigation-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}

/* ============================================
   MOBILE MENU TOGGLE (Hamburger)
   ============================================ */
.mobile-menu-toggle {
  display: none; /* Hidden on desktop */
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  transition: all 0.3s ease;
  position: relative;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background-color: #4b5563;
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
}

/* Hamburger Animation when open */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(10.5px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-10.5px) rotate(-45deg);
}

/* ============================================
   MOBILE MENU OVERLAY
   ============================================ */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

/* ============================================
   NAVIGATION CONTAINER
   ============================================ */
.nav-container {
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* ============================================
   MAIN MENU (Desktop)
   ============================================ */
.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 1.5rem;
}

.nav-item {
  margin: 0;
  padding: 0;
  position: relative;
}

.nav-item a {
  color: #4b5563;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: all 0.2s ease;
  padding: 0.5rem 0;
  position: relative;
  display: inline-block;
}

.nav-item a:hover {
  color: #203266;
}

/* Underline effect on hover (main menu only) */
.nav-menu > .nav-item > a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #203266;
  transition: width 0.3s ease;
}

.nav-menu > .nav-item > a:hover::after,
.nav-menu > .nav-item > a.is-active::after,
.menu-item--active-trail > a::after {
  width: 100%;
}

.menu-item--active-trail > a {
  color: #203266;
  font-weight: 700;
}

/* ============================================
   SUBMENU (Desktop)
   ============================================ */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: white;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-radius: 0.375rem;
  padding: 0.5rem;
  min-width: 12rem;
  margin-top: 0.5rem;
  list-style: none;
  z-index: 50;
}

.nav-item:hover > .submenu {
  display: block;
}

.submenu .nav-item {
  display: block;
  width: 100%;
  position: static;
}

.submenu .nav-item a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  border-radius: 0.25rem;
  width: 100%;
}

.submenu .nav-item a:hover {
  background-color: #f3f4f6;
  color: #203266;
}

.submenu .nav-item a::after {
  display: none;
}

/* Submenu toggle button (hidden on desktop) */
.submenu-toggle {
  display: none;
}

/* ============================================
   USER MENU
   ============================================ */
.user-menu-wrapper {
  position: relative;
}

.user-menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: background-color 0.2s ease;
}

.user-menu-toggle:hover {
  background-color: #f3f4f6;
}

.user-avatar-image {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
}

.avatar-initials {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #203266 0%, #203266 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.user-name-mobile {
  display: none; /* Hidden on desktop */
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.chevron-icon {
  width: 16px;
  height: 16px;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.user-menu-wrapper.open .chevron-icon {
  transform: rotate(180deg);
}

/* User Dropdown */
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  min-width: 200px;
  z-index: 50;
  overflow: hidden;
}

.user-menu-wrapper.open .user-dropdown {
  display: block;
}

.user-info {
  padding: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.user-name {
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.25rem 0;
  font-size: 0.875rem;
}

.user-email {
  font-size: 0.75rem;
  color: #6b7280;
  margin: 0;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: #374151;
  text-decoration: none;
  transition: background-color 0.2s ease;
  font-size: 0.875rem;
}

.dropdown-link:hover {
  background-color: #f3f4f6;
}

.dropdown-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.logout-link {
  color: #dc2626;
  border-top: 1px solid #e5e7eb;
}

.logout-link:hover {
  background-color: #fef2f2;
}

/* ============================================
   LOGIN BUTTON
   ============================================ */
.login-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #203266;
  color: white;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.login-button:hover {
  background: #203266;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.login-button svg {
  width: 18px;
  height: 18px;
}

.login-button span {
  display: inline;
}

/* ============================================
   TABLET RESPONSIVE (768px - 1023px)
   ============================================ */
@media (max-width: 1023px) {
  .nav-menu {
    gap: 1rem;
  }
  
  .nav-item a {
    font-size: 0.813rem;
  }
}

/* ============================================
   MOBILE RESPONSIVE (< 768px)
   ============================================ */
@media (max-width: 767px) {
  /* Show hamburger menu */
  .mobile-menu-toggle {
    display: flex;
  }
  
  /* Hide desktop navigation container initially */
  .nav-container {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 280px;
    max-width: 85vw;
    background: white;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 5rem 0 2rem 0;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    z-index: 999;
    transition: right 0.3s ease;
    overflow-y: auto;
  }
  
  .nav-container.active {
    right: 0;
  }
  
  /* Hide regular horizontal menu on mobile */
  .nav-menu {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    padding: 0;
  }
  
  .nav-item {
    border-bottom: 1px solid #e5e7eb;
  }
  
  .nav-item a {
    display: block;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    text-transform: none;
    letter-spacing: normal;
  }
  
  .nav-item a::after {
    display: none; /* Remove underline effect on mobile */
  }
  
  /* Submenu - Mobile */
  .submenu {
    position: static;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    background: #f9fafb;
    display: none;
  }
  
  .nav-item.submenu-open > .submenu {
    display: block;
  }
  
  .submenu .nav-item {
    border-bottom: none;
  }
  
  .submenu .nav-item a {
    padding: 0.75rem 2.5rem;
    font-size: 0.875rem;
  }
  
  /* Submenu Toggle Button - Mobile */
  .has-submenu {
    position: relative;
  }
  
  .submenu-toggle {
    display: block;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1;
  }
  
  .submenu-icon {
    width: 20px;
    height: 20px;
    color: #6b7280;
    transition: transform 0.2s ease;
  }
  
  .nav-item.submenu-open .submenu-icon {
    transform: rotate(180deg);
  }
  
  /* User Menu - Mobile */
  .user-menu-wrapper {
    width: 100%;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
  }
  
  .user-menu-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 0.75rem 0;
  }
  
  .user-name-mobile {
    display: block;
    flex: 1;
    text-align: left;
  }
  
  .user-dropdown {
    position: static;
    box-shadow: none;
    margin-top: 1rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
  }
  
  /* Login Button - Mobile */
  .login-button {
    width: calc(100% - 3rem);
    justify-content: center;
    margin: 1rem 1.5rem;
    padding: 0.875rem;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus States */
.mobile-menu-toggle:focus-visible,
.nav-item a:focus-visible,
.user-menu-toggle:focus-visible,
.dropdown-link:focus-visible,
.login-button:focus-visible {
  outline: 2px solid #203266;
  outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .nav-item a,
  .dropdown-link {
    text-decoration: underline;
  }
}