/**
 * Global Header Styles
 * Consolidated header CSS for all pages
 * 
 * TABLE OF CONTENTS:
 * 1. Desktop Header (min-width: 992px)
 * 2. Mobile Header (max-width: 991px)
 * 3. Mobile Menu Canvas
 * 4. Header States and Variations
 */

/* ============================================
   1. DESKTOP HEADER (min-width: 992px)
   ============================================ */

/* Dropdown Styles */
.navigation__item--has-dropdown {
  position: relative;
}

.navigation__item--has-dropdown > .navigation__link::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-top: 5px solid;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  transition: transform 0.3s ease;
}

.navigation__item--has-dropdown:hover > .navigation__link::after {
  transform: rotate(180deg);
}

/* Desktop Dropdown Menu */
.navigation__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 100;
  list-style: none;
  padding: 10px 0;
  margin: 0;
}

.navigation__item--has-dropdown:hover > .navigation__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.navigation__dropdown-item {
  display: block;
}

.navigation__dropdown-item .navigation__dropdown-link {
  display: block;
  padding: 10px 20px;
  color: #122837;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.3s ease;
}

.navigation__dropdown-item .navigation__dropdown-link:hover {
  background: #f5f5f5;
  color: #2ed3bf;
  padding-left: 25px;
}

@media (min-width: 992px) {
  .header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
  }

  .header__logo {
    margin-right: 0;
    flex-shrink: 0;
    width: 180px;
  }

  .header__mobile {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    flex-grow: 0;
    margin: 0;
  }

  .header__mobile .mobile-canvas__nav {
    left: 0;
  }

  .navigation__list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
  }

  .navigation__item {
    margin-right: 0;
  }

  .navigation__item:last-child {
    display: none;
  }

  .header__strategic-btn {
    margin-left: auto;
    flex-shrink: 0;
    width: 180px;
    display: flex;
    justify-content: flex-end;
  }

  .header__strategic-btn .btn {
    min-width: auto;
    padding: 16px 25px;
    white-space: nowrap;
  }

  .header__menu-toggle {
    display: none;
  }
}

/* ============================================
   2. MOBILE HEADER (max-width: 991px)
   ============================================ */

/* Default header - sticky in mobile, no scroll effects */
@media (max-width: 991px) {
  .header {
    padding: 1px 0 !important;
    background: #fff !important;
    position: sticky !important;
    top: 0;
    z-index: 999;
    box-shadow: none !important;
  }

  /* Remove any transition/transform effects on scroll */
  .header--fixed,
  .header-scrolled,
  .header--scrolled {
    padding: 1px 0 !important;
    background: #fff !important;
    transform: none !important;
    box-shadow: none !important;
  }

  .header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 12px;
    min-height: 36px;
  }

  .header__logo {
    width: 95px;
    flex-shrink: 0;
    padding: 2px 0;
  }

  /* Keep logo same size in both states */
  .header__logo img,
  .header--fixed .header__logo img,
  .header--fixed.header--scrolled .header__logo img,
  .header-scrolled .header__logo img {
    width: 95px !important;
    max-width: 100%;
    height: auto;
  }

  /* Show hamburger menu on mobile - polished design */
  .header__menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    position: relative;
    z-index: 10001;
  }

  .header__menu-toggle::before,
  .header__menu-toggle::after {
    content: "";
    position: absolute;
    width: 22px;
    border-top: 2px solid #000000;
    left: 50%;
    transform: translateX(-50%);
    transition: transform 0.3s ease, top 0.3s ease, bottom 0.3s ease;
  }

  .header__menu-toggle::before {
    top: 8px;
  }

  .header__menu-toggle::after {
    bottom: 8px;
  }

  .header__menu-toggle .menu-toggle__line {
    display: block;
    width: 22px;
    border-top: 2px solid #000000;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: opacity 0.3s ease;
  }

  /* Animate hamburger to X when opened */
  .header__menu-toggle.is-active::before {
    top: 50%;
    transform: translateX(-50%) translateY(-50%) rotate(45deg);
  }

  .header__menu-toggle.is-active::after {
    top: 50%;
    transform: translateX(-50%) translateY(-50%) rotate(-45deg);
  }

  .header__menu-toggle.is-active .menu-toggle__line {
    opacity: 0;
  }

  /* Hide desktop navigation on mobile */
  .header__mobile .mobile-canvas__nav {
    display: block !important;
  }

  /* Hide strategic button on mobile by default - individual pages can override */
  .header__strategic-btn {
    display: none;
  }

  /* Mobile canvas - slide out menu */
  .header__mobile.mobile-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    background: #ffffff;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 100px 40px 40px;
    box-shadow: none;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  @media (min-width: 576px) {
    .header__mobile.mobile-canvas {
      max-width: 400px;
      box-shadow: 10px 0 50px rgba(0,0,0,0.1);
    }
  }

  /* Mobile menu overlay */
  .mobile-canvas-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .mobile-canvas-overlay.active {
    display: block;
    opacity: 1;
  }

  .header__mobile.mobile-canvas--opened {
    transform: translateX(0);
  }

  .header__mobile .mobile-canvas__nav {
    display: block !important;
  }

  /* Polished Mobile Navigation List */
  .header__mobile .navigation__list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0;
    margin: 0;
    list-style: none;
    width: 100%;
  }

  /* Polished Mobile Navigation Items */
  .header__mobile .navigation__item {
    margin: 0;
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    position: relative;
    z-index: 5;
  }

  .header__mobile.mobile-canvas--opened .navigation__item {
    opacity: 1;
    transform: translateY(0);
  }

  /* Staggered animation delays */
  .header__mobile.mobile-canvas--opened .navigation__item:nth-child(1) { transition-delay: 0.1s; }
  .header__mobile.mobile-canvas--opened .navigation__item:nth-child(2) { transition-delay: 0.15s; }
  .header__mobile.mobile-canvas--opened .navigation__item:nth-child(3) { transition-delay: 0.2s; }
  .header__mobile.mobile-canvas--opened .navigation__item:nth-child(4) { transition-delay: 0.25s; }
  .header__mobile.mobile-canvas--opened .navigation__item:nth-child(5) { transition-delay: 0.3s; }
  .header__mobile.mobile-canvas--opened .navigation__item:nth-child(6) { transition-delay: 0.35s; }

  .header__mobile .navigation__item:last-child {
    border-bottom: none;
  }

  /* Polished Mobile Navigation Links - Black Font */
  .header__mobile .navigation__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    width: 100%;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #122837 !important;
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
    pointer-events: auto;
    position: relative;
    z-index: 10;
  }

  .header__mobile .navigation__link:hover {
    color: #2ed3bf !important;
    padding-left: 10px;
  }

  /* Current page highlight */
  .header__mobile .navigation__item--current .navigation__link {
    color: #2ed3bf !important;
  }

  /* Custom Button in Menu */
  .header__mobile .navigation__link.nav-btn-custom {
    margin-top: 30px;
    background: #122837;
    color: #ffffff !important;
    justify-content: center;
    padding: 14px 25px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 10px 30px rgba(18, 40, 55, 0.2);
  }

  .header__mobile .navigation__link.nav-btn-custom:hover {
    background: #2ed3bf;
    color: #122837 !important;
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(46, 211, 191, 0.3);
    padding-left: 30px; /* Prevent shift */
  }

  /* Mobile Dropdown Styles */
  .navigation__item--has-dropdown {
    position: relative;
  }

  .navigation__item--has-dropdown > .navigation__link::after {
    content: "";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 5px solid #000000;
    transition: transform 0.3s ease;
  }

  .navigation__item--has-dropdown.mobile-dropdown--open > .navigation__link::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .navigation__dropdown {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background: #f8f8f8;
  }

  .navigation__dropdown.mobile-dropdown--open {
    display: block;
  }

  .navigation__dropdown-item {
    border-bottom: 1px solid #e0e0e0;
  }

  .navigation__dropdown-item:last-child {
    border-bottom: none;
  }

  .navigation__dropdown-link {
    display: block;
    padding: 14px 20px 14px 30px;
    color: #000000 !important;
    text-decoration: none;
    font-size: 16px;
    font-weight: 400;
    transition: background 0.3s ease, color 0.3s ease;
  }

  .navigation__dropdown-link:hover {
    color: #333333 !important;
    background: #f0f0f0;
  }
}

