/**
 * Moderne WooCommerce Megamenu Stilarter - Modified
 */

.modern-megamenu-container {
  width: 100%;
  position: relative;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Hovednavigation */
.modern-megamenu {
  background-color: transparent!important;
  box-shadow: 0 px 0px rgba(0, 0, 0, 0);
  border-radius: 0px;
}

.megamenu-main-nav {
  display: flex;
  list-style-type: none;
  margin: 0;
  padding: 0;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.megamenu-item {
  position: relative;
  margin: 0;
  padding: 0;
  transition: all 0.3s ease;
}

.megamenu-item-link {
  display: flex;
  align-items: left;
  padding: .3rem .7rem;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  transition: all 0.2s ease-in-out;
  font-family: 'Inter', sans-serif;
}

.megamenu-item-link:hover {
  color: #0073aa;
  background-color: rgba(0, 115, 170, 0.05);
}

.dropdown-icon {
  margin-left: 0rem;
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.megamenu-item:hover .dropdown-icon {
  transform: rotate(180deg);
}

/* Dropdown container - FULL WIDTH */
.megamenu-dropdown {
  position: fixed !important;
  top: auto !important;
  left: 0 !important;
  right: 0 !important;
  width: 100vw !important;
  min-width: 100vw !important;
  max-width: 100vw !important;
  background-color: #fff;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
  border-radius: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 9999;
  display: none; /* Add to ensure dropdown is fully hidden */
}

/* Megamenu container */
.megamenu-container {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Kategorier grid - using flex instead of grid to eliminate gaps */
.megamenu-categories {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 1300px;
  margin: 0 auto;
  padding: 0;
  /* Remove any potential margin or padding that could create space */
  border: none;
  font-size: 0; /* Eliminate whitespace between inline elements */
}

/* Updated category styling for flex layout */
.megamenu-category {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  width: calc(100% / 7); /* Exactly 1/6 of the total width */
  max-width: none; /* Remove max-width constraint */
  padding: 1rem 0.5rem;
  margin: 0;
  background-color: #f9f9f9;
  /* Reset any potential spacing */
  box-sizing: border-box;
  border: none;
  font-size: 1rem; /* Reset font size */
}

/* Add hover effect */
.megamenu-category:hover {
  background-color: #f2f2f2;
  transform: translateY(-2px);
  z-index: 1;
}

/* To ensure dropdown is properly centered */
.megamenu-dropdown {
  display: flex;
  justify-content: center;
}

/* Subcategory thumbnail styles - NEW */
.subcategory-thumbnail {
  width: 1500px;
  height: 1500px;
  margin-bottom: 10px;
  border-radius: 5px;
  overflow: hidden;
}

.subcategory-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.subcategory-thumbnail a {
  display: block;
  width: 100%;
  height: 100%;
}

.megamenu-category-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}

.megamenu-category-title a {
  color: #333;
  text-decoration: none;
  transition: color 0.2s ease;
}

.megamenu-category-title a:hover {
  color: #0073aa;
}

.megamenu-subcategory-list {
  margin: 0;
  padding: 0;
  list-style-type: none;
  text-align: center;
}

.megamenu-subcategory-list li {
  margin-bottom: 0.5rem;
}

.megamenu-subcategory-list a {
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
  display: block;
  padding: 0.25rem 0;
}

.megamenu-subcategory-list a:hover {
  color: #0073aa;
}

/* Featured området */
.megamenu-featured {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.megamenu-featured-products {
  background-color: #f9f9f9;
  padding: 1.5rem;
  border-radius: 6px;
}

.featured-title {
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: #333;
}

.featured-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.featured-product {
  transition: transform 0.2s ease;
}

.featured-product:hover {
  transform: translateY(-5px);
}

.featured-product a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.featured-product img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.featured-product h4 {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
}

.featured-product .price {
  font-weight: 600;
  color: #0073aa;
}

/* Salgsbanner */
.megamenu-sale-banner {
  background-color: #0073aa;
  color: white;
  padding: 1.5rem;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}

.megamenu-sale-banner:before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  z-index: 1;
}

.sale-banner-content {
  position: relative;
  z-index: 2;
}

.megamenu-sale-banner h3 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}

.megamenu-sale-banner p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.sale-button {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: white;
  color: #0073aa;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.sale-button:hover {
  background-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

/* Kategori billede */
.megamenu-category-image {
  max-width: 250px;
}

.megamenu-category-image img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  transition: transform 0.3s ease;
}

.megamenu-category-image a {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}

.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.megamenu-category-image:hover .image-overlay {
  opacity: 1;
}

.megamenu-category-image:hover img {
  transform: scale(1.05);
}

.view-category {
  color: white;
  background-color: rgba(0, 0, 0, 0.7);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
}

.megamenu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.megamenu-item-thumbnail {
    max-width: 34px!important;
    max-height: 34px!important;
    overflow: hidden;
}

.megamenu-item-thumbnail img {
    width: 83%!important;
    height: auto;
    display: block;
}

/* Responsivt design */
@media (max-width: 1024px) {
  .megamenu-container {
    grid-template-columns: 1fr;
  }
  
  .megamenu-categories {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .megamenu-featured {
    margin-top: 1.5rem;
    flex-direction: row;
  }
  
  .megamenu-category-image {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .megamenu-dropdown {
    position: static;
    min-width: 100%;
    box-shadow: none;
    visibility: visible;
    opacity: 1;
    transform: none;
    display: none;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
  }
  
  .megamenu-item.active .megamenu-dropdown {
    display: block;
  }
  
  .megamenu-container {
    padding: 1rem;
  }
  
  .megamenu-categories {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .megamenu-featured {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .megamenu-main-nav {
    flex-direction: column;
  }
  
  .megamenu-categories {
    grid-template-columns: 1fr;
  }
  
  .featured-products-grid {
    grid-template-columns: 1fr;
  }
}

/* Tilføj mobilmenu toggle */
.megamenu-mobile-toggle {
  display: none;
  margin: 1rem;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
}

@media (max-width: 768px) {
  .megamenu-mobile-toggle {
    display: block;
  }
  
  .megamenu-main-nav {
    display: none;
  }
  
  .megamenu-main-nav.active {
    display: flex;
  }
}

/* NYE ÆNDRINGER - Kun vis dropdown ved hover over titlen */

/* Modify hover behavior to happen only on title hover, not entire item */
.megamenu-item-link:hover + .megamenu-dropdown,
.megamenu-dropdown:hover {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  display: block;
}

/* Remove the old hover behavior */
.megamenu-item:hover .megamenu-dropdown {
  opacity: 0;
  visibility: hidden;
  display: none;
}

/* Add specific hover class that will be controlled by JS */
.megamenu-item.title-hover .megamenu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  display: block;
}

/* Make sure dropdown icon rotates when active */
.megamenu-item.title-hover .dropdown-icon {
  transform: rotate(180deg);
}