/* =============================================================================
   Know.Travel — Header
   Structure, logo, aurora, animations, nav, mega menu, language,
   favorites, auth, mobile menu, responsive
   ============================================================================= */

/* ============================================
   HEADER THEME VARIABLES (Mega Menu)
   ============================================ */
[data-theme="dark"] {
  --nav-color: #d0d0e4;
  --nav-hover: #ffffff;
  --nav-active: #4fc3f7;
  --mega-bg: #0e0e18;
  --mega-border: rgba(255,255,255,0.06);
  --mega-group-title: #4fc3f7;
  --mega-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
[data-theme="light"] {
  --nav-color: #5a5a70;
  --nav-hover: #1a1a2e;
  --nav-active: #1565c0;
  --mega-bg: #ffffff;
  --mega-border: rgba(0,0,0,0.06);
  --mega-group-title: #1565c0;
  --mega-shadow: 0 12px 40px rgba(0,0,0,0.12);
}
[data-theme="sunset"] {
  --nav-color: #a88070;
  --nav-hover: #3a1e12;
  --nav-active: #e86a10;
  --mega-bg: #fff8f2;
  --mega-border: rgba(180,100,50,0.1);
  --mega-group-title: #e86a10;
  --mega-shadow: 0 12px 40px rgba(100,40,0,0.12);
}

/* ============================================
   HEADER STRUCTURE
   ============================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  transition: background 0.35s, border-color 0.35s;
}

.header-inner {
  width: 100%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
}

/* ============================================
   LOGO
   ============================================ */
.logo-wrap {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding: 12px 16px 12px 8px;
  margin-left: -20px;
}

.logo-wrap svg {
  position: relative;
  z-index: 2;
  display: block;
  transition: filter 0.6s;
}

/* Aurora background layers */
.aurora-layer {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.8s;
  top: 50%;
  left: 32px;
}

.aurora-layer.b-1 {
  width: 140px;
  height: 140px;
  background: var(--aurora1);
  filter: blur(22px);
}

.aurora-layer.b-2 {
  width: 180px;
  height: 180px;
  background: var(--aurora2);
  filter: blur(28px);
}

/* Particle canvas */
.particle-canvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}

/* ============================================
   LOGO ANIMATIONS
   ============================================ */
@keyframes pulseNode {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@keyframes flowLine {
  0% { stroke-dashoffset: 16; }
  100% { stroke-dashoffset: 0; }
}

@keyframes auroraB1 {
  0%, 100% { transform: translate(-50%,-50%) rotate(0deg) scale(1); opacity: 0.3; }
  33% { transform: translate(-50%,-50%) rotate(120deg) scale(1.08); opacity: 0.45; }
  66% { transform: translate(-50%,-50%) rotate(240deg) scale(0.97); opacity: 0.35; }
}

@keyframes auroraB2 {
  0%, 100% { transform: translate(-50%,-50%) rotate(60deg) scale(1.02); opacity: 0.25; }
  50% { transform: translate(-50%,-50%) rotate(240deg) scale(1.12); opacity: 0.4; }
}

.n-node { animation: pulseNode 6s ease-in-out infinite; }
.n-node-main { animation: pulseNode 6s ease-in-out infinite; }
.n-node:nth-child(2n) { animation-delay: -1.6s; }
.n-node:nth-child(3n) { animation-delay: -3.2s; }
.n-node:nth-child(5n) { animation-delay: -4.4s; }
.n-flow { stroke-dasharray: 8 8; animation: flowLine 6s linear infinite; }

/* Hover effects */
.logo-wrap:hover .aurora-layer.b-1 { animation: auroraB1 6s ease-in-out infinite; opacity: 1; }
.logo-wrap:hover .aurora-layer.b-2 { animation: auroraB2 8s ease-in-out infinite; opacity: 1; }
.logo-wrap:hover svg { filter: var(--logo-glow); }
.logo-wrap:hover .n-node,
.logo-wrap:hover .n-node-main { animation-duration: 4s; }
.logo-wrap:hover .n-flow { animation-duration: 4.5s; }

/* ============================================
   NAVIGATION
   ============================================ */
.nav-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-links a {
  font-size: 14px;
  font-weight: 400;
  color: var(--nav-color);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--nav-hover);
}

/* ============================================
   NAV ICONS
   ============================================ */
.nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  opacity: 0.5; transition: opacity 0.2s;
}
a:hover .nav-icon { opacity: 1; }

/* ============================================
   LANGUAGE SELECTOR
   ============================================ */
.lang-selector {
  position: relative;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.lang-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.lang-btn.open {
  background: var(--bg-hover);
  border-color: var(--nav-active);
  color: var(--nav-active);
}
.lang-globe {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}
.lang-btn:hover .lang-globe,
.lang-btn.open .lang-globe {
  opacity: 1;
}
.lang-current {
  font-size: 12px;
  letter-spacing: 0.5px;
}
.lang-arrow {
  font-size: 9px;
  opacity: 0.5;
  transition: transform 0.2s;
}
.lang-btn.open .lang-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--mega-bg);
  border: 1px solid var(--mega-border);
  border-radius: 12px;
  box-shadow: var(--mega-shadow);
  padding: 6px;
  z-index: 1200;
  max-height: 400px;
  overflow-y: auto;
}
.lang-dropdown.open {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--nav-color);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s;
}
.lang-option:hover {
  background: var(--bg-hover);
  color: var(--nav-hover);
}
.lang-option.active {
  color: var(--nav-active);
}
.lang-name {
  flex: 1;
  font-weight: 400;
}
.lang-code {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  opacity: 0.4;
}