/* ============================================
   3. MOBILE MENU CANVAS - SHOW STRATEGIC BTN
   Some pages may want to show strategic button on mobile
   ============================================ */

/* Show strategic button on mobile (for pages that need it) */
@media (max-width: 991px) {
  .header__strategic-btn--show {
    display: block !important;
    margin-right: 10px;
  }
}

/* ============================================
   4. HEADER STATES AND VARIATIONS
   ============================================ */

/* Blinking red dot for Events nav item */
.nav-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #e74c3c;
  border-radius: 50%;
  margin-left: 5px;
  vertical-align: baseline;
  transform: translateY(-0.5px);
  box-shadow: 0 0 4px rgba(231, 76, 60, 0.6), 0 0 8px rgba(231, 76, 60, 0.3);
  animation: navDotBlink 2s ease-in-out infinite;
}

@keyframes navDotBlink {
  0%, 100% {
    opacity: 1;
    transform: scale(1) translateY(-0.5px);
    box-shadow: 0 0 4px rgba(231, 76, 60, 0.6), 0 0 8px rgba(231, 76, 60, 0.3);
  }
  50% {
    opacity: 0.4;
    transform: scale(0.85) translateY(-0.5px);
    box-shadow: 0 0 2px rgba(231, 76, 60, 0.4), 0 0 4px rgba(231, 76, 60, 0.2);
  }
}

/* Header fixed state */
.header--fixed {
  position: fixed;
}

/* Header with white background */
.header--bg-white {
  background-color: #ffffff;
}

/* Header absolute position */
.header--absolute,
.header--leftward {
  position: absolute;
}

/* Sticky header */
.header {
  position: sticky;
}

/* Global mobile viewport fix */
@media (max-width: 767px) {
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}

/* Ensure proper z-index stacking */
@media (max-width: 991px) {
  .header {
    z-index: 1000;
  }
}

/* ============================================
   5. OVERRIDES FOR SPECIFIC CASES
   ============================================ */

/* Ensure header container displays correctly on mobile */
@media (max-width: 991px) {
  .header__container {
    display: flex !important;
  }

  .header__logo {
    margin-right: auto !important;
  }
}

/* Force mobile header layout */
@media (max-width: 991px) {
  .header__mobile {
    flex-grow: 0 !important;
  }

  /* Hide any visible desktop menu */
  .header__mobile .navigation {
    display: block !important;
  }

  /* Ensure hamburger is visible */
  .header__menu-toggle.menu-toggle {
    display: block !important;
  }
}
