/* 
   MEGAMENU - Diseño Editorial Premium
   Dr. César Mena Rossano
*/

/* 1. COMPORTAMIENTO DEL NAV ITEM */
.nav-item.has-mega {
  position: static;
  /* Necesario para que el megamenu sea full-width */
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-arrow {
  transition: transform 0.3s ease;
  opacity: 0.5;
}

.nav-item:hover .nav-arrow {
  transform: rotate(180deg);
  opacity: 1;
}

/* 2. CONTENEDOR DEL MEGAMENU (Floating Card) */
.mega-menu {
  position: absolute;
  top: calc(100% + 20px);
  /* Separado un poco del nav para el efecto flotante */
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  width: 1100px;
  max-width: calc(100vw - 40px);
  background: var(--color-white);
  border-radius: 2.5rem;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.15);
  padding: 3rem 3rem;
  z-index: 1000;

  /* Estados iniciales para animación */
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.nav-item:hover .mega-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Triángulo decorativo (opcional pero elegante) */
.mega-menu::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 15px solid var(--color-white);
}


/* 3. GRID Y COLUMNAS */
.mega-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3rem;
  padding-bottom: 3rem;
}

.mega-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.mega-icon {
  width: 36px;
  height: 36px;
  background: var(--color-warm);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-accent);
}

.mega-header h3 {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin: 0;
  font-weight: 700;
  line-height: 1.2;
  opacity: 0.8;
  /* Un toque de suavidad extra */
}



/* 4. ENLACES */
.mega-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mega-links li {
  margin-bottom: 0.75rem;
}

.mega-links a {
  text-decoration: none;
  color: var(--color-text-light);
  font-size: 0.95rem;
  transition: all 0.3s ease;
  display: inline-block;
  position: relative;
}

.mega-links a:hover {
  color: var(--color-accent);
  transform: translateX(5px);
}

/* 5. FOOTER DEL MENU */
.mega-footer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  text-align: center;
}

.btn-mega-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  border-radius: 100px;
  background: var(--color-warm);
  color: var(--color-dark);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.btn-mega-view:hover {
  background: var(--color-primary);
  color: var(--color-white);
  transform: translateY(-2px);
}

/* RESPONSIVE */
@media (min-width: 1024px) {
  /* Aseguramos que el megamenu sea relativo al nav para desktop */
  .nav-item.has-mega {
    position: static;
  }
}

@media (max-width: 1023px) {
  .mega-menu {
    position: static;
    width: auto;
    max-width: none;
    transform: none;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    padding: 0;
    background: transparent;
  }
  
  .mega-menu::before {
    display: none;
  }
}