/* ============ ELEMENTOS GENERALES ============ */
.custom-mega-menu-container {
  position: relative;
  display: flex;
  gap: 30px;
  overflow: visible;
}

/* ============ CONTENEDOR PRINCIPAL DEL MENÚ ============ */
.custom-mega-menu {
  position: relative;
  /* z-index: 100; */
  font-size: 18px;
  background: #fff;
  margin-bottom: 10px;
  overflow: visible;
}

.custom-mega-menu ul {
  list-style-type: none;
  padding-left: 0;
}

/* ============ MENÚ NIVEL 1 ============ */
.main-menu {
  display: flex !important;
  flex-direction: row !important;
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  height: auto !important;
  gap: 0 !important;
}

.main-menu::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #02648f;
  z-index: 10;
  border-radius: 15px;
}

.menu-item {
  position: relative;
  padding: 5px;
  margin-right: 20px;
  list-style-type: none;
  padding-left: 0;
  display: block !important;
  flex-shrink: 0 !important;
  width: auto !important;
  float: none !important;
}

.menu-link {
  position: relative;
  font-weight: 400;
  font-size: 25px;
  text-decoration: none;
  color: #02648f !important;
  display: inline-block;
  padding: 0.5rem 0;
  white-space: nowrap;
  transition: color 0.2s ease;
}

/* Efectos hover nivel 1 */
.menu-item:hover {
  background-color: #fff;
}

.menu-item:hover .menu-link {
  color: #fe5000;
}

.menu-item:hover .menu-link::after,
.menu-item.force-hover .menu-link::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 15px;
  background-color: #fe5000;
  transition: width 0.3s ease;
  z-index: 20;
}

/* ============ MENÚ NIVEL 2 ============ */
/* Contenedor de todos los submenús nivel 2 */
.submenu-level-2-container {
  position: sticky;
  width: 100%;
  margin-top: 10px;
  overflow: visible;
  /* z-index: 100; */
}

/* Ocultar específicamente los submenús que no son el primero */
.submenu-level-2-container .submenu-level-2:not([data-parent="0"]) {
  display: none !important;
  height: 0 !important;
  overflow: hidden !important;
}

.submenu-level-2 {
  position: relative;
  line-height: normal;
  display: block;
  border-radius: 0 0 5px 0;
  z-index: 99;
  padding-top: 7px;
  transition: opacity 0.3s ease;
  opacity: 0;
  visibility: hidden;
  width: 100%;
  overflow: visible;
}

/* Ocultar todos los submenús por defecto */
.submenu-level-2 {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
}

/* Mostrar solo el primer submenu por defecto */
.submenu-level-2[data-parent="0"] {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Reglas específicas para pantallas grandes que sobrescriben las anteriores */
@media (min-width: 993px) {
  .submenu-level-2 {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
  }
}

/* Mostrar submenu cuando el item padre está activo */
.menu-item.active .submenu-level-2 {
  opacity: 1;
  visibility: visible;
}

.submenu-item:hover .submenu-link,
.submenu-item:hover .submenu-link span,
.submenu-item:hover .submenu-link strong {
  color: white !important;
}

/* .menu-item:hover .submenu-level-2,
.menu-item.active .submenu-level-2 {
  display: none;
  animation: fadeIn 0.3s ease;
} */

.submenu-container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  width: auto;
  flex-wrap: nowrap;
  gap: 1rem;
  top: 7px;
  overflow: visible;
}

.submenu-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fe5000;
  display: none;
  z-index: -1;
}

.submenu-item {
  position: relative;
  transition: all 0.3s ease;
  border-radius: 5px 5px 0 0;
  margin: 0;
  text-align: center;
  padding: 5px 10px 0;
  width: auto !important;
  min-width: unset !important;
  flex: 0 0 auto !important;
}

.submenu-link {
  color: #02648f !important;
  font-size: 25px;
  display: block;
  padding: 0.5rem 0;
  transition: color 0.2s ease;
  white-space: nowrap;
}

/* Efectos hover nivel 2 */
.submenu-item:hover {
  background-color: #fe5000;
}

.submenu-item:hover .submenu-link {
  color: white;
}

/* ============ MENÚ NIVEL 3 ============ */
.submenu-level-3 {
  position: fixed;
  top: auto;
  left: auto;
  background: #fe5000;
  min-width: max-content;
  transform: none;
  width: max-content;
  max-width: 800px;
  z-index: 99999;
  display: none;
  padding: 7px;
  border-radius: 0 10px 10px 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  max-height: none;
  overflow: visible;
}

.submenu-level-3.active {
  opacity: 1 !important;
  visibility: visible !important;
  display: block !important;
}

.mega-menu-content {
  display: flex;
  gap: 0;
  align-items: center;
  padding: 10px 0px;
  margin: 0;
  min-width: auto;
}

.mega-menu-content-full {
  width: 940px !important;
}

.flex-container {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
}

