/**
 * WooCommerce Category Banners Styles
 * 
 * @package Hygge_Child
 */

#primary {
  margin: 0;
}

.site-content {
  padding-top: 32px;
  padding-bottom: 40px;
  background: linear-gradient(180deg, #fff 0%, #f7f4e8 100%);
}

.hygge-category-banners {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}

.hygge-category-banner {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  min-height: 94px;
  text-decoration: none;
  transition: transform 0.3s ease;
  width: calc(33.333% - 16px);
}

.hygge-category-banner:hover {
  text-decoration: none;
}

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

.banner-title {
  font-size: 20px;
  font-weight: 300;
  color: #111;
  line-height: 150%;
  margin: 0 !important;
  line-height: 1.2;
}

.banner-image {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}

.banner-image img {
  width: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
  .hygge-category-banners {
    gap: 13px;
  }
}

@media (max-width: 768px) {
  .hygge-category-banner {
    padding: 16px;
    width: 100%;
    border-radius: 8px;
  }

  .banner-title {
    font-size: 16px;
  }
}

/**
 * WooCommerce Products Header với Ordering
 */
.woocommerce-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 40px;
  width: 100%;
}

.tax-product_cat .woocommerce-products-header {
  margin-bottom: 16px;
}

.woocommerce-products-header__inner {
  flex: 1;
}

.woocommerce-products-header__title {
  margin: 0;
}

.woocommerce-products-header .woocommerce-ordering {
  margin: 0;
  flex-shrink: 0;
  position: relative;
}

.woocommerce-products-header .woocommerce-ordering::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  width: 24px;
  height: 24px;
  background-image: url("../images/SortAscending.svg");
}

.woocommerce-products-header .woocommerce-ordering::before {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 12px;
  width: 16px;
  height: 16px;
  background-image: url("../images/CaretDown.svg");
}

/* Responsive cho header */
@media (max-width: 768px) {
  .woocommerce-products-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .woocommerce-products-header .woocommerce-ordering {
    width: 100%;
  }
}

.hygge-product-category-layout .hygge-product-loop {
  width: calc(100% - 312px);
}

/**
 * Product Categories Sidebar
 */
.hygge-product-category-layout {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.hygge-product-categories-sidebar {
  width: 100%;
  max-width: 288px;
}

.hygge-product-categories-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-direction: column;
}

.hygge-product-categories-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* New badge */
.hygge-badge.hygge-badge--new {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 4px;
  background: #93c943;
  color: #fff;
  font-family: "Plus Jakarta Sans";
  font-size: 12px;
  font-weight: 800;
  line-height: 120%; /* 14.4px */
}

.hygge-product-category-item {
  margin: 0;
  padding: 0;
}

.hygge-product-category-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid var(--Border, #e1dcd4);
  background: var(--White, #fff);
  transition: all 0.2s ease;
  position: relative;
  color: var(--Black, #111);
  font-family: "Source Serif 4";
  font-size: 16px;
  font-weight: 300;
  line-height: 150%; /* 24px */
  padding: 0 12px;
  height: 48px;
}

.hygge-product-category-link:hover,
.hygge-product-category-item.is-active .hygge-product-category-link {
  border-radius: 8px;
  border: 1px solid var(--Newest, #37584c);
  background: var(--BG, #f7f5f3);
  color: var(--Black, #111);
}

.hygge-product-category-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #37584c;
}

.hygge-product-category-icon svg {
  width: 100%;
  height: 100%;
}

.hygge-product-category-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hygge-product-category-text {
  flex: 1;
  font-size: 16px;
  font-weight: 300;
  line-height: 24px;
}

.hygge-product-category-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: #999;
  margin-left: auto;
}

.hygge-product-category-arrow svg {
  width: 100%;
  height: 100%;
}

/* Expand/Collapse Styles */
.hygge-product-category-item.has-children {
  margin-bottom: 0;
}

.hygge-product-category-parent {
  cursor: pointer;
  background: #e8f5e9 !important; /* Light green background */
  border: 1px solid #c8e6c9 !important;
}

.hygge-product-category-parent:hover,
.hygge-product-category-parent.is-expanded {
  background: #c8e6c9 !important; /* Slightly darker green when expanded */
  border-color: #a5d6a7 !important;
}

.hygge-product-category-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-left: auto;
  transition: transform 0.3s ease;
}

.hygge-product-category-parent.is-expanded .hygge-product-category-chevron {
  transform: rotate(180deg);
}

.hygge-product-category-chevron svg {
  width: 100%;
  height: 100%;
}

.hygge-product-category-children {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding-left: 0;
}

.hygge-product-category-children.is-expanded {
  max-height: 1000px;
  padding-top: 8px;
  padding-bottom: 0;
}

.hygge-product-category-child-item {
  margin: 0;
  padding: 0;
  margin-bottom: 0;
}

.hygge-product-category-child-item:not(:last-child) {
  margin-bottom: 0;
  border-bottom: 1px solid #e1dcd4;
}

.hygge-product-category-child-item .hygge-product-category-link {
  background: #ffffff;
  border: none;
  border-radius: 0;
  padding-left: 40px;
  height: 40px;
  font-size: 15px;
}

.hygge-product-category-child-item .hygge-product-category-link:hover,
.hygge-product-category-child-item.is-active .hygge-product-category-link {
  background: #f7f5f3;
  border: none;
}

.hygge-product-category-content {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

#hygge-product-loop {
  position: relative;
}

#hygge-product-loop.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

#hygge-product-loop.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  animation: hyggePulse 1.2s ease-in-out infinite;
}

@keyframes hyggePulse {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    opacity: 0.4;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .hygge-product-category-layout {
    gap: 24px;
  }

  .hygge-product-categories-list {
    flex-direction: column;
    gap: 0;
  }

  .hygge-product-category-layout .hygge-product-loop {
    width: 100%;
  }

  .ast-container .woocommerce ul.products:not(.elementor-grid),
  .woocommerce-page ul.products:not(.elementor-grid),
  .woocommerce.tablet-columns-3 ul.products:not(.elementor-grid) {
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }
}
