/**
 * ZD Mega Menu - front
 *
 * Variables (las define el modulo en el atributo style del <nav>):
 *   --zdmm-accent, --zdmm-link, --zdmm-drop-bg, --zdmm-bar-bg,
 *   --zdmm-content (ancho del contenido del desplegable completo),
 *   --zdmm-fs (tamaño de los items), --zdmm-radius.
 *
 * Escritorio por defecto; el JS añade .zdmm--mobile bajo el punto de quiebre.
 *
 * @author Z Digital
 */

.zdmm {
  --zdmm-accent: #2563eb;
  --zdmm-link: #1f2937;
  --zdmm-drop-bg: #ffffff;
  --zdmm-heading: #0f172a;
  --zdmm-sublink: #475569;
  --zdmm-line: rgba(15, 23, 42, 0.08);
  --zdmm-soft: rgba(15, 23, 42, 0.04);
  --zdmm-content: 1320px;
  --zdmm-fs: 15px;
  --zdmm-radius: 14px;
  --zdmm-shadow: 0 28px 60px -18px rgba(15, 23, 42, 0.28), 0 4px 14px rgba(15, 23, 42, 0.06);
  position: relative;
  z-index: var(--zdmm-z, 500);
  font-size: var(--zdmm-fs);
  line-height: 1.4;
  color: var(--zdmm-link);
  background: var(--zdmm-bar-bg, transparent);
  -webkit-font-smoothing: antialiased;
}
.zdmm *,
.zdmm *::before,
.zdmm *::after {
  box-sizing: border-box;
}
.zdmm ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.zdmm a {
  color: inherit;
  text-decoration: none;
}
.zdmm img {
  max-width: 100%;
  height: auto;
  display: block;
}
.zdmm svg {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.zdmm button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Solo movil */
.zdmm-burger,
.zdmm-panel-head,
.zdmm-sub-toggle {
  display: none;
}

/* ---------------------------------------------------------------- Barra */
.zdmm-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 2px;
}
.zdmm-align-center .zdmm-nav { justify-content: center; }
.zdmm-align-right .zdmm-nav { justify-content: flex-end; }
.zdmm-align-justify .zdmm-nav { justify-content: space-between; }

.zdmm-item {
  position: static;
}
.zdmm-drop-is-list {
  position: relative;
}
.zdmm-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 100%;
  padding: 16px 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.zdmm-top::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--zdmm-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.zdmm-item:hover > .zdmm-top,
.zdmm-item.is-open > .zdmm-top,
.zdmm-item.is-active > .zdmm-top,
.zdmm-top:focus-visible {
  color: var(--zdmm-accent);
  outline: none;
}
.zdmm-item:hover > .zdmm-top::after,
.zdmm-item.is-open > .zdmm-top::after,
.zdmm-item.is-active > .zdmm-top::after {
  transform: scaleX(1);
}
.zdmm-caret {
  font-size: 0.85em;
  opacity: 0.7;
  transition: transform 0.25s ease;
}
.zdmm-item.is-open > .zdmm-top .zdmm-caret {
  transform: rotate(180deg);
}
.zdmm-icon,
.zdmm-icon-img {
  display: inline-flex;
  flex: none;
}
.zdmm-icon-img {
  width: auto;
  max-height: 22px;
}
.zdmm-badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--zdmm-accent);
  border-radius: 999px;
  transform: translateY(-7px);
}

/* ------------------------------------------------------------ Desplegable */
.zdmm-drop {
  position: absolute;
  top: 100%;
  /* Cerrado: aparcado fuera de pantalla a la izquierda para no ensanchar la
     pagina (en moviles eso aleja la vista). */
  left: -10000px;
  z-index: 60;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s linear 0.26s, left 0s linear 0.26s;
}
.zdmm:not(.zdmm-js) .zdmm-drop--mega {
  right: 0; /* sin JS: ancho del menu */
}
.zdmm-anim-slide .zdmm-drop { transform: translateY(12px); }
.zdmm-anim-zoom .zdmm-drop { transform: scale(0.98); transform-origin: top center; }
.zdmm-anim-none .zdmm-drop { transition: none; }

