/* ================= CATEGORY MEGA MENU , PREMIUM REDESIGN ================= */

/* Backdrop */
#mega-menu-overlay {
  position: absolute;
  top: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: 9999;
  background: transparent;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#mega-menu-overlay.mm-open {
  opacity: 1;
  pointer-events: all;
}

/* Main Panel */
#mega-menu-panel {
  width: 100%;
  max-width: 100%;
  height: 85vh;
  max-height: calc(100vh - 100px);
  background: #FFFDF9;
  border-bottom: 1px solid #E8DED4;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-15px);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}
#mega-menu-overlay.mm-open #mega-menu-panel {
  transform: translateY(0);
}

/* Top Bar */
#mm-top-bar {
  display: none !important;
  align-items: center;
  gap: 20px;
  padding: 14px 32px;
  border-bottom: 1px solid #EDE6DD;
  background: #fff;
  flex-shrink: 0;
}
#mm-logo { height: 40px; width: auto; object-fit: contain; flex-shrink: 0; }
#mm-label {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text-dark);
  white-space: nowrap;
  flex-shrink: 0;
  display: none; /* Hide 'Browse Collections' label in dropdown */
}
#mm-label span { color: var(--color-primary); }

#mm-effects-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}
#mm-effects-bar::-webkit-scrollbar { display: none; }

#mm-close-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid #E0D4C5;
  background: #fff;
  color: #6b7280;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.25s ease;
  font-size: 0.82rem;
}
#mm-close-btn:hover {
  background: #FFF0EE;
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: rotate(90deg);
}

/* Mobile Effects Row */
#mm-mobile-effects {
  display: none;
  padding: 10px 16px;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  background: #fff;
  border-bottom: 1px solid #EDE6DD;
  flex-shrink: 0;
}
#mm-mobile-effects::-webkit-scrollbar { display: none; }

/* Body */
#mm-body {
  display: flex;
  flex: 1;
  min-height: 0; /* critical for flex children to scroll */
  overflow: hidden;
}

/* Left Sidebar */
#mm-sidebar {
  width: 230px;
  min-width: 200px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #EDE6DD;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  height: 100%;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#mm-sidebar-label {
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #b0a090;
  padding: 0 20px 12px;
}

#mm-sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}


.mm-cat-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 20px;
  background: transparent;
  border: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}
.mm-cat-btn:hover {
  background: #FAF7F2;
  border-left-color: rgba(233,75,53,0.35);
}
.mm-cat-btn.mm-cat-active {
  background: linear-gradient(90deg, #FFF0EE 0%, #FFFDF9 100%);
  border-left-color: var(--color-primary);
}

.mm-cat-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  transition: transform 0.2s;
}
.mm-cat-btn:hover .mm-cat-icon,
.mm-cat-btn.mm-cat-active .mm-cat-icon { transform: scale(1.1); }

.mm-cat-icon-mushroom { background: #FFF0EE; color: var(--color-primary); }
.mm-cat-icon-edible   { background: #FFFBEB; color: #D97706; }
.mm-cat-icon-capsule  { background: #F0FDF4; color: #16a34a; }
.mm-cat-icon-micro    { background: #EFF6FF; color: #2563eb; }

.mm-cat-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.mm-cat-name {
  font-size: 0.82rem; font-weight: 700; color: #2A211C;
  line-height: 1.2; transition: color 0.2s;
}
.mm-cat-btn:hover .mm-cat-name,
.mm-cat-btn.mm-cat-active .mm-cat-name { color: var(--color-primary); }
.mm-cat-desc { font-size: 0.67rem; color: #a0918a; font-weight: 500; margin-top: 1px; }

.mm-cat-arrow {
  color: #c4b8ae; font-size: 0.65rem;
  flex-shrink: 0; transition: all 0.2s;
}
.mm-cat-btn:hover .mm-cat-arrow,
.mm-cat-btn.mm-cat-active .mm-cat-arrow {
  color: var(--color-primary); transform: translateX(3px);
}

/* Right Products Panel */
#mm-products-panel {
  flex: 1;
  min-width: 0;
  background: #FAF7F2;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  height: 100%;
  padding: 0 28px 24px 28px;
  display: flex;
  flex-direction: column;
}

#mm-products-panel::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Edge */
}

#mm-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: #FAF7F2;
  z-index: 100;
  padding-top: 20px;
  padding-bottom: 15px;
  margin-left: -28px;
  margin-right: -28px;
  padding-left: 28px;
  padding-right: 28px;
  border-bottom: 1px solid #E8DED4;
}
#mm-products-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem; font-weight: 700;
  color: var(--color-text-dark);
  margin: 0 0 2px;
}
#mm-products-subtitle {
  font-size: 0.7rem; color: #a09085; font-weight: 500; margin: 0;
}
#mm-results-count {
  background: #fff;
  border: 1px solid #E0D4C5;
  color: #6b5c55;
  font-size: 0.7rem; font-weight: 700;
  padding: 5px 14px;
  border-radius: 9999px;
  white-space: nowrap;
}

/* Products Grid */
#mm-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Product Card */
.mm-product-card {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #EDE6DD;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
}
.mm-product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 40px -8px rgba(0,0,0,0.15);
  border-color: #d4c8be;
}

.mm-card-img-wrap {
  position: relative; aspect-ratio: 4/3;
  overflow: hidden; background: #F5F0EB;
}
.mm-card-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s ease;
}
.mm-product-card:hover .mm-card-img { transform: scale(1.08); }

