/**
 * Custom menu styles - lazienkaplus.pl inspired mega menu
 * This file contains fixes for desktop menu layout
 */

/* Header bottom needs relative positioning for absolute mega menu */
.header-bottom {
  position: relative !important;
  z-index: 100;
}

/* Main menu needs static positioning */
.main-menu {
  position: static !important;
}

/* Main menu items need static positioning so mega menu can escape */
.main-menu__tree {
  position: static !important;
}

.main-menu__tree > li {
  position: static !important;
}

/* Main menu improvements */
.main-menu {
  order: -1;
  width: 100%;
  flex: 1 1 auto;
}

@media (min-width: 1200px) {
  .main-menu {
    order: 1;
    width: auto;
    flex: 1 1 auto;
  }
}

.main-menu__tree {
  display: flex !important;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.main-menu__tree > li {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  margin: 0;
}

.main-menu__tree > li > a {
  display: flex !important;
  align-items: center;
  height: 100%;
  padding: 1.25rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--header-color, #212529);
  text-decoration: none;
  outline-offset: -0.5rem;
  transition: color 0.2s ease, background-color 0.2s ease;
  white-space: nowrap;
}

.main-menu__tree > li > a:hover {
  color: var(--bs-primary) !important;
  text-decoration: none;
}

/* Icon support for special menu items */
.main-menu__tree > li > a::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  vertical-align: middle;
}

/* Specific icons for menu items - based on text content */
.main-menu__tree > li > a[href*="nowosci"]::before,
.main-menu__tree > li > a:is([href*="new"], [href*="nowosci"])::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23212529' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='23 6 13.5 15.5 8.5 10.5 1 18'%3E%3C/polyline%3E%3Cpolyline points='17 6 23 6 23 12'%3E%3C/polyline%3E%3C/svg%3E");
}

.main-menu__tree > li > a[href*="promocje"]::before,
.main-menu__tree > li > a:is([href*="promo"], [href*="sale"], [href*="outlet"])::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e74c3c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'%3E%3C/polygon%3E%3C/svg%3E");
}

.main-menu__tree > li > a[href*="hity-sprzedazy"]::before,
.main-menu__tree > li > a:is([href*="bestseller"], [href*="hit"])::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23f39c12' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2'%3E%3C/polygon%3E%3C/svg%3E");
}

.main-menu__tree > li > a[href*="gratis"]::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2327ae60' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='13' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M12 8V5a2 2 0 0 1 2-2v0a2 2 0 0 1 2 2v3'%3E%3C/path%3E%3Cpolyline points='8.5 14 10 15.5 13.5 12'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Hover state - change icon color */
.main-menu__tree > li > a:hover::before {
  opacity: 0.8;
}

/* Remove icon from items without special markers */
.main-menu__tree > li:not([class*="special"]) > a:not([href*="nowosci"]):not([href*="promocje"]):not([href*="hity"]):not([href*="gratis"]):not([href*="new"]):not([href*="promo"]):not([href*="sale"]):not([href*="outlet"]):not([href*="bestseller"]):not([href*="hit"])::before {
  display: none;
}

/* ===== MEGA MENU STYLES ===== */
.mega-menu {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 1050 !important;
  display: none !important;
  opacity: 0;
  visibility: hidden;
  background-color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  border-top: 1px solid #e0e0e0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.mega-menu.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.mega-menu .container {
  max-width: 1600px !important;
  margin: 0 auto !important;
  padding: 0 15px !important;
}

/* Mega menu wrapper - 3 column layout with FIXED height */
.mega-menu__wrapper {
  display: flex !important;
  position: relative;
  min-height: 550px;
  height: 550px;
}

/* Left sidebar with categories - FIXED width */
.mega-menu__sidebar {
  flex: 0 0 220px;
  background-color: #f5f5f5;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  height: 100%;
}

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

.mega-menu__sidebar-item {
  border-bottom: 1px solid #e0e0e0;
  transition: background-color 0.2s ease;
}

.mega-menu__sidebar-item:hover,
.mega-menu__sidebar-item.active {
  background-color: #fff;
}

