/* ============================================
   HEADER STYLES - PREMIUM INDUSTRY STANDARD
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables */
:root {
  --header-bg: #ffffff;
  --header-bg-scrolled: rgba(255, 255, 255, 0.98);
  --header-text: #131e5d;
  --header-text-hover: #4eafe4;
  --header-accent: #4eafe4;
  --header-shadow: rgba(19, 30, 93, 0.1);
  --header-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 90px;
  --header-height-mobile: 70px;
  --header-z-index: 1000;
}

/* Desktop: Override CSS variable for transparent header */
@media (min-width: 1024px) {
  :root {
    --header-bg: transparent;
  }
}

/* Ensure html and body allow sticky positioning */
html {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  height: 100% !important;
  position: relative !important;
}

body {
  overflow-x: hidden !important;
  overflow-y: auto !important;
  position: relative !important;
  min-height: 100vh !important;
  height: auto !important;
}

/* Ensure no parent containers break fixed positioning */
body > header.site-header,
body > .site-header {
  position: fixed !important;
}

/* Base Header Styles - Using FIXED for reliability */
.site-header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  z-index: var(--header-z-index) !important;
  transition: var(--header-transition);
  font-family: 'Poppins', sans-serif;
  height: var(--header-height);
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  transform: none !important;
  margin: 0 !important;
  padding: 0 !important;
  /* DEFAULT: Transparent for desktop, will be overridden for mobile */
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

/* Desktop: Transparent header when not scrolled */
@media (min-width: 1024px) {
  .site-header {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
  }
  
  .site-header:not(.scrolled) {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
  }
  
  .site-header.scrolled {
    background: rgba(255, 255, 255, 0.95) !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(19, 30, 93, 0.15) !important;
    height: 80px;
  }
}

/* Mobile: White background by default */
@media (max-width: 1023px) {
  .site-header {
    background: var(--header-bg) !important;
    background-color: var(--header-bg) !important;
    box-shadow: 0 2px 10px var(--header-shadow) !important;
  }
  
  .site-header.scrolled {
    background: var(--header-bg-scrolled) !important;
    background-color: var(--header-bg-scrolled) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(19, 30, 93, 0.15) !important;
    height: 80px;
  }
}

.site-header.mobile-menu-open {
  box-shadow: 0 4px 20px rgba(19, 30, 93, 0.2);
}

/* Header Container */
.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  position: relative;
}

/* Logo */
.header-logo {
  flex-shrink: 0;
  z-index: 10;
}

.header-logo a {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: var(--header-transition);
}

.logo-img {
  height: 60px;
  width: auto;
  object-fit: contain;
  transition: var(--header-transition);
}

.site-header.scrolled .logo-img {
  height: 50px;
}

/* Desktop Navigation */
.desktop-nav {
  display: none;
  flex: 1;
}

@media (min-width: 1025px) {
  .desktop-nav {
    display: block;
  }
}

.nav-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  color: var(--header-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  transition: var(--header-transition);
  border-radius: 8px;
  position: relative;
  white-space: nowrap;
}

/* Desktop: White text when header is transparent */
@media (min-width: 1024px) {
  .site-header:not(.scrolled) .nav-link {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  }
  
  .site-header:not(.scrolled) .nav-link:hover {
    color: #4eafe4 !important;
    text-shadow: 0 2px 8px rgba(78, 175, 228, 0.5);
  }
  
  /* Ensure logo is visible on transparent header */
  .site-header:not(.scrolled) .logo-img {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  }
  
  /* CTA button should be visible on transparent header */
  .site-header:not(.scrolled) .cta-button {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  }
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 8px;
  left: 18px;
  right: 18px;
  height: 2px;
  background: var(--header-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover {
  color: var(--header-accent);
}

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

.nav-item.has-submenu .nav-link {
  padding-right: 28px;
}

.dropdown-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-left: 4px;
}

.nav-item:hover .dropdown-icon {
  transform: rotate(180deg);
}

/* Desktop Submenu */
.submenu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(19, 30, 93, 0.15);
  list-style: none;
  margin: 0;
  padding: 12px 0;
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  border: 1px solid rgba(19, 30, 93, 0.08);
}

.submenu.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.submenu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #ffffff;
}

.submenu-link {
  display: block;
  padding: 12px 24px;
  color: var(--header-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: var(--header-transition);
  position: relative;
  padding-left: 24px;
}

.submenu-link::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  background: var(--header-accent);
  border-radius: 50%;
  opacity: 0;
  transition: var(--header-transition);
}

.submenu-link:hover {
  color: var(--header-accent);
  background: rgba(82, 199, 125, 0.05);
  padding-left: 32px;
}

