/* ============================
   menu.css – Header & Navigation
============================ */

/* ===== HEADER ===== */
.topnav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.topnav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.header-gap {
  height: 72px;
}

/* ===== BRAND ===== */
.brand {
  display: flex;
  align-items: center;
}

.brand-logo img {
  max-height: 64px;
  display: block;
}

/* ===== MAIN MENU DESKTOP ===== */
.menu {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.menu-item {
  position: relative;
}

.menu-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: #0f172a;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  padding: 0.25rem 0;
}

.menu-link.active {
  color: #2563eb;
  font-weight: 600;
}

/* underline ONLY active top-level */
.menu > .menu-link::after,
.menu > .menu-item > .menu-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: #2563eb;
  opacity: 0;
}

.menu > .menu-link.active::after,
.menu > .menu-item > .menu-link.active::after {
  opacity: 1;
}

/* ===== ARROWS FOR ITEMS WITH CHILDREN ===== */
.menu-item.has-children > .menu-link,
.menu-item.has-mega > .menu-link {
  padding-right: 1rem;
}

.menu-item.has-children > .menu-link::before,
.menu-item.has-mega > .menu-link::before {
  content: "▾";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  opacity: 0.7;
}

.menu-item.open > .menu-link::before {
  transform: translateY(-50%) rotate(180deg);
  opacity: 1;
}

/* ===== SIMPLE SUBMENU ===== */
.submenu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.6rem;
  box-shadow: 0 18px 50px rgba(15,23,42,.16);
  padding: 0.4rem 0;
  z-index: 1100;
}

.menu-item:hover > .submenu,
.menu-item:focus-within > .submenu {
  display: block;
}

.submenu a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  color: #0f172a;
  text-decoration: none;
  border-radius: 0.35rem;
}

.submenu a::before {
  content: "•";
  font-size: 0.75rem;
  color: #cbd5f5;
}

.submenu a:hover {
  background: #eff6ff;
}

/* ===== MEGA MENU ===== */
.mega-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  min-width: 780px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.9rem;
  box-shadow: 0 22px 60px rgba(15,23,42,.18);
  padding: 1.4rem 1.6rem;
  z-index: 1200;
}

.menu-item.has-mega:hover > .mega-menu,
.menu-item.has-mega:focus-within > .mega-menu {
  display: block;
}

.mega-row {
  display: flex;
  gap: 2rem;
}

.mega-col {
  min-width: 160px;
}

.mega-col-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.mega-col-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mega-col-list a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.92rem;
  color: #0f172a;
  text-decoration: none;
  border-radius: 0.35rem;
}

.mega-col-list a::before {
  content: "•";
  font-size: 0.75rem;
  color: #cbd5f5;
}

.mega-col-list a:hover {
  background: #eff6ff;
}

/* ===== BURGER ===== */
.burger {
  display: none;
  background: none;
  border: 0;
  font-size: 1.6rem;
  cursor: pointer;
}

/* ============================
   MOBILE
============================ */
@media (max-width: 768px) {

  .topnav .wrap {
    height: 64px;
  }

  .header-gap {
    height: 64px;
  }

  .burger {
    display: block;
  }

  .menu {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: #fff;
    max-height: 0;
    overflow: hidden;
    border-bottom: 1px solid #e5e7eb;
    transition: max-height .25s ease;
  }

  .menu.open {
    max-height: 100vh;
    overflow-y: auto;
  }

  .menu-item {
    width: 100%;
  }

  .menu-link {
    width: 100%;
    padding: 0.8rem 1.25rem;
  }

  .submenu,
  .mega-menu {
    position: static;
    display: none;
    box-shadow: none;
    border: 0;
    background: #f9fafb;
    padding: 0.4rem 0;
    transform: none;
    min-width: 0;
  }

  .menu-item.open > .submenu,
  .menu-item.open > .mega-menu {
    display: block;
  }

  .mega-row {
    display: block;
  }

  .mega-col {
    padding: 0.3rem 1.25rem;
  }
}
