/* Canonical header styles extracted from index.html
   Controls header layout, logo sizing, nav font sizing, dropdowns and toggles.
   Keep this file minimal — variables remain in the page-level :root declarations.
*/

header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  background: linear-gradient(
    to bottom,
    rgba(248, 251, 255, 0.98),
    rgba(248, 251, 255, 0.92),
    transparent
  );
  border-bottom: 1px solid rgba(206, 220, 239, 0.9);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.logo-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.logo-img {
  width: 290px;
  height: auto;
  display: block;
  image-rendering: auto;
}

.logo-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.badge-beta {
  font-size: 0.7rem;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(8, 36, 73, 0.08);
  color: var(--accent-strong);
  background: rgba(214, 238, 255, 0.9);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 1.05rem;
}

.nav-link {
  padding: 0.35rem 0.5rem;
  color: var(--text-muted);
}

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

.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown .nav-dropdown-toggle { cursor: pointer; display: inline-flex; align-items: center; gap: 0.3rem; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  background: #fff;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(15,40,80,0.08);
  border-radius: 10px;
  padding: 0.45rem;
  min-width: 240px;
  flex-direction: column;
  z-index: 999;
  pointer-events: auto;
}
.dropdown-menu::before {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 0;
  right: 0;
  height: 0.5rem;
}
.dropdown-menu a {
  padding: 0.5rem 0.7rem;
  color: var(--text-main);
  font-size: 0.92rem;
  border-radius: 8px;
}
.dropdown-menu a:hover { background: var(--accent-soft); }
.nav-dropdown:hover .dropdown-menu { display: flex; }
.nav-dropdown.open .dropdown-menu { display: flex; }

/* Ensure nav links in header are not underlined by default */
.nav-links a { text-decoration: none; }

/* Page title section used across application pages */
.page-title-section .container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; text-align: center; }
.page-title-section { padding: 1rem 0; }
.page-title { margin: 0; font-size: clamp(1.9rem, 2.4vw, 2.2rem); font-weight: 700; color: var(--text-main); text-align: center; }

.logo-dropdown { position: relative; }
.logo-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 30px rgba(15,40,80,0.08);
  border-radius: 10px;
  padding: 0.45rem;
  min-width: 200px;
  flex-direction: column;
  z-index: 60;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: translateY(-10px);
  pointer-events: none;
}
.logo-dropdown-menu a {
  padding: 0.5rem 0.7rem;
  color: var(--text-main);
  font-size: 0.88rem;
  border-radius: 8px;
  white-space: nowrap;
}
.logo-dropdown-menu hr {
  margin: 0.5rem 0;
  border: none;
  border-top: 1px solid rgba(15,40,80,0.1);
}
.logo-dropdown-menu a:hover { background: var(--accent-soft); }
.logo-dropdown:hover .logo-dropdown-menu {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  transition-delay: 0.15s;
}

.megamenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 20px 60px rgba(15,40,80,0.12);
  border-radius: 16px;
  padding: 1rem 1.3rem;
  min-width: 820px;
  z-index: 60;
}
.nav-dropdown:hover .megamenu { display: block; }
.nav-dropdown.open .megamenu { display: block; }
.megamenu-grid {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
}
.megamenu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  transition: background 0.2s ease;
  flex: 1;
  min-width: 0;
}
.megamenu-item:hover { background: var(--accent-soft); }
.megamenu-icon {
  font-size: 2rem;
  margin-bottom: 0.35rem;
  line-height: 1;
  opacity: 0.7;
  filter: grayscale(0.8) brightness(0.9);
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}
.megamenu-item:hover .megamenu-icon {
  opacity: 1;
  filter: grayscale(0) brightness(1);
  transform: scale(1.08);
}
.megamenu-label {
  font-size: 0.75rem;
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
}

.nav-cta {
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  border: none;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(38, 140, 214, 0.4);
  cursor: pointer;
}

.nav-cta:hover {
  filter: brightness(1.05);
}

.nav-toggle {
  display: none;
  border: 1px solid rgba(7, 16, 24, 0.15);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  font-size: 0.95rem;
  background: #ffffff;
  color: var(--text-main);
}

@media (max-width: 1024px) {
  .megamenu {
    min-width: 0;
    width: min(96vw, 680px);
  }
}

@media (max-width: 768px) {
  header {
    overflow: visible;
  }

  .nav {
    position: relative;
    padding: 0.6rem 0.9rem;
    gap: 0.6rem;
  }

  .nav-left {
    min-width: 0;
  }

  .nav-links {
    display: none;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
    background: #fff;
    position: absolute;
    left: 0.9rem;
    right: 0.9rem;
    top: calc(100% + 0.4rem);
    padding: 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 10px 40px rgba(15, 40, 80, 0.08);
    z-index: 70;
  }

  .nav-link {
    width: 100%;
    padding: 0.5rem 0.55rem;
  }

  .nav-dropdown,
  .logo-dropdown {
    width: 100%;
  }

  .dropdown-menu,
  .logo-dropdown-menu,
  .megamenu {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    margin-top: 0.35rem;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-shadow: none;
    border-radius: 8px;
    padding: 0.45rem;
  }

  .logo-dropdown:hover .logo-dropdown-menu,
  .nav-dropdown:hover .dropdown-menu,
  .nav-dropdown:hover .megamenu,
  .nav-dropdown.open .dropdown-menu,
  .nav-dropdown.open .megamenu {
    display: flex;
    opacity: 1;
    pointer-events: auto;
  }

  .megamenu {
    display: none;
    border: 1px solid var(--border-subtle);
    background: #fff;
  }

  .megamenu-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
  }

  .megamenu-label {
    white-space: normal;
  }

  .nav-cta {
    width: 100%;
    text-align: center;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .logo-img {
    width: min(220px, 72vw);
    height: auto;
    max-width: 100%;
    image-rendering: auto;
  }
}

@media (max-width: 520px) {
  .megamenu-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