.zdmm-item.is-open > .zdmm-drop,
.zdmm:not(.zdmm-js) .zdmm-item:hover > .zdmm-drop,
.zdmm:not(.zdmm-js) .zdmm-item:focus-within > .zdmm-drop {
  left: var(--zdmm-left, 0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition-delay: 0s;
}

.zdmm-drop-panel {
  position: relative;
  background-color: var(--zdmm-drop-bg);
  background-size: cover;
  border: 1px solid var(--zdmm-line);
  border-radius: var(--zdmm-radius);
  box-shadow: var(--zdmm-shadow);
  overflow: hidden;
}
/* Separacion de 8px con puente invisible para no perder el hover */
.zdmm-drop--list,
.zdmm-drop--mega:not([data-width="full"]) {
  padding-top: 8px;
}

/* Completo: de borde a borde de la pantalla, contenido centrado */
.zdmm-drop[data-width="full"] .zdmm-drop-panel {
  border-radius: 0 0 var(--zdmm-radius) var(--zdmm-radius);
  border-left: 0;
  border-right: 0;
}
.zdmm-drop[data-width="full"] .zdmm-drop-inner {
  max-width: var(--zdmm-content);
  margin: 0 auto;
  padding: 40px 24px 44px;
}
.zdmm-drop-inner {
  padding: 30px 34px 34px;
  max-height: calc(100vh - var(--zdmm-top, 120px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Rejilla de 12 columnas (el ancho de cada columna sale del back office) */
.zdmm-row {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 26px 32px;
}
.zdmm-row + .zdmm-row {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--zdmm-line);
}
.zdmm-col { grid-column: span 3; min-width: 0; }
.zdmm-span-1 { grid-column: span 1; }
.zdmm-span-2 { grid-column: span 2; }
.zdmm-span-3 { grid-column: span 3; }
.zdmm-span-4 { grid-column: span 4; }
.zdmm-span-5 { grid-column: span 5; }
.zdmm-span-6 { grid-column: span 6; }
.zdmm-span-7 { grid-column: span 7; }
.zdmm-span-8 { grid-column: span 8; }
.zdmm-span-9 { grid-column: span 9; }
.zdmm-span-10 { grid-column: span 10; }
.zdmm-span-11 { grid-column: span 11; }
.zdmm-span-12 { grid-column: span 12; }
/* Compacto: columnas angostas pasan a dos por fila */
.zdmm-w-sm .zdmm-span-1, .zdmm-w-sm .zdmm-span-2, .zdmm-w-sm .zdmm-span-3,
.zdmm-w-sm .zdmm-span-4, .zdmm-w-sm .zdmm-span-5 { grid-column: span 6; }
.zdmm-w-md .zdmm-span-1, .zdmm-w-md .zdmm-span-2 { grid-column: span 4; }

.zdmm-col-title {
  display: block;
  margin: 0 0 14px;
  padding: 0;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--zdmm-heading);
  transition: color 0.2s ease;
}
a.zdmm-col-title:hover {
  color: var(--zdmm-accent);
}
.zdmm-links > li + li {
  margin-top: 2px;
}
.zdmm-links a,
.zdmm-cat-list a,
.zdmm-text {
  display: inline-block;
  padding: 5px 0;
  font-size: 14.5px;
  font-weight: 400;
  color: var(--zdmm-sublink);
  transition: color 0.18s ease, transform 0.18s ease;
}
.zdmm-links a:hover,
.zdmm-cat-list a:hover {
  color: var(--zdmm-accent);
  transform: translateX(3px);
}
.zdmm-entry--tree > .zdmm-col-title {
  margin-bottom: 10px;
}
.zdmm-cat-sub {
  margin: 0 0 6px 12px !important;
  padding-left: 10px !important;
  border-left: 1px solid var(--zdmm-line);
}
.zdmm-cat-sub a {
  font-size: 13.5px;
  padding: 3px 0;
}

/* Producto */
.zdmm-links a.zdmm-product {
  display: grid;
  gap: 8px;
  padding: 0;
  color: var(--zdmm-heading);
}
.zdmm-links a.zdmm-product:hover {
  transform: none;
}
.zdmm-product-img {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  background: #f6f7f9;
  overflow: hidden;
}
.zdmm-product-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.zdmm-product:hover .zdmm-product-img img {
  transform: scale(1.05);
}
.zdmm-product-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.zdmm-product-price {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 14px;
}
.zdmm-product-price s {
  color: #94a3b8;
  font-size: 12.5px;
}
.zdmm-product-price strong {
  color: var(--zdmm-accent);
}

/* Banner */
.zdmm-links .zdmm-banner {
  display: block;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
}
.zdmm-links a.zdmm-banner:hover {
  transform: none;
}
.zdmm-banner img {
  width: 100%;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.zdmm-banner:hover img {
  transform: scale(1.04);
}

/* Marcas */
.zdmm-entry--brand {
  display: inline-block;
  width: calc(50% - 6px);
  max-width: 150px;
  margin: 0 8px 8px 0 !important;
  vertical-align: top;
}
.zdmm-links a.zdmm-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  padding: 10px;
  border: 1px solid var(--zdmm-line);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.zdmm-brand img {
  max-height: 100%;
  width: auto;
  filter: grayscale(1);
  opacity: 0.75;
  transition: filter 0.25s ease, opacity 0.25s ease;
}
.zdmm-links a.zdmm-brand:hover {
  transform: none;
  border-color: var(--zdmm-accent);
  box-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.3);
}
.zdmm-brand:hover img {
  filter: none;
  opacity: 1;
}
.zdmm-html {
  font-size: 14px;
  color: var(--zdmm-sublink);
}
.zdmm-html img {
  border-radius: 12px;
}

/* Lista de categorias (tipo "Flyout") */
.zdmm-drop--list .zdmm-drop-panel {
  min-width: 250px;
  padding: 8px;
  overflow: visible;
}
.zdmm-tree-item {
  position: relative;
}
.zdmm-tree-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px;
  font-size: 14.5px;
  color: var(--zdmm-sublink);
  border-radius: 8px;
  white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.zdmm-tree-item:hover > .zdmm-tree-link,
.zdmm-tree-item.is-open > .zdmm-tree-link {
  color: var(--zdmm-accent);
  background: var(--zdmm-soft);
  background: color-mix(in srgb, var(--zdmm-accent) 8%, transparent);
}
.zdmm-caret--side {
  opacity: 0.5;
}
.zdmm-tree--l2,
.zdmm-tree--l3 {
  position: absolute;
  top: -8px;
  left: 100%;
  min-width: 230px;
  padding: 8px !important;
  margin-left: 6px !important;
  background: var(--zdmm-drop-bg);
  border: 1px solid var(--zdmm-line);
  border-radius: var(--zdmm-radius);
  box-shadow: var(--zdmm-shadow);
  visibility: hidden;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s, left 0s linear 0.2s, right 0s linear 0.2s;
}
.zdmm-tree-item:not(:hover):not(.is-open) > .zdmm-tree {
  left: -10000px;
  right: auto;
}
.zdmm-tree--l2::before,
.zdmm-tree--l3::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  width: 8px;
}
.zdmm-tree-item.zdmm-flip > .zdmm-tree {
  left: auto;
  right: 100%;
  margin: 0 6px 0 0 !important;
}
.zdmm-tree-item:hover > .zdmm-tree,
.zdmm-tree-item.is-open > .zdmm-tree {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition-delay: 0s;
}

/* Fondo oscurecido */
.zdmm-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: var(--zdmm-top, 0);
  z-index: 40;
  background: rgba(15, 23, 42, 0.38);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.zdmm.zdmm-has-overlay.is-dropping:not(.zdmm--mobile) .zdmm-backdrop {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
.zdmm[data-trigger="click"].is-dropping .zdmm-backdrop {
  pointer-events: auto;
}

/* ------------------------------------------------------------------ Movil */
.zdmm--mobile.zdmm-mobile-hide {
  display: none !important;
}
.zdmm--mobile .zdmm-burger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--zdmm-line);
  border-radius: 10px;
}
.zdmm-burger-icon {
  display: inline-grid;
  gap: 4px;
  width: 20px;
}
.zdmm-burger-icon i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.zdmm-burger-icon i:nth-child(2) {
  width: 70%;
}
.zdmm--mobile .zdmm-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100001;
  width: min(86vw, 390px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--zdmm-drop-bg);
  box-shadow: 0 0 40px rgba(15, 23, 42, 0.25);
  transform: translateX(-102%);
  transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.zdmm--mobile.is-mobile-open .zdmm-panel {
  transform: none;
}
.zdmm--mobile .zdmm-backdrop {
  top: 0;
  z-index: 100000;
}
.zdmm--mobile.is-mobile-open .zdmm-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.zdmm--mobile .zdmm-panel-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px 14px 20px;
  background: var(--zdmm-drop-bg);
  border-bottom: 1px solid var(--zdmm-line);
}
.zdmm-panel-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--zdmm-heading);
}
.zdmm-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 20px;
  background: var(--zdmm-soft);
  border: 0;
  border-radius: 10px;
}
.zdmm--mobile .zdmm-nav {
  display: block;
}
.zdmm--mobile .zdmm-item {
  position: relative;
  border-bottom: 1px solid var(--zdmm-line);
}
.zdmm--mobile .zdmm-top {
  padding: 15px 60px 15px 20px;
  white-space: normal;
  border-radius: 0;
}
.zdmm--mobile .zdmm-top::after,
.zdmm--mobile .zdmm-top .zdmm-caret {
  display: none;
}
.zdmm--mobile .zdmm-sub-toggle {
  position: absolute;
  top: 7px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 18px;
  background: transparent;
  border: 0;
  border-radius: 10px;
}
.zdmm--mobile .zdmm-sub-toggle svg {
  transition: transform 0.25s ease;
}
.zdmm--mobile .zdmm-sub-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.zdmm--mobile .zdmm-drop {
  position: static;
  left: auto;
  display: none;
  width: auto !important;
  padding: 0;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
  transition: none;
}
.zdmm--mobile .zdmm-item.is-open > .zdmm-drop {
  display: block;
}
.zdmm--mobile .zdmm-drop-panel,
.zdmm--mobile .zdmm-drop--list .zdmm-drop-panel {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-color: var(--zdmm-soft);
}
.zdmm--mobile .zdmm-drop-inner,
.zdmm--mobile .zdmm-drop[data-width="full"] .zdmm-drop-inner {
  max-height: none;
  padding: 6px 20px 18px;
}
.zdmm--mobile .zdmm-row {
  display: block;
}
.zdmm--mobile .zdmm-row + .zdmm-row {
  margin-top: 6px;
  padding-top: 6px;
}
.zdmm--mobile .zdmm-col {
  padding: 12px 0 4px;
}
.zdmm--mobile .zdmm-col-title {
  margin-bottom: 6px;
}
.zdmm--mobile .zdmm-hide-mobile {
  display: none !important;
}
.zdmm--mobile .zdmm-entry--product {
  max-width: 220px;
}
.zdmm--mobile .zdmm-tree--l2,
.zdmm--mobile .zdmm-tree--l3 {
  position: static;
  left: auto !important;
  display: none;
  min-width: 0;
  margin: 0 0 6px 14px !important;
  padding: 0 !important;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--zdmm-line);
  border-radius: 0;
  box-shadow: none;
  visibility: visible;
  opacity: 1;
  transform: none;
}
.zdmm--mobile .zdmm-tree-item.is-open > .zdmm-tree {
  display: block;
}
.zdmm--mobile .zdmm-drop--list .zdmm-tree--l1 {
  padding: 6px 12px 12px;
}
.zdmm--mobile .zdmm-tree-link {
  padding: 11px 52px 11px 8px;
  white-space: normal;
}
.zdmm--mobile .zdmm-tree-item > .zdmm-sub-toggle {
  top: 2px;
  right: 0;
}
.zdmm--mobile .zdmm-caret--side {
  display: none;
}
.zdmm-portal {
  position: static;
  z-index: auto;
  background: none;
}
html.zdmm-lock,
html.zdmm-lock body {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .zdmm *,
  .zdmm *::before,
  .zdmm *::after {
    transition-duration: 0.01ms !important;
  }
}
