/* =============== RESET =============== */
*,
*::before,
*::after {
  box-sizing: border-box;
}


/* =============== NAV WRAPPER =============== */
.nav {
  background: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 0.5rem 1rem;
  margin: 2rem auto;
  max-width: 1200px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* =============== MENU BAR =============== */
.menu-bar {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.menu-bar > li {
  position: relative;
}
.menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  color: #1b3b7a;
  padding: 12px 18px;
  border-radius: 10px;
  transition: all 0.25s ease;
}
.menu-link:hover {
  background: #e8f0fe;
  color: #003399;
}

/* Arrow indicator for dropdowns */
.menu-link[aria-haspopup="true"]::after {
  content: "▾";
  font-size: 0.7em;
  margin-left: 6px;
  opacity: 0.6;
  transition: transform 0.25s;
}
.menu-link[aria-haspopup="true"]:hover::after {
  transform: rotate(180deg);
}

/* =============== MEGA MENU BASE =============== */
.mega-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  display: none;
  flex-wrap: wrap;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.1);
  padding: 1.5rem;
  animation: fadeInUp 0.25s ease forwards;
  z-index: 50;
}
.menu-bar > li:hover > .mega-menu {
  display: flex;
}

/* =============== MULTILEVEL STYLES =============== */
.mega-menu--multiLevel > li {
  flex: 1 1 25%;
  padding: 0 1rem;
  position: relative;
}
.mega-menu--multiLevel > li > .menu-link {
  font-weight: 600;
  color: #2a468d;
  margin-bottom: 0.5rem;
}
.mega-menu--multiLevel > li > ul {
  display: none;
  position: absolute;
  top: 0;
  left: 100%;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 1rem;
  width: 240px;
}
.mega-menu--multiLevel li:hover > ul {
  display: block;
}
.mega-menu--multiLevel li ul li a {
  padding: 8px 10px;
  display: block;
  color: #334;
  border-radius: 6px;
  font-size: 0.92rem;
}
.mega-menu--multiLevel li ul li a:hover {
  background: #f2f5ff;
  color: #1a2a8c;
}

/* =============== FLAT MENU (2 یا 3 ستون) =============== */
.mega-menu--flat {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}
.mega-menu-header {
  font-weight: 700;
  color: #003399;
  margin-bottom: 0.5rem;
  display: block;
}
.mega-menu--flat a {
  color: #333;
  font-size: 0.95rem;
  padding: 5px 0;
  display: block;
  border-radius: 6px;
}
.mega-menu--flat a:hover {
  background: #f1f5ff;
  color: #0d248a;
}

/* =============== MOBILE =============== */
@media (max-width: 950px) {
  .menu-bar {
    flex-direction: column;
    align-items: flex-start;
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    width: 80%;
    background: #fff;
    box-shadow: 2px 0 10px rgba(0,0,0,0.15);
    padding: 2rem 1rem;
    transition: left 0.3s ease;
    overflow-y: auto;
  }
  .menu-bar.open {
    left: 0;
  }
  .mobile-menu-trigger {
    background: #1b3b7a;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
  }
  .mega-menu {
    position: static;
    display: none !important;
    box-shadow: none;
    padding: 0;
  }
  .menu-bar > li.open > .mega-menu {
    display: block !important;
  }
  .mega-menu--multiLevel li ul {
    position: static;
    box-shadow: none;
  }
}

/* =============== ANIMATIONS =============== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
