/* Categories Mega Menu Styles */
.xcodee-categories-megamenu-wrapper {
  position: relative;
  display: inline-block;
  z-index: 1100;
}

/* Trigger Button */
.xcodee-categories-megamenu-wrapper .xcodee-categories-megamenu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--e-global-color-5b522ed);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.xcodee-categories-megamenu-wrapper .xcodee-categories-megamenu-trigger:hover {
  background: var(--e-global-color-5b522ed);
}

.xcodee-categories-megamenu-wrapper .xcodee-categories-megamenu-trigger svg {
  width: 18px;
  height: 18px;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-categories-megamenu-trigger[aria-expanded="true"] {
  background: var(--e-global-color-5b522ed);
}

/* Mega Menu Dropdown */
.xcodee-categories-megamenu-wrapper .xcodee-categories-megamenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 95vw;
  max-width: 100vw;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  margin-top: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transform-origin: top left;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
  z-index: 1000;
  overflow: hidden;
  pointer-events: none;
  will-change: transform, opacity;
}

.xcodee-categories-megamenu-wrapper .xcodee-categories-megamenu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-content {
  display: flex;
  min-height: 400px;
  max-height: 600px;
}

/* Sidebar: single list, children nested under parents */
.xcodee-categories-megamenu-wrapper .xcodee-megamenu-categories {
  width: 26%;
  max-width: 320px;
  min-width: 220px;
  flex-shrink: 0;
  padding: 16px 12px 16px 16px;
  overflow-y: auto;
  border-right: 1px solid #e8eaed;
  background: #fff;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-list {
  list-style: none;
  padding: 0 8px 0 0;
  margin: 0;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item {
  margin: 0;
  padding: 0;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item-parent {
  margin-bottom: 6px;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item:last-child {
  border-bottom: none;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item-parent > .xcodee-category-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: #333;
  transition: background 0.2s ease, color 0.2s ease;
  background: transparent;
  flex-direction: row;
  border-radius: 8px;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-category-item-parent:hover
  > .xcodee-category-link,
.xcodee-categories-megamenu-wrapper
  .xcodee-category-item-parent.active
  > .xcodee-category-link {
  background: var(--e-global-color-bb3517e, #e8f4fc);
  color: #0071bd;
}

/* Subsidiary children: indented block under parent */
.xcodee-categories-megamenu-wrapper .xcodee-subcategory-list {
  list-style: none;
  margin: 4px 0 4px 0;
  padding: 0 5px;
  width: 90%;
  border-left: 2px solid #e8ecf0;
  margin-left: 22px;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item-child {
  margin: 0 0 2px;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item-child .xcodee-subcategory-link {
  display: flex;
  align-items: start;
  padding: 6px 10px 6px 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #5a6570;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-category-item-child
  .xcodee-subcategory-link:hover {
  color: #0071bd;
  background: rgba(0, 113, 189, 0.06);
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item-child .xcodee-category-name {
  font-size: 13px;
  font-weight: 500;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-category-item-child.active
  .xcodee-subcategory-link {
  color: #0071bd;
  background: var(--e-global-color-bb3517e, #e8f4fc);
  font-weight: 600;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-name {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.xcodee-categories-megamenu-wrapper .xcodee-category-item-parent > .xcodee-category-link .xcodee-category-name {
  font-size: 14px;
}

/* Right Sidebar: Products */
.xcodee-categories-megamenu-wrapper .xcodee-megamenu-products {
  flex: 1;
  display: flex;
  min-width: 0;
  padding: 20px;
  overflow-y: auto;
  background: #fff;
  justify-content: center;
  align-items: center;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-products-container {
  position: relative;
  min-height: 300px;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-item {
  background: #f9f9f9;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-link {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 15px;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-megamenu-products-grid
  .xcodee-product-card
  .xcodee-product-image {
  height: 300px;
  background: #fff;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-image {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-title {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  line-height: 1.4;
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-megamenu-product-link:hover
  .xcodee-megamenu-product-title {
  color: #0071bd;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-price {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.xcodee-categories-megamenu-wrapper .xcodee-megamenu-product-rating {
  font-size: 12px;
}

.xcodee-categories-megamenu-wrapper
  .xcodee-megamenu-product-rating
  .star-rating {
  margin: 0;
}

/* Loading State */
.xcodee-categories-megamenu-wrapper .xcodee-megamenu-products-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.xcodee-categories-megamenu-wrapper .xcodee-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #0071bd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .xcodee-categories-megamenu-wrapper .xcodee-categories-megamenu {
    width: 95vw;
  }

  .xcodee-categories-megamenu-wrapper .xcodee-megamenu-products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .xcodee-categories-megamenu-wrapper .xcodee-megamenu-categories {
    width: 34%;
    max-width: 300px;
    min-width: 200px;
  }

  .xcodee-categories-megamenu-wrapper .xcodee-megamenu-products {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 768px) {
  .xcodee-categories-megamenu-wrapper {
    display: none;
  }
}

.xcodee-random-products-wrapper {
  width: 100%;
  margin: 40px 0;
}

.xcodee-products-top-row {
  display: grid;
  grid-template-columns: 1fr 435px;
  gap: 20px;
  margin-bottom: 20px;
}

.xcodee-products-grid {
  display: grid;
  gap: 20px;
}

.xcodee-products-top {
  /* Already set via inline style */
}

.xcodee-products-bottom {
  grid-template-columns: repeat(5, 1fr);
}

.xcodee-product-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
}

.xcodee-product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.xcodee-product-card a {
  text-decoration: none !important;
}

.xcodee-product-link {
  display: block;
  text-decoration: none;
  color: inherit;
  height: 100%;
  position: relative;
}

.xcodee-product-badge {
  position: absolute;
  top: 0;
  left: 0;
  background: #ff4444;
  color: #fff;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  z-index: 2;
  letter-spacing: 0.5px;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
  }
  50% {
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4),
      0 0 20px rgba(255, 68, 68, 0.6), 0 0 30px rgba(255, 68, 68, 0.4);
  }
}

/* Dark overlay on hover */
.xcodee-product-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
  pointer-events: none;
}

.xcodee-product-card:hover .xcodee-product-image::before {
  opacity: 1;
}

.xcodee-product-actions a {
  pointer-events: auto;
  z-index: 10;
}

.xcodee-product-actions .added_to_cart.wc-forward {
  display: none;
}

.xcodee-product-image {
  width: 100%;
  height: 200px;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Action Buttons Overlay */
.xcodee-product-actions {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 10px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 3;
}

.xcodee-product-card:hover .xcodee-product-actions {
  opacity: 1;
}

.xcodee-product-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 0;
}

.xcodee-product-card:hover .xcodee-product-image img {
  transform: scale(1.05);
}

.xcodee-product-info {
  padding: 15px;
}

.xcodee-product-title {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: #333;
  line-height: 1.4;
  min-height: 40px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.xcodee-product-title a {
  text-decoration: none !important;
  color: #333;
}

.xcodee-action-btn {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.xcodee-action-btn:hover {
  background: #0071bd;
  color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  text-decoration: none;
}

.xcodee-action-btn svg {
  width: 20px;
  height: 20px;
}

.xcodee-product-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.xcodee-stars {
  display: flex;
  gap: 2px;
  color: #ffc107;
  font-size: 14px;
  line-height: 1;
}

.xcodee-stars .star {
  display: inline-block;
}

.xcodee-stars .star-full {
  color: #ffc107;
}

.xcodee-stars .star-half {
  color: #ffc107;
  opacity: 0.5;
}

.xcodee-stars .star-empty {
  color: #ddd;
}

.xcodee-rating-value {
  font-size: 12px;
  color: #666;
}

.xcodee-product-price {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.xcodee-product-price del {
  color: #999;
  font-size: 14px;
  margin-right: 8px;
}

.xcodee-product-price ins {
  text-decoration: none;
  color: #ff4444;
}

/* Promotion Banner */
.xcodee-promotion-banner {
  border-radius: 8px;
  padding: 40px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  min-height: 100%;
  background-color: #0071bd;
}

.xcodee-promotion-banner::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 300px;
  height: 300px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  z-index: 0;
}

.xcodee-promotion-banner::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  z-index: 0;
}

.xcodee-promotion-content {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.xcodee-promotion-image {
  position: absolute;
  left: -15%;
  top: 35%;
  transform: translateY(-50%);
  width: 300px;
  height: 300px;
  opacity: 0.3;
  z-index: 0;
}

.xcodee-promotion-text {
  width: 100%;
  display: inline-flex;
  flex-direction: column;
  gap: 20px;
  align-items: flex-end;
}

.xcodee-promotion-text a {
  text-decoration: none !important;
}

.xcodee-promotion-title {
  margin: 0 0 10px 0;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.xcodee-promotion-description {
  margin: 0 0 20px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.5;
}

.xcodee-promotion-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  color: #333;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 1;
}

.xcodee-promotion-button:hover {
  background: var(--e-global-color-5b522ed);
  transform: translateX(-3px);
  text-decoration: none;
  color: #fff;
}

.xcodee-button-arrow {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.xcodee-promotion-button:hover .xcodee-button-arrow {
  transform: translateX(3px);
}

/* Responsive */
@media (max-width: 1024px) {
  .xcodee-products-top-row {
    grid-template-columns: 1fr;
  }

  .xcodee-products-bottom {
    grid-template-columns: repeat(3, 1fr);
  }

  .xcodee-promotion-banner {
    min-height: 300px;
  }
}

@media (max-width: 768px) {
  .xcodee-products-top {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .xcodee-products-bottom {
    grid-template-columns: repeat(2, 1fr);
  }

  .xcodee-promotion-title {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .xcodee-products-top,
  .xcodee-products-bottom {
    grid-template-columns: 1fr !important;
  }

  .xcodee-promotion-title {
    font-size: 20px;
  }

  .xcodee-promotion-description {
    font-size: 12px;
  }
}

/* Loading Spinner */
.xcodee-action-btn.loading {
  pointer-events: none;
  cursor: not-allowed;
}

.xcodee-action-btn .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(51, 51, 51, 0.3);
  border-top-color: #333;
  border-radius: 50%;
  animation: xcodee-spin 0.6s linear infinite;
}

.xcodee-action-btn.loading .spinner {
  width: 16px;
  height: 16px;
}

/* Spinner Animation */
@keyframes xcodee-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Alternative: If you want a more visible spinner */
.xcodee-action-btn.loading .spinner {
  width: 18px;
  height: 18px;
  border-width: 2.5px;
}

/* Ensure spinner is centered in button */
.xcodee-action-btn.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}
