/* Header Component - Base Styles */

/* Header Container */
.site-header {
  position: relative;
  z-index: 100;
  background: white;
  transition: all 0.3s ease;
}

.site-header.sticky {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Container Widths */
.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem;
}

.container.boxed {
  max-width: 1200px;
}

.container.wide {
  max-width: 1400px;
}

.container.full {
  max-width: 100%;
}

/* Header Grid Layout */
.header-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  gap: 2rem;
}

/* Logo/Brand */
.header-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.header-brand img {
  max-width: 200px;
  height: auto;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.header-brand .text-logo {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: inherit;
}

/* Navigation */
.site-nav {
  flex-grow: 1;
  display: flex;
  align-items: center;
}

.site-nav.align-left {
  justify-content: flex-start;
}

.site-nav.align-center {
  justify-content: center;
}

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

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* Main Menu */
.main-menu {
  display: flex;
  align-items: center;
}

.main-menu .hs-menu-wrapper {
  margin: 0;
  padding: 0;
}

.main-menu .hs-menu-wrapper > ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.main-menu a {
  text-decoration: none;
  color: inherit;
  padding: 0.5rem 0;
  display: block;
  transition: color 0.3s ease;
}

.main-menu a:hover {
  color: #007bff;
}

/* Dropdown Menus */
.main-menu .hs-menu-depth-2 {
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e0e0e0;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease; /* Only opacity transition - no transform to prevent jump */
  will-change: opacity; /* GPU-accelerated opacity animation */
  z-index: 100;
}

.main-menu .hs-menu-item:hover .hs-menu-depth-2 {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.main-menu .hs-menu-depth-2 a {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.main-menu .hs-menu-depth-2 a:last-child {
  border-bottom: none;
}

/* Header Features */
.header-features {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Search Toggle */
.search-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: inherit;
}

/* CTA Button */
.header-cta {
  white-space: nowrap;
  padding: 0.5rem 1.5rem;
  border-radius: 4px;
  text-decoration: none;
  transition: all 0.3s ease;
}

/* Fix: Only apply link color to navigation menu links, not CTA buttons */
#hs_cos_wrapper_site_header .site-header .unified-menu a {
  color: #333333;
}

.header-cta.btn-primary {
  background: var(--color-primary, #1e3a8a);
  color: var(--color-primary-contrast, #ffffff);
  border: 1px solid var(--color-primary, #1e3a8a);
  font-weight: bold;
}

.header-cta.btn-primary:hover {
  filter: brightness(0.85);
  color: var(--color-primary-contrast, #ffffff);
}

.header-cta.btn-secondary {
  background: var(--color-secondary, #6c757d);
  color: white;
  border: 1px solid var(--color-secondary, #6c757d);
}

.header-cta.btn-outline-primary {
  background: transparent;
  color: var(--color-primary, #1e3a8a);
  border: 1px solid var(--color-primary, #1e3a8a);
}

.header-cta.btn-outline-primary:hover {
  background: var(--color-primary, #1e3a8a);
  color: var(--color-primary-contrast, #ffffff);
}

/* Membership Menu */
.membership-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logged-in-nav,
.logged-out-nav {
  display: flex;
  align-items: center;
}

.logout-link,
.login-link,
.signup-link {
  text-decoration: none;
  color: inherit;
  padding: 0.5rem 1rem;
  transition: color 0.3s ease;
}

.logout-link:hover,
.login-link:hover,
.signup-link:hover {
  color: #007bff;
}

/* Mobile Styles - matches theme breakpoint of 992px */
@media (max-width: 992px) {
  /* Prevent horizontal scroll when mobile menu is present */
  html, body {
    overflow-x: hidden;
  }

  .header-grid {
    position: relative;
    padding: 0.5rem 0;
  }
  
  .header-brand {
    margin-right: auto;
  }
  
  .site-nav {
    position: static;
  }
  
  .main-menu .hs-menu-wrapper > ul {
    flex-direction: column;
    gap: 0;
    width: 100%;
  }
  
  .main-menu a {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
  }
  
  .main-menu .hs-menu-depth-2 {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    margin-left: 1rem;
    background: #f8f9fa;
  }
  
  .membership-menu {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
  }
  
  .user-menu {
    flex-direction: column;
    align-items: stretch;
  }
  
  .auth-links {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-features {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f0f0;
  }
}

/* Skip Link for Accessibility */
.skip-link {
  position: absolute;
  left: -9999px;
  top: -50px;
  z-index: 999;
  padding: 1em;
  background: #000;
  color: #fff;
  text-decoration: none;
}

.skip-link:focus {
  left: 50%;
  transform: translateX(-50%);
  top: 0;
}

/* Additional responsive breakpoints */
@media (max-width: 992px) and (min-width: 768px) {
  .main-menu .hs-menu-wrapper > ul {
    gap: 1rem;
  }
  
  .header-cta {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 1150px) and (min-width: 993px) {
  .container {
    padding: 0 1.5rem;
  }
}