.lang-dropdown::-webkit-scrollbar { width: 4px; }
.lang-dropdown::-webkit-scrollbar-track { background: transparent; }
.lang-dropdown::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ============================================
   FAVORITES BUTTON
   ============================================ */
.fav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.fav-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-pink);
}
.fav-btn:hover .fav-icon {
  color: var(--accent-pink);
}
.fav-icon {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  transition: color 0.2s;
}
.fav-count {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent-pink);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  font-family: inherit;
  line-height: 16px;
  text-align: center;
}

/* ============================================
   AUTH BUTTON
   ============================================ */
.auth-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.auth-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.auth-icon {
  width: 16px;
  height: 16px;
  opacity: 0.6;
}
.auth-btn:hover .auth-icon {
  opacity: 1;
}

/* ============================================
   MEGA MENU BUTTON
   ============================================ */
.mega-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  margin-left: 8px; position: relative;
}
.mega-btn:hover {
  background: var(--bg-hover);
  border-color: var(--nav-active);
  color: var(--nav-hover);
}
.mega-btn.open {
  background: var(--accent-blue-muted);
  border-color: var(--nav-active);
  color: var(--nav-active);
}
.mega-grid-icon {
  display: grid;
  grid-template-columns: repeat(3, 4px);
  gap: 2.5px;
}
.mega-grid-icon span {
  width: 4px; height: 4px; border-radius: 1px;
  background: currentColor; opacity: 0.7;
}
.mega-btn .arrow {
  font-size: 10px; opacity: 0.5;
  transition: transform 0.2s;
}
.mega-btn.open .arrow { transform: rotate(180deg); }

/* ============================================
   MEGA MENU PANEL
   ============================================ */
.mega-overlay {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 1090;
}
.mega-overlay.open { display: block; }

.mega-panel {
  display: none;
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 960px;
  background: var(--mega-bg);
  border: 1px solid var(--mega-border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  box-shadow: var(--mega-shadow);
  z-index: 1095;
  padding: 28px 32px 24px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.mega-panel.open {
  display: flex;
  opacity: 1;
}

.mega-columns {
  display: flex;
  gap: 0;
  flex: 1;
}

.mega-col {
  flex: 1;
  padding: 0 20px;
  border-right: 1px solid var(--mega-border);
}
.mega-col:last-child { border-right: none; }
.mega-col:first-child { padding-left: 0; }

.mega-col-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mega-group-title);
  margin-bottom: 14px;
  padding-left: 4px;
}

.mega-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: 8px;
  color: var(--nav-color);
  text-decoration: none;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 400;
}
.mega-item:hover {
  background: var(--bg-hover);
  color: var(--nav-hover);
}
.mega-item:hover .nav-icon { opacity: 1; }

.mega-item-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.mega-item-text {
  display: flex;
  flex-direction: column;
}

/* Banner area in mega menu — LEFT side */
.mega-banner {
  width: 200px;
  flex-shrink: 0;
  margin-right: 20px;
  padding-right: 20px;
  border-right: 1px solid var(--mega-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.mega-banner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: border-color 0.2s;
}
.mega-banner-card:hover {
  border-color: var(--border-strong);
}
.mega-banner-card .banner-emoji {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}
.mega-banner-card .banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.mega-banner-card .banner-desc {
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.5;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */
.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  position: relative;
}
.mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: all 0.3s;
  position: absolute;
}
.mobile-menu-btn span:nth-child(1) { transform: translateY(-6px); }
.mobile-menu-btn span:nth-child(3) { transform: translateY(6px); }
.mobile-menu-btn.open span:nth-child(1) { transform: rotate(45deg); }
.mobile-menu-btn.open span:nth-child(2) { opacity: 0; }
.mobile-menu-btn.open span:nth-child(3) { transform: rotate(-45deg); }

.mobile-nav {
  display: none;
  position: fixed;
  top: 64px;
  left: 0; right: 0; bottom: 0;
  background: var(--bg-base);
  z-index: 1200;
  overflow-y: auto;
  padding: 16px 0;
}
.mobile-nav.open { display: block; }

.mobile-nav-group {
  padding: 8px 20px;
}
.mobile-nav-group-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--mega-group-title);
  padding: 8px 12px 6px;
}
.mobile-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 400;
  border-radius: 10px;
  transition: background 0.15s;
}
.mobile-nav a:hover,
.mobile-nav a:active {
  background: var(--bg-hover);
}
.mobile-nav a .nav-icon {
  opacity: 0.6;
}
.mobile-nav-desc {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 1px;
}
.mobile-nav-sep {
  height: 1px;
  background: var(--border-default);
  margin: 8px 20px;
}

