/* =========================================================
   KPH MEGA MENU
   ========================================================= */

/* --- Menu bar --- */
.mega-menu-nav {
  position: relative;
}

ul.mega-menu {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: 'Montserrat', sans-serif;
  overflow: visible !important;
  max-height: none !important;
}

ul.mega-menu > li.mega-menu__item {
  position: static !important;
  margin: 0 !important;
  padding: 0;
  line-height: normal;
  display: block;
  float: none;
}

.mega-menu__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #111;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.mega-menu__link:hover,
.mega-menu__item--active > .mega-menu__link {
  background: #5bade7;
  color: #fff;
}

.mega-menu__chevron {
  transition: transform 0.2s ease;
}

.mega-menu__item:hover .mega-menu__chevron {
  transform: rotate(180deg);
}


/* --- Mega dropdown panel --- */
.mega-menu__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: 24px 28px 28px;
  background: #fff;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.10);
  z-index: 9999;
}

.mega-menu__item--has-dropdown:hover > .mega-menu__dropdown {
  display: block;
}


/* --- Split layout --- */
.mega-menu__split {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
}


/* --- Left: Category links --- */
.mega-menu__cats-heading,
.mega-menu__popular-heading {
  display: block;
  font-family: 'Montserrat', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #999;
  margin-bottom: 14px;
}

.mega-menu__cats-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mega-menu__cats-list li {
  margin: 0;
  padding: 0;
}

a.mega-menu__cats-link,
a.mega-menu__cats-link:visited {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #111 !important;
  text-decoration: none;
  border-bottom: 1px solid #f0f0f0;
  transition: color 0.15s ease;
}

a.mega-menu__cats-link:hover {
  color: #5bade7 !important;
}

a.mega-menu__cats-link svg {
  flex-shrink: 0;
  color: #ccc;
  transition: color 0.15s ease, transform 0.15s ease;
}

a.mega-menu__cats-link:hover svg {
  color: #5bade7;
  transform: translateX(2px);
}

a.mega-menu__cta-link,
a.mega-menu__cta-link:visited {
  display: inline-block;
  margin-top: 18px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #5bade7 !important;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

a.mega-menu__cta-link:hover {
  opacity: 0.7;
}


/* --- Right: Popular products --- */
.mega-menu__popular-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

a.mega-menu__product,
a.mega-menu__product:visited {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: #111 !important;
  padding: 8px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

a.mega-menu__product:hover {
  background: #f8f8f8;
}

.mega-menu__product-img-wrap {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mega-menu__product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

a.mega-menu__product:hover .mega-menu__product-img {
  transform: scale(1.05);
}

.mega-menu__product-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: #111;
  margin-top: 8px;
  line-height: 1.3;
  transition: color 0.15s ease;
}

a.mega-menu__product:hover .mega-menu__product-name {
  color: #5bade7;
}

.mega-menu__product-price {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.mega-menu__product-btn {
  display: inline-block;
  margin-top: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #5bade7;
  transition: opacity 0.15s ease;
}

a.mega-menu__product:hover .mega-menu__product-btn {
  opacity: 0.7;
}

/* Responsive: 3 products on smaller screens */
@media (max-width: 1200px) {
  .mega-menu__popular-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mega-menu__popular-grid a:last-child {
    display: none;
  }
}


/* --- Hamburger toggle (hidden on desktop) --- */
.mega-menu__toggle {
  display: none;
}


/* =========================================================
   MOBILE (<960px)
   ========================================================= */
@media (max-width: 959px) {

  .mega-menu__toggle {
    display: inline-flex !important;
    position: absolute;
    left: 12px;
    top: 8px;
    z-index: 1200;
    align-items: center;
    gap: 6px;
    background: none;
    border: 0;
    padding: 8px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #111;
  }

  .mega-menu-nav .mega-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 360px;
    height: 100dvh;
    background: #fff;
    flex-direction: column !important;
    align-items: stretch;
    padding: 60px 20px 20px;
    gap: 0;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 10000;
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }

  .mega-menu-nav .mega-menu.is-open {
    transform: translateX(0);
  }

  .mega-menu__overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
  }

  .mega-menu__overlay.is-visible {
    opacity: 1;
    visibility: visible;
  }

  .mega-menu__item {
    border-bottom: 1px solid #f0f0f0;
  }

  .mega-menu__link {
    padding: 14px 4px;
    border-radius: 0;
    justify-content: space-between;
  }

  .mega-menu__link:hover {
    background: transparent;
    color: #5bade7;
  }

  /* Mobile dropdown — compact list, no product images */
  .mega-menu__dropdown {
    position: static !important;
    box-shadow: none;
    border-radius: 0;
    padding: 0 0 8px 8px;
    background: #fafafa;
  }

  .mega-menu__item--has-dropdown.is-expanded > .mega-menu__dropdown {
    display: block;
  }

  .mega-menu__split {
    display: block;
  }

  /* Hide popular products on mobile */
  .mega-menu__popular {
    display: none;
  }

  .mega-menu__cats-heading {
    display: none;
  }

  a.mega-menu__cats-link {
    padding: 10px 4px;
    font-size: 14px;
  }

  a.mega-menu__cta-link {
    margin-top: 8px;
    font-size: 12px;
  }
}
