/* ===========================
   Header / Navigation Styles
   =========================== */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.top-nav-wrapper {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  animation: nav-fadein 0.18s ease;
}

@keyframes nav-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #5a6ea6;
  padding: 10px 24px;
  color: #fff;
  font-family: Arial, sans-serif;
  min-height: 56px;
}

/* ── Logo ──────────────────────────────────────────────────────────────────── */
.top-nav .logo {
  flex-shrink: 0;
}
.top-nav .logo a {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.top-nav .logo a:hover {
  opacity: 0.85;
}

/* ── Search bar ───────────────────────────────────────────────────────────── */
.nav-search {
  flex: 1;
  min-width: 0;
  max-width: 440px;
  margin: 0 8px;
  position: relative;
}

.nav-search-inner {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  height: 36px;
  overflow: visible;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.nav-search-inner:focus-within {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.6);
}

/* Type selector button */
.nav-search-type-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
  border: none;
  border-right: 1px solid rgba(255,255,255,0.25);
  border-radius: 7px 0 0 7px;
  color: rgba(255,255,255,0.92);
  padding: 0 10px;
  height: 100%;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  letter-spacing: 0.01em;
}
.nav-search-type-btn:hover { background: rgba(0,0,0,0.25); }
.nav-search-type-btn svg { flex-shrink: 0; }

/* Type dropdown menu */
.nav-search-type-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  min-width: 150px;
  z-index: 9999;
  overflow: hidden;
  padding: 4px 0;
}
.nav-search-type-menu.open { display: block; }
.nav-search-type-option {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #333;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-search-type-option:hover { background: #f0f2fb; }
.nav-search-type-option.active {
  background: #eef2ff;
  color: #3949ab;
  font-weight: 600;
}

/* Text input */
.nav-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  padding: 0 10px;
  height: 100%;
  font-family: Arial, sans-serif;
}
.nav-search-input::placeholder { color: rgba(255,255,255,0.55); }

/* Search submit button */
.nav-search-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
  padding: 0 11px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.nav-search-btn:hover { color: #fff; }

/* ── Nav links ────────────────────────────────────────────────────────────── */
#main-nav {
  flex-shrink: 0;
}

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

.top-nav nav ul li a,
.top-nav nav ul li .dropbtn {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
  display: inline-block;
  background: none;
  border: none;
  font-family: Arial, sans-serif;
}
.top-nav nav ul li a:hover,
.top-nav nav ul li .dropbtn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

/* ── Upgrade button ──────────────────────────────────────────────────────── */
.top-nav nav ul li a.nav-upgrade,
.top-nav nav ul li .dropbtn.nav-upgrade {
  background: rgba(255,255,255,0.13);
  border: 1.5px solid rgba(255,255,255,0.6);
  color: #fff;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.83rem;
  letter-spacing: 0.01em;
  transition: background 0.18s, border-color 0.18s;
}
.top-nav nav ul li a.nav-upgrade:hover,
.top-nav nav ul li .dropbtn.nav-upgrade:hover {
  background: rgba(255,255,255,0.28);
  border-color: #fff;
}

/* ── Sign In button ──────────────────────────────────────────────────────── */
.top-nav nav ul li a.nav-signin {
  background: #fff;
  color: #3949ab;
  font-weight: 700;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.83rem;
  letter-spacing: 0.01em;
}
.top-nav nav ul li a.nav-signin:hover {
  background: #e8eaff;
  color: #3949ab;
}

/* ── Dropdown ──────────────────────────────────────────────────────────────── */
li.dropdown { position: relative; }

li.dropdown .dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  min-width: 200px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  z-index: 9999;
  padding: 6px 0;
  overflow: hidden;
}

/* Upgrade dropdown is wider (has price meta) */
li.dropdown.upgrade-dropdown .dropdown-content {
  min-width: 240px;
}

/* Right-align the gear and Upgrade dropdowns so they don't overflow viewport */
#nav-links li:last-child .dropdown-content,
#nav-links li.align-right .dropdown-content {
  left: auto;
  right: 0;
}