.flex-item.level-3 {
  position: relative;
  padding: 2px;
  box-sizing: border-box;
}

.nivel-3-enlace {
  font-family: 'DINNextRoundedLTPro', sans-serif;
  color: #FFFFFF !important;
  text-decoration: none;
  display: block;
  white-space: normal;
  word-wrap: break-word;
  text-align: left;
  width: 100%;
  font-size: 20px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 1.2;
  margin-bottom: 7px;

  font-weight: 300;
  font-style: normal;
  vertical-align: middle;
}

.nivel-3-enlace > span {
  display: flex;
  align-items: center;
}

.nivel-3-enlace > span p {
  margin: 0;
  padding: 0;
}

.level3-arrow {
  margin-left: 5px;
  flex-shrink: 0;
  color: #fff;
  transition: transform 0.3s ease;
}

.menu-column {
  /*max-width: 250px !important;*/
}

div.row.row-level-3 {
  margin-left: 0px !important;
  width: 100%;
}

/* ============ ESTILOS ESPECIALES PARA "CUIDADOS" ============ */
.submenu-level-3.special-layout .mega-menu-content {
  flex-direction: column;
  max-width: 300px;
  min-width: 250px;
}

.submenu-level-3.special-layout .row-level-3 {
  width: 100%;
  margin-bottom: 5px;
  padding: 0 4px;
}

.submenu-level-3.special-layout .menu-column {
  width: 100% !important;
  flex: 0 0 100% !important;
}

.submenu-level-3.special-layout .menu-column.has-divider::after {
  display: none;
}

.submenu-level-3.special-layout .media-column.special-media {
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto !important;
  position: relative;
  left: 0;
  display: flex;
  justify-content: center;
}

.submenu-level-3.special-layout .media-column.special-media::before {
  display: none;
}

.submenu-level-3.special-layout .media-column.special-media .menu-media {
  max-height: 200px;
  max-width: 100px;
  object-fit: contain;
}

.submenu-level-3.special-layout .media-column::before {
  display: none !important;
}

.submenu-level-3.special-layout .media-column-video::before {
  display: none !important;
}

.submenu-level-3.special-layout .media-column .menu-media {
  max-height: 200px;
  max-width: 100%;
  object-fit: contain;
}

/* ============ SEPARADORES DE COLUMNAS ============ */
.menu-column.has-divider {
  position: relative;
  width: 250px !important;
}

.menu-column.has-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  height: 100%;
  width: 1px;
  background-color: rgb(255, 255, 255);
}

/* Agregar margen al media-column para separación visual */
.media-column {
  margin-left: 20px;
  position: relative;
}

/* Nueva línea entre la última columna y el media-column */
.media-column::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -20px;
  transform: translateY(-50%);
  height: 100%;
  width: 1px;
  background-color: rgb(255, 255, 255);
}
.media-column-video::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 53%;
  transform: translateY(-50%);
  height: 296px;
  width: 1px;
  background-color: rgb(255, 255, 255);
}

.row-level-3.has-media {
  margin: auto;
  margin-right: 10px;
}

/* ============ MENÚ NIVEL 4 ============ */
.submenu-level-4 {
  position: absolute;
  /* left: 10px !important; */
  /* top: 3px !important; */
  padding: 7px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 1003 !important;
  background-color: white;
  width: 100%;
  max-width: fit-content;
}

.nivel-4-enlace {
  color: #fe5000 !important;
  font-size: 20px;
  padding: 2px 0;
  display: block;
  transition: all 0.2s ease;
  text-align: start;
}

/* ============ MEDIA COLUMNS ============ */
.media-column {
  position: sticky;
  top: 20px;
  height: fit-content;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  flex-shrink: 0;
  max-width: 270px;
  max-height: 270px;
  width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 10px;
}

