/* Mega Menu para OpenCart 3.0.3.x
 * Los colores llegan como variables CSS desde el panel (atributo style del <nav>).
 */

.mm-nav {
  --mm-bg: #1e2a35;
  --mm-color: #f1f5f9;
  --mm-hover-bg: #f59e0b;
  --mm-hover-color: #1e2a35;
  --mm-dd-bg: #ffffff;
  --mm-dd-color: #334155;
  --mm-dd-title: #b45309;

  position: relative;
  margin-bottom: 20px;
  background: var(--mm-bg);
  border-radius: 4px;
  box-sizing: border-box;
  line-height: 1.4;
}

.mm-nav *,
.mm-nav *::before,
.mm-nav *::after {
  box-sizing: border-box;
}

.mm-nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mm-nav a {
  text-decoration: none;
}

/* ---------- Barra principal ---------- */

.mm-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  color: var(--mm-color);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mm-link:hover,
.mm-link:focus {
  color: var(--mm-color);
  text-decoration: none;
}

.mm-link:focus-visible {
  outline: 2px solid var(--mm-hover-bg);
  outline-offset: -3px;
}

.mm-icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
  max-width: none;
  margin-right: 2px;
}

.mm-caret {
  font-size: 14px;
  opacity: .75;
  transition: transform .18s ease;
}

.mm-badge {
  display: inline-block;
  padding: 1px 7px;
  margin-left: 4px;
  border-radius: 9px;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
}

.mm-sub-toggle,
.mm-header {
  display: none;
}

/* ---------- Desplegables: contenido ---------- */

.mm-dd {
  background: var(--mm-dd-bg);
  color: var(--mm-dd-color);
}

.mm-dd a {
  color: var(--mm-dd-color);
}

.mm-dd a:focus-visible {
  outline: 2px solid var(--mm-dd-title);
  outline-offset: 2px;
  border-radius: 2px;
}

.mm-col-title {
  margin-bottom: 10px;
  color: var(--mm-dd-title);
  font-weight: 700;
  font-size: 1.05em;
}

.mm-col-title a,
.mm-col-title > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mm-dd-title);
}

.mm-col-title::after {
  content: "";
  display: block;
  height: 1px;
  margin-top: 8px;
  background: currentColor;
  opacity: .22;
}

.mm-links li,
.mm-sub-item {
  margin: 0;
}

.mm-links a,
.mm-links .mm-plain,
.mm-sub a,
.mm-sub .mm-sub-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
}

.mm-links a:hover,
.mm-sub a:hover,
.mm-col-title a:hover {
  color: var(--mm-dd-title);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mm-html {
  color: var(--mm-dd-color);
}

.mm-html img {
  max-width: 100%;
  height: auto;
}

.mm-html p:last-child {
  margin-bottom: 0;
}

.mm-sub-title {
  font-weight: 700;
  color: var(--mm-dd-title);
}

/* ---------- Escritorio ---------- */

@media (min-width: 768px) {
  .mm-list {
    display: flex;
    flex-wrap: wrap;
  }

  .mm-item {
    position: static;
  }

  .mm-item.mm-dd-list {
    position: relative;
  }

  .mm-item:first-child > .mm-link {
    border-radius: 4px 0 0 4px;
  }

  .mm-item:hover > .mm-link,
  .mm-item.mm-open > .mm-link {
    background: var(--mm-hover-bg);
    color: var(--mm-hover-color);
  }

  .mm-item.mm-open > .mm-link .mm-caret {
    transform: rotate(180deg);
  }

  .mm-link:focus-visible {
    outline-color: #fff;
  }

  .mm-dd {
    position: absolute;
    top: 100%;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transform: translateY(6px);
    border-top: 3px solid var(--mm-hover-bg);
    box-shadow: 0 14px 28px rgba(15, 23, 42, .18);
    transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
  }

  .mm-item.mm-open > .mm-dd,
  .mm-nav:not(.mm-js) .mm-item:hover > .mm-dd {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition-delay: 0s;
  }

  .mm-dd-mega > .mm-dd {
    left: 0;
    right: 0;
    padding: 24px 26px 28px;
    border-radius: 0 0 4px 4px;
  }

  .mm-dd-list > .mm-dd {
    left: 0;
    min-width: 240px;
    padding: 8px 0;
    border-radius: 0 0 4px 4px;
  }

  .mm-dd-list > .mm-dd.mm-right {
    left: auto;
    right: 0;
  }

  .mm-grid {
    display: grid;
    grid-template-columns: repeat(var(--mm-cols, 4), minmax(0, 1fr));
    gap: 22px 34px;
  }

  .mm-sub a,
  .mm-sub .mm-sub-title {
    padding: 7px 20px;
  }

  .mm-sub a:hover {
    background: rgba(15, 23, 42, .05);
    text-decoration: none;
  }

  .mm-sub-nested a {
    padding-left: 36px;
    font-size: .95em;
    opacity: .9;
  }

  .mm-sub .mm-html {
    padding: 8px 20px;
  }
}

@media (min-width: 768px) and (prefers-reduced-motion: reduce) {
  .mm-dd,
  .mm-caret {
    transition: none;
  }
}

/* ---------- Móvil ---------- */

@media (max-width: 767px) {
  .mm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: 0 4px 0 16px;
    color: var(--mm-color);
    font-weight: 600;
  }

  .mm-toggle {
    width: 46px;
    height: 46px;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
  }

  .mm-toggle:focus-visible,
  .mm-sub-toggle:focus-visible {
    outline: 2px solid var(--mm-hover-bg);
    outline-offset: -3px;
  }

  .mm-list {
    display: none;
    border-top: 1px solid rgba(255, 255, 255, .14);
  }

  .mm-nav.mm-expanded .mm-list {
    display: block;
  }

  .mm-item {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
  }

  .mm-item:last-child {
    border-bottom: 0;
  }

  .mm-link {
    padding: 13px 58px 13px 16px;
    white-space: normal;
  }

  .mm-item.mm-open > .mm-link {
    background: var(--mm-hover-bg);
    color: var(--mm-hover-color);
  }

  .mm-caret {
    display: none;
  }

  .mm-sub-toggle {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    width: 48px;
    height: 46px;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, .14);
    background: transparent;
    color: var(--mm-color);
    font-size: 18px;
    cursor: pointer;
  }

  .mm-item.mm-open > .mm-sub-toggle {
    color: var(--mm-hover-color);
    border-left-color: rgba(0, 0, 0, .15);
  }

  .mm-sub-toggle .fa {
    transition: transform .18s ease;
  }

  .mm-item.mm-open > .mm-sub-toggle .fa {
    transform: rotate(180deg);
  }

  .mm-dd {
    display: none;
    padding: 14px 16px 6px;
  }

  .mm-item.mm-open > .mm-dd {
    display: block;
  }

  .mm-grid {
    display: block;
  }

  .mm-col {
    margin-bottom: 16px;
  }

  .mm-sub-nested {
    padding-left: 14px;
  }

  .mm-sub a,
  .mm-sub .mm-sub-title,
  .mm-links a {
    padding: 8px 0;
  }
}