/* Mobile language grid */
.mobile-lang-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px 12px;
}
.mobile-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 6px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.15s;
  border: 1px solid transparent;
}
.mobile-lang:hover,
.mobile-lang:active {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.mobile-lang.active {
  color: var(--nav-active);
  border-color: var(--nav-active);
  background: var(--accent-blue-muted);
}

/* ============================================
   HEADER ICONS GROUP (search + fav + auth + burger)
   ============================================ */
.header-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search toggle button (mobile <768px) */
.header-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all 0.2s;
}
.header-search-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}
.header-search-btn.active {
  background: var(--bg-hover);
  border-color: var(--nav-active);
}
.header-search-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  transition: color 0.2s;
}
.header-search-btn:hover svg,
.header-search-btn.active svg {
  color: var(--nav-active);
}

/* Expanding search bar below header (mobile <768px) */
.header-search-bar {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, padding 0.25s ease;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
}
.header-search-bar.open {
  max-height: 64px;
  padding: 10px 40px;
  overflow: visible;
}
/* Autocomplete dropdown from visa-check / countries inside mobile bar */
.header-search-bar .vc-hs-dropdown,
.header-search-bar .vc-passport-dropdown,
.header-search-bar-inner .vc-hs-dropdown,
.header-search-bar-inner > div > .vc-hs-dropdown,
.header-search-bar [class*="dropdown"] {
  position: absolute;
  z-index: 1200;
  left: 0;
  right: 0;
  top: 100%;
}
.header-search-bar-inner {
  display: flex;
  position: relative;
  align-items: center;
  gap: 10px;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 0 14px;
  height: 40px;
  transition: border-color 0.2s;
}
.header-search-bar-inner:focus-within {
  border-color: var(--border-strong);
}
.header-search-bar-inner svg {
  width: 17px;
  height: 17px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.header-search-bar-inner input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
}
.header-search-bar-inner input::placeholder {
  color: var(--text-tertiary);
}

/* Inline search inside nav (desktop >=768px) */
.header-search-inline {
  display: none;
  flex: 1;
  max-width: 400px;
  margin: 0 auto;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 0 12px;
  height: 34px;
  min-width: 200px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.header-search-inline.visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
.header-search-inline:focus-within {
  border-color: var(--border-strong);
}
.header-search-inline svg {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}
.header-search-inline input {
  flex: 1;
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary);
}

/* Country select inside header-search-inline (airports page) */
.header-search-inline .header-country-select {
  flex-shrink: 0;
  padding: 0 8px;
  height: 26px;
  border: none;
  border-left: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  max-width: 120px;
  outline: none;
}
.header-search-inline .header-country-select:focus {
  color: var(--text-primary);
}
.header-search-inline input::placeholder {
  color: var(--text-tertiary);
}

/* ============================================
   HEADER RESPONSIVE
   ============================================ */
/* Desktop >=768px: mega menu visible, burger hidden, search inline */

/* Airports: hide country select in header when not enough space */
@media (max-width: 1100px) {
  .header-search-inline .header-country-select {
    display: none;
  }
}
@media (min-width: 768px) and (max-width: 1100px) {
  .header-search-inline {
    max-width: 220px;
    min-width: 140px;
  }
}
@media (min-width: 768px) {
  .mobile-menu-btn {
    display: none;
  }
  .header-search-btn {
    display: none !important;
  }
  .header-search-bar {
    display: none !important;
  }
  /* No search: nav-links stays right via margin-left: auto */
  .nav-links {
    margin-left: auto;
    gap: 8px;
  }
  .header-icons {
    gap: 8px;
    margin-left: 8px;
  }
  /* Has search visible: search centered, nav-links loses margin-left: auto */
  .header-inner.has-search .header-search-inline.visible ~ .nav-links,
  .header-inner.has-search:has(.header-search-inline.visible) .nav-links {
    margin-left: 0;
  }
  .header-inner.has-search .header-icons {
    margin-left: 8px;
  }
}

/* Mobile <768px: burger visible, mega menu + lang hidden */
@media (max-width: 767px) {
  .mega-btn {
    display: none;
  }
  .mega-overlay,
  .mega-panel {
    display: none !important;
  }
  .lang-selector {
    display: none;
  }
  .auth-label {
    display: none;
  }
  .auth-btn {
    padding: 6px 8px;
  }
  .fav-btn {
    width: 34px;
    height: 34px;
  }
  .header-inner {
    padding: 0 16px;
    height: 56px;
  }
  .logo-wrap {
    padding: 8px 12px 8px 6px;
    margin-left: -10px;
  }
  .logo-wrap svg {
    width: 150px;
    height: 34px;
  }
  .nav-links {
    gap: 8px;
  }
  .nav-links a {
    font-size: 13px;
  }
  .mobile-nav.open {
    top: 56px;
  }
  .header-search-bar.open {
    padding: 10px 16px;
  }
}

/* Small mobile <480px */
@media (max-width: 479px) {
  .header-inner {
    padding: 0 12px;
  }
  .nav-links {
    gap: 10px;
  }
  .nav-links a {
    font-size: 12px;
  }
  .header-icons {
    gap: 6px;
  }
}