/* =========================
   MEGA MENU (Highly Polished & Responsive)
========================= */

/* Define variables for easy color changes */
:root {
  --teal-color: #008080;
  --light-teal: #e6f7f7;
  --border-color: #ddd;
  --shadow-color: rgba(0, 0, 0, 0.2); /* Slightly stronger shadow for polish */
  --mobile-font: 16px;
}

/* ---------------------------------
   BASE DROP-DOWN STYLES (Desktop)
--------------------------------- */

.mega-menu .dropdown-content {
  position: fixed;
  top: 220px;
  left: 0;
  width: 100vw;
  max-height: 75vh; /* Slightly increased max height */
  overflow-y: auto;

  background: var(--light-teal); /* Light teal backdrop */
  padding: 50px 0; /* Increased vertical padding, removed horizontal for full width grid */

  /* Deeper, more noticeable shadow */
  box-shadow: 0 10px 25px var(--shadow-color);
  z-index: 999;

  /* Thick accent border at the top for visual weight */
  border-top: 5px solid var(--teal-color);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

.mega-menu:hover .dropdown-content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ---------------------------------
   GRID LAYOUT (Desktop - 6 Columns)
--------------------------------- */
.mega-menu .dropdown-content .grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 30px; /* Increased gap for better breathing room */
  max-width: 1300px; /* Increased max width for larger images */

  background: #ffffff;
  padding: 40px; /* Increased padding inside the white container */
  border-radius: 12px; /* More rounded corners */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Internal soft shadow */
  margin: 0 auto;
}

/* Grid Items (The clickable link) */
.mega-menu .dropdown-content .grid a {
  display: block;
  text-align: center;
  text-decoration: none;
  color: #333;
  font-weight: 500;
  padding: 15px 5px; /* Increased padding */
  border-radius: 8px;
  transition: background-color 0.3s ease,
    transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); /* Smoother transform */
}

/* Enhanced Hover Effect */
.mega-menu .dropdown-content .grid a:hover {
  background-color: var(--light-teal);
  color: var(--teal-color);
  transform: translateY(-5px); /* Stronger lift effect */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1); /* Clearer hover shadow */
}

/* Images: INCREASED SIZE */
.mega-menu .dropdown-content .grid a img {
  display: block;
  width: 100%;
  height: 250px; /* Increased height from 200px to 250px */
  object-fit: cover;
  border: 2px solid var(--border-color); /* Thicker border */
  border-radius: 8px; /* Match item rounding */
  margin: 0 0 15px 0; /* Margin below image */
  transition: border-color 0.3s ease;
}

.mega-menu .dropdown-content .grid a:hover img {
  border-color: var(--teal-color);
  box-shadow: 0 0 0 2px var(--teal-color); /* Subtle glow effect */
}

/* Labels below images */
.mega-menu .dropdown-content .grid a span {
  display: block;
  font-size: 16px; /* Larger font size */
  font-weight: 700;
}

/* ---------------------------------
   RESPONSIVENESS: TABLET (e.g., max-width 1024px)
--------------------------------- */
@media (max-width: 1024px) {
  .mega-menu .dropdown-content {
    padding: 30px 0;
  }

  .mega-menu .dropdown-content .grid {
    grid-template-columns: repeat(4, 1fr); /* Decrease to 4 columns */
    max-width: 900px;
    gap: 20px;
    padding: 30px;
  }

  .mega-menu .dropdown-content .grid a img {
    height: 180px; /* Decrease image height for tablet */
  }
}

/* ---------------------------------
   RESPONSIVENESS: MOBILE (e.g., max-width 768px)
   - Remove images
   - Display text in a 2-column tabular/list form
--------------------------------- */
@media (max-width: 768px) {
  .mega-menu .dropdown-content {
    top: 100px; /* Adjust top position for typical mobile nav height */
    max-height: 80vh;
    padding: 20px; /* Padding for the entire dropdown */
  }

  .mega-menu .dropdown-content .grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns for text links */
    max-width: 100%;
    gap: 10px; /* Smaller gap */
    padding: 10px; /* Smaller internal padding */
    border-radius: 0;
    box-shadow: none;
    background: #ffffff; /* Keep white background for the links */
  }

  /* 1. Remove Images */
  .mega-menu .dropdown-content .grid a img {
    display: none;
  }

  /* 2. Style Text Links for Tabular look */
  .mega-menu .dropdown-content .grid a {
    text-align: left; /* Align text to the left */
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color); /* Add a row separator */
    font-size: var(--mobile-font);
    font-weight: 600;
  }

  .mega-menu .dropdown-content .grid a:hover {
    background-color: var(--light-teal);
    transform: none; /* Remove the lift effect on mobile */
    box-shadow: none;
  }

  /* Reset label style */
  .mega-menu .dropdown-content .grid a span {
    font-size: var(--mobile-font);
    font-weight: 600;
    margin-top: 0;
  }

  /* Ensure last row doesn't have a bottom border if not needed, 
     but for simplicity, we'll keep the border-bottom on 'a' which works well for a list. */
}

/* Force hide when scrolled - Kept for compatibility */
.hidden-by-scroll {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