li.dropdown .dropdown-content a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  color: #2d2d3a;
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.15s;
  gap: 12px;
}
li.dropdown .dropdown-content a:hover { background: #f0f2fb; color: #3949ab; }

/* Section headers inside dropdown */
li.dropdown .dropdown-content .dd-header {
  display: block;
  padding: 8px 16px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #9fa8bc;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* Divider */
li.dropdown .dropdown-content .dd-divider {
  height: 1px;
  background: #eef0f8;
  margin: 6px 0;
}

/* Price meta label */
.dd-meta {
  font-size: 0.78rem;
  color: #9fa8bc;
  font-weight: 400;
  flex-shrink: 0;
}
li.dropdown .dropdown-content a:hover .dd-meta { color: #7986cb; }

li.dropdown:hover .dropdown-content,
li.dropdown .dropdown-content[style*="display: block"] {
  display: block;
}

/* Invisible hover bridge — fills the gap between nav item and dropdown
   so the mouse can travel between them without losing hover state ───── */
li.dropdown .dropdown-content::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* ── Hamburger ─────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
  flex-shrink: 0;
  z-index: 1100;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.22s, opacity 0.22s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Cookie Consent Banner (injected by header.js) ─────────────────────────── */
/* Styles are injected inline by _injectConsentBanner() in header.js */

/* Mobile search row hidden on desktop — only shown inside open hamburger menu */
.mobile-search-row { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media screen and (max-width: 900px) {
  .nav-search { max-width: 260px; }
  .nav-search-type-btn { display: none; }
  .nav-search-inner { border-radius: 8px; }
  .nav-search-input { padding: 0 4px 0 12px; }
}

@media screen and (max-width: 768px) {
  /* Hide desktop search — mobile search is in the hamburger menu */
  .nav-search { display: none; }

  .hamburger { display: flex; }

  .top-nav { padding: 10px 16px; }

  #main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #5a6ea6;
    z-index: 1000;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.22);
  }
  #main-nav.open { display: block; }

  /* Mobile search bar (inside open nav) */
  .mobile-search-row {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }
  .mobile-search-row .nav-search {
    display: flex;
    max-width: 100%;
    margin: 0;
  }
  .mobile-search-row .nav-search-inner { border-radius: 8px; height: 40px; }
  .mobile-search-row .nav-search-type-btn { display: none; }
  .mobile-search-row .nav-search-input { padding: 0 12px; font-size: 0.9rem; }

  .top-nav nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 0 10px;
  }

  .top-nav nav ul li a,
  .top-nav nav ul li .dropbtn {
    display: block;
    padding: 11px 20px;
    border-radius: 0;
    font-size: 0.92rem;
    font-weight: 500;
  }

  /* Override pill buttons on mobile */
  .top-nav nav ul li a.nav-upgrade,
  .top-nav nav ul li .dropbtn.nav-upgrade {
    margin: 8px 16px;
    border-radius: 8px;
    text-align: center;
  }
  .top-nav nav ul li a.nav-signin {
    margin: 8px 16px;
    border-radius: 8px;
    text-align: center;
    color: #3949ab;
  }

  li.dropdown .dropdown-content {
    position: static;
    box-shadow: none;
    border-radius: 0;
    background: rgba(0,0,0,0.14);
    padding: 0;
    min-width: 0;
  }
  li.dropdown .dropdown-content a {
    padding: 9px 20px 9px 34px;
    color: rgba(255,255,255,0.88);
    font-size: 0.85rem;
  }
  li.dropdown .dropdown-content a:hover { background: rgba(255,255,255,0.1); color: #fff; }
  li.dropdown .dropdown-content .dd-header {
    padding: 10px 20px 4px 34px;
    color: rgba(255,255,255,0.5);
  }
  li.dropdown .dropdown-content .dd-divider { background: rgba(255,255,255,0.15); }
  .dd-meta { color: rgba(255,255,255,0.5); }

  /* Keep all dropdowns showing on mobile via JS toggle */
  li.dropdown:hover .dropdown-content { display: none; }
}