.mm-card-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--color-primary); color: #fff;
  font-size: 0.58rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; z-index: 2;
  box-shadow: 0 2px 8px rgba(233,75,53,0.35);
}
.mm-card-wishlist {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; color: #9c8c85;
  cursor: pointer; z-index: 2;
  transition: all 0.2s;
}
.mm-card-wishlist:hover { color: #ef4444; background: #fff; }
.mm-card-sale-badge {
  position: absolute; bottom: 10px; left: 10px;
  background: #22c55e; color: #fff;
  font-size: 0.58rem; font-weight: 800;
  padding: 3px 8px; border-radius: 999px; z-index: 2;
}

.mm-card-tags {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
}

.mm-card-body {
  padding: 12px 14px;
  display: flex; flex-direction: column;
  flex: 1; gap: 8px;
}

/* Shop All Arrow Rotation */
.shop-all-wrapper button i {
  transition: transform 0.3s ease;
}
.shop-all-wrapper button.mm-active i {
  transform: rotate(180deg);
}
.mm-card-rating { display: flex; align-items: center; gap: 5px; }
.mm-card-stars { display: flex; gap: 1px; color: #f59e0b; font-size: 0.63rem; }
.mm-card-reviews { font-size: 0.63rem; color: #9c8c85; font-weight: 600; }

.mm-card-name {
  font-size: 0.8rem; font-weight: 700; color: #2A211C;
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.2s;
}
.mm-product-card:hover .mm-card-name { color: var(--color-primary); }

.mm-card-options { display: flex; flex-wrap: wrap; gap: 4px; }
.mm-opt-pill {
  font-size: 0.63rem; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid #E0D4C5; background: #FAF7F2;
  color: #6b5c55; cursor: pointer; transition: all 0.15s;
}
.mm-opt-pill:hover { border-color: var(--color-primary); color: var(--color-primary); }
.mm-opt-pill.mm-opt-active {
  background: var(--color-primary); border-color: var(--color-primary); color: #fff;
}

.mm-card-footer {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  margin-top: auto; padding-top: 8px;
  border-top: 1px solid #F0EBE4;
}
.mm-card-price-block { display: flex; flex-direction: column; }
.mm-card-price { font-size: 1rem; font-weight: 800; color: #2A211C; line-height: 1.1; }
.mm-card-orig-price {
  font-size: 0.63rem; color: #b0a090;
  text-decoration: line-through; font-weight: 500;
}

.mm-add-btn {
  background: var(--color-primary); color: #fff;
  border: none; border-radius: 9px;
  padding: 8px 13px;
  font-size: 0.7rem; font-weight: 800;
  cursor: pointer; display: flex; align-items: center;
  gap: 5px; transition: all 0.2s; flex-shrink: 0; white-space: nowrap;
}
.mm-add-btn:hover { background: var(--color-primary-hover); transform: scale(1.04); }
.mm-add-btn.mm-added { background: #16a34a; }

/* Effect Filter Chips */
.mm-effect-chip {
  padding: 6px 14px;
  border-radius: 9999px; font-size: 0.7rem; font-weight: 700;
  border: 1.5px solid #E0D4C5; background: #fff;
  color: #6b5c55; cursor: pointer; white-space: nowrap;
  transition: all 0.2s ease; flex-shrink: 0;
}
.mm-effect-chip:hover {
  border-color: var(--color-primary); color: var(--color-primary); background: #FFF3F0;
}
.mm-effect-chip.mm-chip-active {
  background: var(--color-primary); border-color: var(--color-primary); color: #fff;
  box-shadow: 0 4px 14px rgba(233,75,53,0.35);
}

/* Empty State */
.mm-empty {
  grid-column: 1/-1; text-align: center;
  padding: 60px 20px; color: #a09085;
}
.mm-empty i { font-size: 2.5rem; margin-bottom: 14px; display: block; opacity: 0.5; }
.mm-empty p { font-size: 0.85rem; font-weight: 600; margin: 0 0 16px; }
.mm-empty button {
  background: var(--color-primary); color: #fff;
  border: none; border-radius: 10px;
  padding: 9px 22px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; transition: background 0.2s;
}
.mm-empty button:hover { background: var(--color-primary-hover); }

/* Responsive */
@media (max-width: 1300px) {
  #mm-products-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 992px) {
  #mm-products-grid { grid-template-columns: repeat(3, 1fr); }

  /* Tab: Move sidebar to top and make it scrollable */
  #mm-body { flex-direction: column; }
  #mm-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    padding: 10px 16px;
    border-right: none;
    border-bottom: 1px solid #EDE6DD;
  }
  #mm-sidebar-label { display: none; }
  #mm-effects-list {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
  }
  #mm-effects-list::-webkit-scrollbar { display: none; }
  
  .mm-cat-btn {
    width: auto;
    white-space: nowrap;
    padding: 8px 16px;
    border-left: none;
    border-bottom: 3px solid transparent;
    flex-shrink: 0;
    gap: 8px;
  }
  .mm-cat-text {
    gap: 8px;
  }
  .mm-cat-btn:hover {
    border-left-color: transparent;
    border-bottom-color: rgba(233,75,53,0.35);
  }
  .mm-cat-btn.mm-cat-active {
    border-left-color: transparent;
    border-bottom-color: var(--color-primary);
    background: linear-gradient(180deg, #FFFDF9 0%, #FFF0EE 100%);
  }
}

@media (max-width: 768px) {
  #mm-top-bar { padding: 12px 16px; gap: 12px; }
  #mm-products-panel { padding: 16px 12px; }
  #mm-products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (max-width: 480px) {
  #mm-products-grid { grid-template-columns: 1fr; gap: 12px; }
}
