/* ============================================================
   Xiaomi Market – Mega Menu (v1)
   Dropdown anchored to .xm-allcats ("Všechny kategorie") button.
   Pure CSS. No frameworks.
   ============================================================ */

/* ---------- Wrapper / positioning ---------- */
/* NOTE: All colour/font/timing tokens are inherited from xiaomi-shoptet.css.
   Only megamenu-specific overrides live here so that :root in shoptet.css
   is the single source of truth and --xm-radius/--xm-radius-sm are not
   accidentally overridden for the whole page. */
.xm-megamenu {
  /* Local overrides — larger radii look better for this panel */
  --xm-radius: 14px;
  --xm-radius-sm: 10px;
  /* Shadow not defined in shoptet.css */
  --xm-shadow: 0 24px 60px -20px rgba(17, 17, 17, 0.22),
    0 8px 20px -10px rgba(17, 17, 17, 0.10);

  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: min(1160px, calc(100vw - 48px));
  background: #fff;
  border: 1px solid var(--xm-line);
  border-radius: var(--xm-radius);
  box-shadow: var(--xm-shadow);
  z-index: 10000;
  font-family: var(--xm-font);
  color: var(--xm-ink);
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--xm-t), transform var(--xm-t),
    visibility 0s linear var(--xm-t);
  pointer-events: none;
}
.xm-megamenu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity var(--xm-t), transform var(--xm-t), visibility 0s;
}

/* Invisible bridge fills the 4 px gap between the button and the panel so
   the menu does not close when the cursor moves diagonally between them. */
.xm-megamenu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

/* The pill needs to be the positioning context */
.xm-allcats-wrap { position: relative; }

/* ---------- Left sidebar ---------- */
.xm-mm-sidebar {
  background: #fff;
  border-right: 1px solid var(--xm-line);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xm-mm-cat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--xm-radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--xm-ink-2);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background var(--xm-t), color var(--xm-t),
    border-color var(--xm-t);
  text-decoration: none;
  background: transparent;
}
.xm-mm-cat:hover { background: var(--xm-soft); color: var(--xm-ink); }
.xm-mm-cat .xm-mm-cat-ico {
  width: 22px; height: 22px; flex: 0 0 22px;
  display: grid; place-items: center; color: var(--xm-muted);
  transition: color var(--xm-t);
}
.xm-mm-cat .xm-mm-cat-ico svg { width: 20px; height: 20px; }
.xm-mm-cat .xm-mm-cat-label { flex: 1; }
.xm-mm-cat .xm-mm-cat-chev {
  width: 16px; height: 16px; color: var(--xm-muted);
  transition: transform var(--xm-t), color var(--xm-t);
}

.xm-mm-cat.is-active {
  background: var(--xm-orange-tint);
  color: var(--xm-orange);
  border-left-color: var(--xm-orange);
  font-weight: 600;
}
.xm-mm-cat.is-active .xm-mm-cat-ico,
.xm-mm-cat.is-active .xm-mm-cat-chev { color: var(--xm-orange); }

/* ---------- Right panel ---------- */
.xm-mm-panel {
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 460px;
}

.xm-mm-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.xm-mm-col-title {
  font-family: var(--xm-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--xm-ink);
  margin: 0 0 14px;
}

.xm-mm-col-list { list-style: none; margin: 0; padding: 0; }
.xm-mm-col-list li { margin: 0; }
.xm-mm-col-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 14px;
  color: var(--xm-ink-2);
  text-decoration: none;
  transition: color var(--xm-t);
}
.xm-mm-col-list a::before {
  content: "";
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--xm-muted);
  transition: background var(--xm-t), transform var(--xm-t);
  flex: 0 0 4px;
}
.xm-mm-col-list a:hover { color: var(--xm-orange); }
.xm-mm-col-list a:hover::before {
  background: var(--xm-orange); transform: scale(1.4);
}

/* ---------- Banner ---------- */
.xm-mm-banner {
  margin-top: auto;
  position: relative;
  background: radial-gradient(
      circle at 85% 50%,
      rgba(237, 77, 110, 0.55) 0%,
      rgba(237, 77, 110, 0) 55%
    ),
    linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  color: #fff;
  border-radius: var(--xm-radius);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
}
.xm-mm-banner-text { display: flex; flex-direction: column; gap: 6px; }
.xm-mm-banner-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--xm-orange);
}
.xm-mm-banner-tag svg { width: 12px; height: 12px; }
.xm-mm-banner-title {
  font-family: var(--xm-display);
  font-weight: 700;
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
  color: #fff;
}
.xm-mm-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--xm-orange);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--xm-t), transform var(--xm-t);
  box-shadow: 0 8px 20px -8px rgba(237, 77, 110, 0.7);
}
.xm-mm-banner-btn:hover {
  background: var(--xm-orange-600);
  transform: translateY(-1px);
}
.xm-mm-banner-btn svg { width: 16px; height: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .xm-megamenu {
    grid-template-columns: 1fr;
    width: min(560px, calc(100vw - 24px));
  }
  .xm-mm-sidebar { border-right: 0; border-bottom: 1px solid var(--xm-line); }
  .xm-mm-cols { grid-template-columns: 1fr 1fr; gap: 20px; }
  .xm-mm-panel { padding: 20px; min-height: 0; }
  .xm-mm-banner { flex-direction: column; align-items: flex-start; }
}
/* Ensure the wrapper never clips the dropdown */
.xm-allcats-wrap {
  overflow: visible !important;
}
/* Hard-override any Shoptet z-index on children that might overlap */
body.xm-enhanced .xm-megamenu {
  z-index: 10000 !important;
}