/* ================================
   HEADER – main layout & behavior
================================ */

/* Base Header (desktop / default) */
header {
  background-color: #10375c;
  color: #ffffff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 16px;
  overflow: visible; /* allow dropdown to overflow */
  position: relative;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Menu + Logo Container */
.menu-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hamburger Icon */
.menu-toggle {
  display: none;
  font-size: 26px;
  cursor: pointer;
  color: #ffffff;
  z-index: 9999;
  background: transparent;
  border: none;
}

/* Logo */
.logo img {
  height: 40px;
  display: block;
}

/* Navigation (desktop) */
nav {
  flex: 1 1 auto;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  overflow: visible; /* allow dropdown to overflow */
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
}

nav ul li {
  margin: 0 10px;
  position: relative; /* anchor for submenu */
}

nav ul li a {
  text-decoration: none;
  color: #f0f0f0;
  padding: 5px;
  transition: all 0.3s ease;
  position: relative;
}

nav ul li a::after {
  content: "";
  position: absolute;
  width: 0%;
  height: 3px;
  bottom: -6px;
  left: 0;
  background-color: #57ceee;
  transition: width 0.3s ease;
  border-radius: 2px;
  pointer-events: none; /* don't break hover path */
}

nav ul li a:hover::after {
  width: 100%;
}

nav ul li a:hover {
  color: #57ceee;
}

.dropdown {
  position: relative;
}

/* ===== Desktop submenu ===== */
.dropdown-menu {
  display: block;              /* we'll animate visibility instead */
  position: absolute;          /* anchor to LI */
  top: calc(100% + 8px);       /* small gap under link */
  left: 0;
  z-index: 2000;
  min-width: 220px;
  white-space: nowrap;
  list-style: none;
  background-color: rgba(16, 55, 92, 0.95);
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);

  /* hide by default with transition (prevents jump) */
  visibility: hidden;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}

/* hover/focus opens it */
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

/* invisible bridge removes tiny hover gap */
nav ul > li.dropdown::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 100%;
  height: 12px;
}

.dropdown-menu li a {
  color: #f0f0f0;
  display: block;
  padding: 5px 10px;
  text-decoration: none;
}

.dropdown-menu li a:hover {
  background-color: #57ceee;
  color: #10375c;
}

/* Header actions (Login pill on right) */
.header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-btn {
  padding: 8px 14px;
  background-color: #57ceee;
  color: #10375c;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

/* =========================
   Mobile – up to 768px
========================= */
@media (max-width: 768px) {
  .dropdown.open > ul {
    display: block !important;
  }

  /* Use grid so logo+burger and button share first row */
  header {
    padding: 10px 12px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-auto-rows: auto;
    align-items: center;
    column-gap: 8px;
  }

  /* Left: burger + logo */
  .menu-logo {
    grid-column: 1 / 2;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
  }

  .menu-toggle {
    display: block;
    font-size: 24px;
  }

  .logo img {
    height: 34px;
  }

  /* Right: Login pill – same row as logo */
  .header-actions {
    grid-column: 3 / 4;
    margin-left: 0;
    flex-direction: row;
    align-items: center;
    justify-self: end;
  }

  .login-btn {
    width: auto;
    margin: 0;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: transparent;
    border: 1px solid #57ceee;
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
  }

  .login-btn:hover {
    background-color: rgba(87, 206, 238, 0.12);
  }

  /* Nav: full-width row below */
  nav {
    grid-column: 1 / -1;
    width: 100%;
    display: none;
    flex-direction: column;
    margin-top: 6px;
  }

  nav.active {
    display: flex !important;
  }

  nav ul {
    flex-direction: column;
    width: 100%;
  }

  nav ul li {
    margin: 8px 0;
  }

  /* disable hover-open animation on touch */
  .dropdown:hover .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: none;
  }

  /* mobile submenu stacks in flow */
  .dropdown .dropdown-menu {
    position: static !important;
    box-shadow: none;
    border-radius: 8px;
    margin-top: 4px;

    /* no animation on mobile */
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: none;
    padding: 10px;
  }

  .dropdown.open .dropdown-menu {
    display: block;
  }
}

/* Safari/touch niceties – keep only here */
header,
nav,
.dropdown-menu {
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

/* Ensure links are clickable */
nav a {
  cursor: pointer;
}

/* Prevent Safari overflow issue */
body {
  -webkit-overflow-scrolling: touch;
}
