/* ============================================================
   МЕГАМЕНЮ v2 — 3 уровня вложенности + каскадные акции
   4 колонки: depth-1 | depth-2 | depth-3 | акция
   ============================================================ */

/* Контекст позиционирования для абсолютной панели */
@media (min-width: 1201px) {
  nav.header-nav {
    overflow: visible;
  }
  .header-nav-inner {
    position: relative;
  }
  li.has-mega-menu {
    position: static;
  }
}

/* ── Панель мегаменю ──────────────────────────────────── */
.mega-menu-panel {
  display: flex;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  min-height: 420px;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.10);
  border-radius: 0 0 16px 16px;
  z-index: 3000;
  padding: 0;
  overflow: hidden;
  transition: opacity 0.18s ease, visibility 0s linear 0.35s;
}

/* Открытие панели (JS-класс .mega-open) */
@media (min-width: 1201px) {
  li.has-mega-menu.mega-open > .mega-menu-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.18s ease, visibility 0s linear 0s;
  }
}

/* ── Колонка 1: Depth-1 (категории) ──────────────────── */
.mega-col--d1 {
  flex: 0 0 220px;
  background: #f7f8fa;
  padding: 20px 0;
  border-right: 1px solid #eee;
  max-height: 75vh;
  overflow-y: auto;
}

.mega-col--d1 ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Колонка 2: Depth-2 (подкатегории) ───────────────── */
.mega-col--d2 {
  flex: 0 0 240px;
  padding: 20px 0;
  border-right: 1px solid #f0f0f0;
  max-height: 75vh;
  overflow-y: auto;
}

.mega-col--d2 ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Колонка 3: Depth-3 (под-подкатегории) ───────────── */
.mega-col--d3 {
  flex: 1 1 auto;
  padding: 20px 0;
  min-width: 0;
  max-height: 75vh;
  overflow-y: auto;
}

.mega-col--d3 ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Колонка 4: Акция ─────────────────────────────────── */
.mega-col--promo {
  flex: 0 0 280px;
  border-left: 1px solid #eee;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  margin-left: auto;
  
}

/* ── Общие стили пунктов (mega-item) ─────────────────── */
.mega-item {
  list-style: none;
}

.mega-menu-panel .mega-item a {
  padding: 10px 24px 10px 28px;
}

.mega-item a {
  display: block;
  padding: 10px 24px 10px 28px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  line-height: 1.45;
  transition: color 0.15s, background 0.15s;
}

/* Стрелка для пунктов с вложенностью */
.mega-item.has-sub a::after {
  content: '›';
  float: right;
  font-size: 16px;
  opacity: 0.35;
  margin-top: -1px;
}

/* ── Col 1: hover & active ────────────────────────────── */
.mega-col--d1 .mega-item:hover,
.mega-col--d1 .mega-item.is-active {
  background: #fff;
}

.mega-col--d1 .mega-item:hover a,
.mega-col--d1 .mega-item.is-active a {
  color: #e31f26;
  font-weight: 600;
}

/* ── Col 2: hover & active ────────────────────────────── */
.mega-col--d2 .mega-item:hover a,
.mega-col--d2 .mega-item.is-active a {
  color: #e31f26;
  background: #fff5f5;
  border-radius: 6px;
}

/* ── Col 3: hover ─────────────────────────────────────── */
.mega-col--d3 .mega-item a:hover {
  color: #e31f26;
  background: #fff5f5;
  border-radius: 6px;
}

/* ── Текущая страница в мегаменю ─────────────────────── */
.mega-item.current-menu-item a,
.mega-item.current-menu-parent a,
.mega-item.current-menu-ancestor a,
.mega-item.current_page_item a,
.mega-item.current_page_parent a,
.mega-item.current_page_ancestor a {
  color: #e31f26;
  font-weight: 700;
}

/* ── Группа подпунктов (переключается при hover) ──────── */
.mega-group {
  animation: megaFadeIn 0.15s ease;
}

.mega-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

@keyframes megaFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Промо-блок (акция) ──────────────────────────────── */
.mega-promo {
  display: flex;
  flex-direction: column;
  width: 100%;
  animation: megaFadeIn 0.15s ease;
  background: #fff;
  border-radius: 0 0 16px 0;
  overflow: hidden;


}

.mega-promo__body {
  padding: 20px 18px 14px;
  flex: 0 0 auto;
}

.mega-promo__label {
  font-size: 13px;
  color: #2980b9;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}

.mega-promo__title {
  font-size: 20px;
  font-weight: 800;
  color: #1a3a5c;
  line-height: 1.25;
  margin-bottom: 14px;
}

.mega-promo__btn {
  display: inline-block;
  text-align: center;
  color: #fff;
  border-radius: 20px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}

.mega-promo__btn::after {
  content: ' →';
}


.mega-promo img {
  width: 100%;
  height: auto;
  min-height: 180px;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
  margin-top: auto;
}

/* ── Мобильные (≤ 1200px) ─────────────────────────────── */
@media (max-width: 1200px) {
  li.has-mega-menu {
    position: relative;
  }

  .mega-menu-panel {
    position: static;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    box-shadow: none;
    border-radius: 0;
    background: #f9f9f9;
    transition: none;
    flex-direction: column;
    
  }

  li.has-mega-menu.open > .mega-menu-panel {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    height: auto;
  }

  /* Показываем только col-1 */
  .mega-col--d1 {
    flex: none;
    width: 100%;
    background: transparent;
    border-right: none;
    padding: 0;
    max-height: none;
    overflow-y: visible;
  }

  .mega-col--d1 .mega-item a {
    padding: 10px 20px;
    text-align: center;
    font-size: 14px;
  }

  .mega-col--d1 .mega-item.has-sub a::after {
    content: '';
  }

  /* Скрываем col-2, col-3, promo на мобильных */
  .mega-col--d2,
  .mega-col--d3,
  .mega-col--promo {
    display: none;
  }
    /* Сброс отступов и высоты для мобильных, чтобы не было пустоты */
    .mega-menu-panel {
      min-height: 0;
      padding: 0;
      margin: 0;
    }
    .mega-col--d1 {
      min-height: 0;
      padding: 0;
      margin: 0;
    }
}