.submenu-link:hover::before {
  opacity: 1;
}

/* CTA Button */
.header-cta {
  display: none;
  flex-shrink: 0;
}

@media (min-width: 1025px) {
  .header-cta {
    display: block;
  }
}

.cta-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--header-accent) 0%, #121c5a 100%);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  border-radius: 50px;
  transition: var(--header-transition);
  box-shadow: 0 4px 15px rgba(19, 29, 91, 0.3);
  position: relative;
  overflow: hidden;
  border: none;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
}

.cta-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.cta-button:hover::before {
  left: 100%;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(82, 199, 125, 0.4);
}

.cta-button:active {
  transform: translateY(0);
}

.quote-icon {
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cta-button:hover .quote-icon {
  transform: scale(1.1);
}

.cta-text {
  white-space: nowrap;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  position: relative;
}

@media (min-width: 1025px) {
  .mobile-menu-toggle {
    display: none;
  }
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background: var(--header-text);
  border-radius: 3px;
  transition: var(--header-transition);
  transform-origin: center;
}

/* Desktop: White hamburger when header is transparent */
@media (min-width: 1024px) {
  .site-header:not(.scrolled) .hamburger-line {
    background: #ffffff;
  }
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(-20px);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(8px, -8px);
}

/* Mobile Navigation */
.mobile-nav {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  box-shadow: 0 10px 30px rgba(19, 30, 93, 0.15);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 999;
}

@media (min-width: 1025px) {
  .mobile-nav {
    display: none;
  }
}

.mobile-nav.active {
  max-height: 100vh;
  overflow-y: auto;
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 20px 30px 30px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav-item {
  border-bottom: 1px solid rgba(19, 30, 93, 0.08);
}

.mobile-nav-item:last-child {
  border-bottom: none;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  color: var(--header-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 16px;
  transition: var(--header-transition);
  position: relative;
}

.mobile-nav-link::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 0;
  background: var(--header-accent);
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  color: var(--header-accent);
  padding-left: 20px;
}

.mobile-nav-link:hover::before,
.mobile-nav-link:active::before {
  height: 24px;
}

.mobile-dropdown-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.mobile-nav-item.submenu-open .mobile-dropdown-icon {
  transform: rotate(180deg);
}

/* Mobile Submenu */
.mobile-submenu {
  list-style: none;
  margin: 0;
  padding: 0 0 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-nav-item.submenu-open .mobile-submenu {
  max-height: 1000px;
  padding-bottom: 12px;
}

.mobile-submenu-link {
  display: block;
  padding: 12px 0;
  color: rgba(19, 30, 93, 0.7);
  text-decoration: none;
  font-size: 14px;
  font-weight: 400;
  transition: var(--header-transition);
  position: relative;
  padding-left: 20px;
}

.mobile-submenu-link::before {
  content: '→';
  position: absolute;
  left: 0;
  opacity: 0;
  transition: var(--header-transition);
}

.mobile-submenu-link:hover {
  color: var(--header-accent);
  padding-left: 24px;
}

.mobile-submenu-link:hover::before {
  opacity: 1;
}

/* Mobile CTA */
.mobile-cta-item {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--header-accent);
  border-bottom: none;
}

.mobile-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--header-accent) 0%, #121c5a 100%);
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  border-radius: 12px;
  transition: var(--header-transition);
  box-shadow: 0 4px 15px rgba(19,28,95, 0.3);
  width: 100%;
  border: none;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
}

.mobile-cta-button:hover,
.mobile-cta-button:active {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(19, 29, 91, 0.3);
}

/* Body scroll lock when menu is open */
body.menu-open {
  overflow: hidden;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
  .header-container {
    padding: 0 20px;
    height: var(--header-height-mobile);
  }

  .logo-img {
    height: 50px;
  }

  .site-header {
    height: var(--header-height-mobile);
  }

  .site-header.scrolled {
    height: var(--header-height-mobile);
  }
}

@media (max-width: 768px) {
  .header-container {
    padding: 0 15px;
  }

  .logo-img {
    height: 45px;
  }

  .mobile-nav-list {
    padding: 15px 20px 25px;
  }
}

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

/* Focus styles for accessibility */
.nav-link:focus,
.submenu-link:focus,
.mobile-nav-link:focus,
.mobile-submenu-link:focus,
.cta-button:focus,
.mobile-cta-button:focus,
.mobile-menu-toggle:focus {
  outline: 2px solid var(--header-accent);
  outline-offset: 2px;
}

/* Print styles */
@media print {
  .site-header {
    position: static;
    box-shadow: none;
  }
}

