/* =========================================================
   Encabezado de escritorio con mega menú (>= 1000px)
   Parcial: resources/views/partials/desktop-header.blade.php
   Los colores salen del tema activo (variables --site-* de partials/_site_theme).
   ========================================================= */

.mm-header {
  --mm-primary: var(--site-primary, #2b4e9a);
  --mm-primary-dark: var(--site-primary-dark, #1e3f86);
  --mm-primary-soft: var(--site-primary-soft, #eaf0fb);
  --mm-on-primary: var(--site-on-primary-dark, #fff);
  --mm-head-bg: var(--site-header-background, #fff);
  --mm-head-text: var(--site-header-text, #2b4e9a);
  --mm-head-hover: var(--site-header-hover, #eaf0fb);
  --mm-ink: var(--site-text, #1d1f1c);
  --mm-heading: var(--site-heading, #14213d);
  --mm-muted: var(--site-muted, #667085);
  --mm-line: var(--site-border, #dbe3f0);
  --mm-surface: var(--site-surface, #fff);
  --mm-badge-bg: var(--site-badge-background, #c52643);
  --mm-badge-text: var(--site-badge-text, #fff);
  --mm-outlet: var(--site-tag-background, #c52643);
  --mm-button-bg: var(--site-button-background, #2b4e9a);
  --mm-button-text: var(--site-button-text, #fff);
  --mm-button-hover: var(--site-button-hover, #1e3f86);
  --mm-nav-h: 54px;
  --mm-shadow: 0 24px 60px rgba(17, 32, 64, .16);
  --mm-ease: cubic-bezier(.2, .75, .2, 1);

  display: none;
  position: relative;
  z-index: 980;
  background: var(--mm-surface);
  color: var(--mm-ink);
  font-family: "Poppins", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

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

.mm-header a { color: inherit; text-decoration: none; }
.mm-header ul { list-style: none; margin: 0; padding: 0; }
.mm-header p { margin: 0; }
.mm-header button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.mm-header :is(a, button):focus-visible { outline: 3px solid #f8bb4f; outline-offset: 2px; border-radius: 6px; }

.mm-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 28px;
}

@media (min-width: 1000px) {
  .mm-header { display: block; }

  /* El encabezado ya no es fijo: el contenido empieza justo debajo. */
  body.has-mega-menu #app,
  body.has-mega-menu.landing-active.landing-nav-visible #app { padding-top: 0 !important; }

  /* En la home el mega menú reemplaza la barra transparente del slider. */
  body.has-mega-menu .landing-slider-header { display: none !important; }

  body.has-mega-menu .landing-home-promotions--fullscreen { --sp-hero-height: calc(100vh - var(--mm-header-h, 170px)); }
  @supports (height: 100dvh) {
    body.has-mega-menu .landing-home-promotions--fullscreen { --sp-hero-height: calc(100dvh - var(--mm-header-h, 170px)); }
  }
  body.has-mega-menu .landing-home-promotions--fullscreen .landing-home-promo-slide__content { padding-top: 64px; }

  /* Carrito flotante (mínimos por grupo) y aviso del vendedor: debajo de la parte visible del encabezado. */
  body.has-mega-menu #floating-cart-pill.cart-float,
  body.has-mega-menu #seller-customer-info-box { top: calc(var(--mm-offset, 170px) + 14px) !important; }

  /* En el POS (>= 1200px) el aviso no es fijo sino absoluto, junto al título de la página:
     se ancla a la altura total del encabezado, que no cambia con el scroll. */
  @media (min-width: 1200px) {
    body.has-mega-menu:has(.commerce-pos-page) #seller-customer-info-box { top: calc(var(--mm-header-h, 170px) + 14px) !important; }
  }

  /* Como antes en pruebas: el carrito flotante no tapa el slider de la home. */
  body.has-mega-menu.landing-active.mm-over-hero #floating-cart-pill {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateX(-24px) !important;
  }
}

/* ---------- Barra superior ---------- */

.mm-topbar {
  background: color-mix(in srgb, var(--mm-head-bg) 78%, #000);
  color: color-mix(in srgb, var(--mm-head-text) 82%, transparent);
  font-size: 12px;
}

.mm-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 34px;
}

.mm-topbar-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.mm-topbar-links { display: flex; align-items: center; gap: 22px; }
.mm-topbar-links a:hover { color: var(--mm-head-text); text-decoration: underline; }
.mm-topbar strong { color: var(--mm-head-text); font-weight: 700; }
.mm-topbar-links .svg-inline--fa { margin-right: 3px; }

/* ---------- Fila principal: logo, buscador y acciones ---------- */

.mm-main {
  background: var(--mm-head-bg);
  color: var(--mm-head-text);
}

.mm-main-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.mm-logo { flex: none; display: flex; align-items: center; }
.mm-logo img { display: block; width: 190px; height: 52px; object-fit: contain; object-position: left center; }

.mm-search {
  flex: 1 1 auto;
  min-width: 220px;
  max-width: 640px;
  margin: 0 auto;
}

.mm-header .mm-search .catalog-search-form {
  align-items: center;
  height: 48px;
  padding: 4px 4px 4px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--site-search-background, #fff);
  box-shadow: 0 2px 10px rgba(8, 20, 50, .16);
  transition: box-shadow .2s, border-color .2s;
}

.mm-header .mm-search .catalog-search-form:focus-within {
  border-color: var(--mm-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--mm-primary) 22%, transparent);
}

.mm-header .mm-search .catalog-search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--site-search-text, var(--mm-ink));
  font-size: 14px;
}

.mm-header .mm-search .catalog-search-input::placeholder { color: var(--mm-muted); opacity: 1; }

.mm-header .mm-search .catalog-search-form > button {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mm-button-bg);
  color: var(--mm-button-text);
  transition: background-color .2s;
}

.mm-header .mm-search .catalog-search-form > button:hover { background: var(--mm-button-hover); }
.mm-header .mm-search .catalog-search-form > button :is(i, svg) { color: inherit; }
.mm-header .mm-search .catalog-search-suggestions { color: var(--mm-ink); }

.mm-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mm-header .mm-action,
.mm-header .mm-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mm-head-text);
  white-space: nowrap;
}

.mm-header .mm-action {
  min-height: 48px;
  padding: 6px 10px;
  border-radius: 14px;
  transition: background-color .2s;
}

.mm-header .mm-action:hover,
.mm-header .mm-account.open { background: var(--mm-head-hover); }

/* El menú de la cuenta es un .profile-dropdown: el botón ocupa todo el bloque. */
.mm-header .mm-account { position: relative; padding: 0; }
.mm-header .mm-account > .mm-action-btn { min-height: 48px; padding: 6px 10px; }

.mm-action-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
}

.mm-action-text {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
}

.mm-action-text small {
  font-size: 11px;
  font-weight: 400;
  color: color-mix(in srgb, var(--mm-head-text) 72%, transparent);
}

.mm-header .mm-badge {
  position: absolute;
  top: -8px;
  right: -11px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid var(--mm-head-bg);
  border-radius: 999px;
  background: var(--mm-badge-bg);
  color: var(--mm-badge-text);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.mm-header .mm-cart {
  margin-left: 6px;
  padding: 6px 16px 6px 14px;
  border: 1px solid color-mix(in srgb, var(--mm-head-text) 24%, transparent);
  background: color-mix(in srgb, var(--mm-head-text) 10%, transparent);
}

.mm-cart .mm-action-text > span { font-size: 15px; font-weight: 700; }

/* Menú de la cuenta (contenido de partials/_profile_dropdown_menu). */
.mm-header .mm-profile-menu {
  top: calc(100% + 10px);
  right: 0;
  color: var(--mm-ink);
  white-space: normal;
  transform-origin: top right;
  animation: mm-reveal .2s var(--mm-ease);
}

.mm-header .mm-profile-menu::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

/* Pantallas medianas: solo íconos (salvo el carrito) para dar espacio al buscador. */
@media (max-width: 1279.98px) {
  .mm-main-inner { gap: 20px; }
  .mm-actions { gap: 2px; }
  .mm-action:not(.mm-cart) .mm-action-text,
  .mm-account .mm-action-text { display: none; }
  .mm-logo img { width: 160px; height: 46px; }
  .mm-topbar-note { display: none; }
  .mm-topbar-inner { justify-content: flex-end; }
}

/* ---------- Paneles desplegables (comunes) ---------- */

.mm-panel {
  position: absolute;
  z-index: 5;
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  background: var(--mm-surface);
  box-shadow: var(--mm-shadow);
  transition: opacity .18s ease, transform .2s var(--mm-ease), visibility 0s linear .18s;
}

.is-open > .mm-panel,
[data-mm-hover]:has(:focus-visible) > .mm-panel {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .18s ease, transform .2s var(--mm-ease), visibility 0s;
}

.is-suppressed > .mm-panel { visibility: hidden !important; opacity: 0 !important; }

@media (hover: none), (pointer: coarse) {
  .mm-panel, .is-open > .mm-panel { transition: none; transform: none; }
}

.mm-caret {
  margin-left: 6px;
  font-size: 9px;
  opacity: .65;
  transition: transform .2s;
}

.is-open > a .mm-caret,
.is-open > button .mm-caret,
.mm-account.open .mm-caret { transform: rotate(180deg); }

@keyframes mm-reveal {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Barra del menú ---------- */

.mm-nav-holder { min-height: var(--mm-nav-h); }

.mm-nav {
  position: relative;
  background: var(--mm-surface);
  border-bottom: 1px solid var(--mm-line);
  box-shadow: 0 6px 18px rgba(17, 32, 64, .04);
}

.mm-nav.is-stuck {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 980;
  box-shadow: 0 8px 24px rgba(17, 32, 64, .1);
  animation: mm-slide-down .25s var(--mm-ease);
}

@keyframes mm-slide-down {
  from { transform: translateY(-100%); }
  to { transform: none; }
}

.mm-nav-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: 1560px;
  height: calc(var(--mm-nav-h) - 1px);
}

.mm-nav-logo,
.mm-nav-cart { display: none; flex: none; }

.mm-nav.is-stuck .mm-nav-logo,
.mm-nav.is-stuck .mm-nav-cart { display: flex; align-items: center; }

.mm-nav-logo img { display: block; width: 128px; height: 34px; object-fit: contain; object-position: left center; }

.mm-header .mm-nav-cart {
  gap: 14px;
  padding: 8px 16px 8px 13px;
  border-radius: 999px;
  background: var(--mm-button-bg);
  color: var(--mm-button-text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .2s;
}

.mm-nav-cart .mm-action-icon { font-size: 15px; }
.mm-header .mm-nav-cart .mm-badge { top: -10px; right: -13px; border-color: var(--mm-button-bg); }
.mm-header .mm-nav-cart:hover { background: var(--mm-button-hover); }

.mm-menu {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  height: 100%;
}

.mm-item {
  position: relative;
  flex: none;
  display: flex;
}

/* El panel mega se ancla a la barra completa, no al ítem. */
.mm-item--mega { position: static; }

.mm-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 8px;
  color: var(--mm-heading);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color .2s;
}

/* Flecha de las categorías con panel desplegable. */
.mm-link .mm-caret { margin-left: -1px; font-size: 8px; }

/* "Más" es un <button>: el reinicio de .mm-header button no debe quitarle la letra ni el relleno. */
.mm-header button.mm-link { padding: 0 8px; font-size: 13px; font-weight: 600; color: var(--mm-heading); }
.mm-header .mm-item:is(:hover, .is-open, .is-active) > button.mm-link { color: var(--mm-primary); }

.mm-link::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: currentColor;
  transform: scaleX(0);
  transition: transform .22s var(--mm-ease);
}

.mm-item:hover > .mm-link,
.mm-item.is-open > .mm-link,
.mm-item.is-active > .mm-link { color: var(--mm-primary); }

.mm-item.is-open > .mm-link::after,
.mm-item.is-active > .mm-link::after { transform: scaleX(1); }

/* Novedades y Outlet: accesos destacados al final de la barra. */
.mm-item--highlight > .mm-link { color: var(--mm-primary); }
.mm-item--outlet > .mm-link,
.mm-item--outlet:hover > .mm-link,
.mm-item--outlet.is-active > .mm-link { color: var(--mm-outlet); font-weight: 700; }
.mm-item--highlight { margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--mm-line); }

/* Lista desplegable sencilla */
.mm-dropdown {
  top: 100%;
  left: 0;
  min-width: 250px;
  padding: 10px 0 0;
  border: 1px solid var(--mm-line);
  border-top: 3px solid var(--mm-primary);
  border-radius: 0 0 14px 14px;
}

.mm-dropdown--end { left: auto; right: 0; }
#mm-more .mm-dropdown { max-height: calc(100vh - var(--mm-offset, 200px) - 16px); overflow-y: auto; }
.mm-more-category summary { padding: 8px 22px; font-size: 13.5px; cursor: pointer; }
.mm-more-category[open] { background: var(--mm-primary-soft); }
.mm-dropdown .mm-more-category a { padding-inline-start: 34px; }

.mm-dropdown li a {
  display: block;
  padding: 8px 22px;
  color: var(--mm-ink);
  font-size: 13.5px;
  transition: background-color .15s, color .15s, padding-left .15s;
}

.mm-dropdown li a:hover {
  padding-left: 28px;
  background: var(--mm-primary-soft);
  color: var(--mm-primary);
}

.mm-dropdown-all {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px 22px;
  border-top: 1px solid var(--mm-line);
  color: var(--mm-primary) !important;
  font-size: 12.5px;
  font-weight: 700;
}

.mm-dropdown-all:hover { background: var(--mm-primary-soft); }

.mm-dropdown:not(:has(.mm-dropdown-all)) { padding-bottom: 10px; }

/* Panel mega */
.mm-mega {
  top: 100%;
  left: 0;
  right: 0;
  max-height: calc(100vh - var(--mm-offset, 200px) - 16px);
  overflow-y: auto;
  border-top: 1px solid var(--mm-line);
}

.mm-mega-inner {
  display: flex;
  align-items: stretch;
  gap: 48px;
  max-width: 1360px;
  padding-top: 28px;
  padding-bottom: 32px;
}

.mm-mega-body { flex: 1 1 auto; min-width: 0; }

.mm-mega-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--mm-line);
}

.mm-mega-title {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--mm-heading);
  font-size: 19px;
  font-weight: 700;
}

.mm-mega-title .svg-inline--fa,
.mm-mega-title > i {
  width: 36px;
  height: 36px;
  padding: 9px;
  border-radius: 12px;
  background: var(--mm-primary-soft);
  color: var(--mm-primary);
}

.mm-mega-title:hover { color: var(--mm-primary); }

.mm-mega-count {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--mm-primary-soft);
  color: var(--mm-primary);
  font-size: 11.5px;
  font-weight: 600;
}

.mm-mega-cols {
  display: grid;
  grid-template-columns: repeat(var(--mm-cols, 3), minmax(0, 240px));
  gap: 0 36px;
}

.mm-mega-col li a {
  display: block;
  padding: 7px 10px 7px 0;
  border-radius: 8px;
  color: var(--mm-ink);
  font-size: 13.5px;
  transition: background-color .15s, color .15s, padding-left .15s;
}

.mm-mega-col li a:hover {
  padding-left: 10px;
  background: var(--mm-primary-soft);
  color: var(--mm-primary);
}

/* Tarjeta destacada del panel mega: foto de la categoría y acceso directo. */
.mm-feature {
  flex: none;
  display: flex;
  flex-direction: column;
  width: 300px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--mm-primary-dark);
  color: var(--mm-on-primary) !important;
  box-shadow: 0 14px 34px rgba(17, 32, 64, .16);
}

.mm-feature-photo {
  position: relative;
  display: block;
  height: 170px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--mm-primary) 0%, var(--mm-primary-dark) 100%);
}

.mm-feature-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--mm-ease);
}

.mm-feature:hover .mm-feature-photo img { transform: scale(1.06); }

.mm-feature-icon {
  position: absolute;
  left: 18px;
  bottom: -20px;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 3px solid var(--mm-primary-dark);
  border-radius: 14px;
  background: var(--mm-surface);
  color: var(--mm-primary);
  font-size: 18px;
}

.mm-feature-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1 auto;
  padding: 30px 20px 20px;
}

.mm-feature-kicker {
  color: color-mix(in srgb, var(--mm-on-primary) 70%, transparent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.mm-feature-title {
  margin-top: 2px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.mm-feature-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--mm-surface);
  color: var(--mm-primary);
  font-size: 12px;
  font-weight: 700;
  transition: gap .2s;
}

.mm-feature-title + .mm-feature-cta { margin-top: 16px; }
.mm-feature:hover .mm-feature-cta { gap: 12px; }

@media (prefers-reduced-motion: reduce) {
  .mm-header *,
  .mm-header *::before,
  .mm-header *::after { transition: none !important; animation: none !important; }
}