.mega-menu__sidebar-link {
  display: flex !important;
  align-items: center;
  padding: 14px 16px;
  color: #333 !important;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.mega-menu__sidebar-link:hover {
  color: var(--bs-primary, #0d6efd) !important;
}

.mega-menu__sidebar-icon {
  width: 28px;
  height: 28px;
  margin-right: 10px;
  object-fit: contain;
}

.mega-menu__sidebar-icon-placeholder {
  display: inline-block;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  background-color: #ddd;
  border-radius: 4px;
}

.mega-menu__sidebar-label {
  flex: 1;
}

.mega-menu__sidebar-arrow {
  font-size: 18px;
  color: #999;
  margin-left: auto;
}

/* Center content area - ABSOLUTE positioning for panels */
.mega-menu__content {
  flex: 1;
  position: relative;
  background-color: #fff;
  overflow: hidden;
}

/* All panels positioned absolutely in the same place */
.mega-menu__panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 25px 30px;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.mega-menu__panel.active {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto;
}

.mega-menu__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 25px 30px;
}

.mega-menu__column {
  min-width: 0;
}

.mega-menu__column-title {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: #333 !important;
  text-decoration: none !important;
  margin-bottom: 12px;
  transition: color 0.2s ease;
}

.mega-menu__column-title:hover {
  color: var(--bs-primary, #0d6efd) !important;
}

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

.mega-menu__sublist li {
  margin-bottom: 8px;
}

.mega-menu__sublist-link {
  display: block;
  font-size: 13px;
  color: #666 !important;
  text-decoration: none !important;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.mega-menu__sublist-link:hover {
  color: var(--bs-primary, #0d6efd) !important;
  padding-left: 4px;
}

.mega-menu__empty {
  padding: 40px 20px;
  text-align: center;
}

.mega-menu__view-all {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
}

.mega-menu__view-all-link {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--bs-primary, #0d6efd) !important;
  text-decoration: none !important;
  transition: gap 0.2s ease;
  gap: 6px;
}

.mega-menu__view-all-link:hover {
  gap: 10px;
}

.mega-menu__view-all-link .material-icons {
  font-size: 18px;
}

/* Right featured product panel - FIXED width */
.mega-menu__featured {
  flex: 0 0 220px;
  padding: 20px 15px;
  background-color: #fafafa;
  border-left: 1px solid #e0e0e0;
  height: 100%;
}

.mega-menu__featured-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background-color: #f0f0f0;
  border-radius: 8px;
  border: 2px dashed #ddd;
}

.mega-menu__featured-label {
  font-size: 14px;
  color: #999;
  font-weight: 500;
}

/* Show state when active */
.mega-menu.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Ensure container doesn't interfere */
.mega-menu .container {
  max-width: 100%;
}

/* Fix for nav full width container */
#displayNavFullWidth {
  position: relative;
}

/* Additional layout fixes */
.header-bottom__row {
  position: relative;
}

.header-bottom .col-auto.logo {
  order: 1;
}

.header-bottom .main-menu {
  order: 2;
}

@media (min-width: 1200px) {
  .header-bottom__row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
  }
  
  .header-bottom .main-menu {
    flex: 1 1 auto;
    max-width: none;
  }
}

/* Mobile menu hide on desktop */
@media (max-width: 1199.98px) {
  .main-menu__tree {
    display: none !important;
  }
}

/* Desktop menu show */  
@media (min-width: 1200px) {
  .main-menu__tree {
    display: flex !important;
  }
  
  /* Hide mobile menu toggle */
  .js-top-menu-mobile,
  .js-menu-mobile {
    display: none !important;
  }
}

/* Dropdown toggle styling */
.main-menu__tree > li > a.dropdown-toggle::after {
  display: none;
}

/* Fix any conflicting styles */
.main-menu__tree > li > a[data-depth="0"] {
  color: var(--header-color, #212529) !important;
  padding: 1.25rem 1rem !important;
  font-size: 0.875rem !important;
}

.main-menu__tree > li > a[data-depth="0"]:hover {
  color: var(--bs-primary) !important;
}