.menu-media {
  width: 100%;
  max-height: 175px;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.menu-media-video {
  max-height: 352px !important;
  opacity: 1;
  border-radius: 8px;
  object-fit: cover !important;
  display: block !important;
  width: 286px !important;
  height: 350px;
}
.media-column-video {
  max-height: 350px !important;
  width: 286px !important;
  max-width: 286px !important;
  opacity: 1;
  border-radius: 8px;
  object-fit: cover !important;
  display: block !important;
  margin-right: 12px;
  margin-left: 50px;
}

/* ============ ANIMACIONES ============ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ RESPONSIVIDAD ============ */
/* ============ PANTALLAS GRANDES ============ */
@media (min-width: 993px) {
  /* Estructura de filas para pantallas grandes */
  .custom-mega-menu {
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    width: 100% !important;
    margin-top: 0 !important;
  }

  /* Primera fila: Menú nivel 1 */
  .main-menu {
    display: flex !important;
    flex-direction: row !important;
    position: relative !important;
    z-index: 100 !important;
    order: 1 !important;
    margin-bottom: 10px !important;
    height: auto !important;
  }

  /* Elementos nivel 1 */
  .menu-item.level-1 {
    display: inline-block !important;
    margin-right: 20px !important;
    position: relative !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }

  /* Asegurar que el menú nivel 1 esté en una sola fila horizontal */
  .main-menu .menu-item.level-1 {
    float: none !important;
    clear: none !important;
    width: auto !important;
  }

  /* Segunda fila: Submenús nivel 2 */
  .submenu-level-2 {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    z-index: 99 !important;
    order: 2 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    margin-top: 0 !important;
  }

  /* Mostrar submenu activo */
  .menu-item.level-1.active .submenu-level-2 {
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
  }

  /* Primer submenu visible por defecto */
  .menu-item.level-1:first-child .submenu-level-2 {
    opacity: 1 !important;
    visibility: visible !important;
    position: relative !important;
  }

  /* Contenedor de elementos nivel 2 */
  .submenu-container {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    padding: 10px 0 !important;
    max-width: none !important;
    margin: 0 !important;
    top: 0 !important;
  }

  /* Elementos nivel 2 */
  .submenu-item.level-2 {
    position: relative;
    display: inline-block !important;
    margin: 0 2px !important;
    padding: 8px 12px !important;
    border-radius: 5px !important;
    background: transparent !important;
    transition: background-color 0.2s ease !important;
  }

  .submenu-level-3 {
    position: absolute;
    /* Relativo al ítem nivel 2 */
    top: 100%;
    left: 0;
    min-width: max-content;
    /* Eliminar fixed, top y left heredados */
  }

  .submenu-link {
    position: relative;
    font-weight: 400;
    font-size: 25px !important;
    text-decoration: none;
    color: #02648f !important;
    display: inline-block;
    padding: 0 !important;
    transition: color 0.2s ease;
    white-space: nowrap;
  }

  .submenu-item.level-2:hover {
    background: transparent !important;
  }

  .submenu-item.level-2:hover {
    background-color: #fe5000 !important;
    border-radius: 5px 5px 0 0 !important;
    transition: background-color 0.2s ease !important;
  }

  .submenu-item.level-2:hover .submenu-link {
    color: white !important;
  }
}

/* ============ PANTALLAS MEDIANAS (992px a 576px) ============ */
@media (max-width: 992px) {
  .custom-mega-menu {
    position: static;
  }

  .main-menu {
    flex-direction: row;
    height: auto;
    align-items: flex-start;
  }

  .menu-item {
    /* width: fit-content; */
    margin-left: 0;
    padding: 0;
  }

  .menu-link {
    display: block;
    padding: 12px 15px;
    font-size: 22px;
  }

  .submenu-level-2 {
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: none;
    padding: 0;
  }

  .submenu-container {
    flex-direction: row;
    /* max-width: 70%; */
    padding: 0;
  }

  .submenu-item {
    /* width: 70% !important; */
    text-align: left;
    padding: 0;
  }

  .submenu-item:hover {
    width: auto !important;
    min-width: unset !important;
    flex: 0 0 auto !important;
  }

  .submenu-link {
    /* padding: 10px 15px; */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 22px;
  }

  .submenu-level-3 {
    position: fixed;
    /* width: 100% !important; */
    /* left: 0 !important;
    top: 0 !important; */
    box-shadow: none;
    padding: 0;
  }

  .mega-menu-content {
    flex-direction: row;
  }

  .row-level-3 {
    flex-direction: row;
  }

  .menu-column {
    max-width: 100% !important;
    padding: 0;
  }

  .menu-column.has-divider::after {
    display: none;
  }

  .media-column {
    max-width: 100% !important;
    margin: 15px 0;
  }

  .media-column::before, .media-column-video::before {
    display: none;
  }
}

@media (min-width: 993px) {
  .submenu-level-2 {
    overflow: visible !important;
    /* Permite que el contenido sobresalga */
    min-height: auto !important;
    /* Elimina altura mínima fija */
    height: auto !important;
    /* Altura automática */
  }

  .submenu-container {
    overflow: visible !important;
    /* Permite contenido externo */
    position: static;
    /* Elimina posicionamiento relativo */
    min-height: 0;
    /* Elimina altura mínima */
    padding-bottom: 50px;
    /* Espacio para el nivel 3 */
  }

  .submenu-level-3 {
    position: absolute !important;
    /* Posición absoluta respecto al viewport */
    top: 100% !important;
    /* Coloca debajo del nivel 2 */
    left: 0 !important;
    width: 100% !important;
    z-index: 10000 !important;
    /* Asegura que esté por encima */
    max-height: none !important;
    overflow: visible !important;
  }
}

/* Regla específica para submenús nivel 3 con media y 3 columnas */
.submenu-level-3.with-media[data-columns="3"] .mega-menu-content-full {
  width: 1080px !important;
}

.custom-mega-menu, .custom-mega-menu * {
  font-family: 'DINNextRoundedLTPro', sans-serif !important;
}
