/**
 * Xi Category Cascade Frontend Styles
 */

/* Xi Infinite Load - Prevent flash on page refresh for path-based URLs (less aggressive) */
/* IMPORTANT: Only hide main product grid, NOT cascade results */
body.page .xi-custom-product-grid:not(.xi-cascade-results .xi-custom-product-grid) {
  opacity: 0 !important;
  transition: opacity 0.1s;
}

/* Force cascade products to be visible */
.xi-cascade-results .xi-products-container,
.xi-cascade-results .xi-custom-product-grid,
.xi-cascade-results .xi-custom-product-card {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Loading state */
.xi-page-loading {
  display: block !important;
  text-align: center;
  padding: 60px 20px;
}

.xi-page-loading .parts4all-loading-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.xi-page-loading .parts4all-loader {
  width: 40px;
  height: 40px;
  animation: xi-spin 1s linear infinite;
}

.xi-page-loading .parts4all-loading-text {
  color: #666;
  font-size: 16px;
}

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

.xi-category-cascade-container {
  margin: 20px 0;
  font-family: inherit;
}

/* Form Styles */
.xi-cascade-form {
  background: #f8f9fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.xi-cascade-dropdowns {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.xi-cascade-field {
  flex: 1;
  min-width: 200px;
}

.xi-cascade-field label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
}

/* Custom Dropdown Styles */
.xi-cascade-dropdown-wrapper {
  position: relative;
}

.xi-cascade-dropdown-wrapper.xi-disabled {
  pointer-events: none;
  opacity: 0.6;
}

.xi-cascade-selected {
  width: 100%;
  padding: 12px 35px 12px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  height: 48px;
  background-color: #ffffff;
  color: #374151;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.15s ease-in-out;
}

.xi-cascade-selected:hover:not(.xi-disabled) {
  border-color: #9ca3af;
}

.xi-cascade-selected.active {
  border-color: #3b82f6;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.dropdown-arrow {
  font-size: 12px;
  color: #6b7280;
  transition: transform 0.2s ease;
}

.xi-cascade-selected.active .dropdown-arrow {
  transform: rotate(180deg);
}

.xi-cascade-dropdown-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #3b82f6;
  border-top: none;
  border-radius: 0 0 6px 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  display: none;
  max-height: 300px;
  overflow: hidden;
}

.xi-cascade-dropdown-list.open {
  display: block;
}

.xi-cascade-search-wrapper {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.xi-cascade-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  background-color: #ffffff;
  color: #374151;
}

.xi-cascade-search:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.xi-cascade-options {
  max-height: 200px;
  overflow-y: auto;
}

.xi-cascade-option {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
}

.xi-cascade-option:last-child {
  border-bottom: none;
}

.xi-cascade-option:hover {
  background-color: #f8fafc;
}

.xi-cascade-option.selected {
  background-color: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.xi-cascade-option img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid #e5e7eb;
  background: white;
}

.xi-cascade-option .placeholder-image {
  width: 48px;
  height: 48px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  flex-shrink: 0;
}

.xi-cascade-option span {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

/* Level 1 specific styling - image left, text right */
.xi-cascade-dropdown-wrapper[data-level="1"] .xi-cascade-option {
  flex-direction: row;
}

.xi-cascade-dropdown-wrapper[data-level="1"] .xi-cascade-option span {
  text-align: right;
}

/* Level 2 specific styling - image left, text right (default behavior) */
.xi-cascade-dropdown-wrapper[data-level="2"] .xi-cascade-option span {
  text-align: right;
}

/* Level 3 specific styling - no images, so adjust padding */
.xi-cascade-dropdown-wrapper[data-level="3"] .xi-cascade-option {
  padding-left: 16px;
}

.xi-loading-option {
  opacity: 0.6;
  pointer-events: none;
}

.xi-loading-option span {
  color: #9ca3af;
  font-style: italic;
}

.xi-cascade-select-hidden {
  display: none;
}

.xi-cascade-select {
  width: 100%;
  padding: 12px 35px 12px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.5;
  /* Fixed height to prevent size changes during content updates */
  height: 48px !important;
  background-color: #ffffff;
  color: #374151;
  /* TEMPORARILY DISABLED TRANSITION FOR DEBUGGING */
  /* transition: border-color 0.2s ease; */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23374151' viewBox='0 0 16 16'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  /* Ensure consistent box-shadow space to prevent layout shifts */
  box-shadow: 0 0 0 2px transparent;
  box-sizing: border-box !important;
  transform: translateZ(0); /* Force GPU acceleration for all states */
  /* Prevent content changes from affecting size */
  overflow: hidden;
}

.xi-cascade-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.xi-cascade-select:disabled {
  background-color: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
}

/* Field activation highlight - subtle and focused */
:root {
  --xi-cascade-highlight-color: #10b981;
}

.xi-cascade-dropdown-wrapper.next-active .xi-cascade-selected {
  border-color: var(--xi-cascade-highlight-color) !important;
  box-shadow: 0 0 0 2px
    color-mix(in srgb, var(--xi-cascade-highlight-color) 20%, transparent) !important;
  animation: selectActivation 1.2s ease-out;
  box-sizing: border-box !important;
  transform: translateZ(0); /* Force GPU acceleration */
}

@keyframes selectActivation {
  0% {
    border-color: #d1d5db;
    box-shadow: 0 0 0 2px transparent;
    transform: translateZ(0) scale(1);
  }
  50% {
    border-color: var(--xi-cascade-highlight-color);
    box-shadow: 0 0 0 2px
      color-mix(in srgb, var(--xi-cascade-highlight-color) 30%, transparent);
    transform: translateZ(0) scale(1);
  }
  100% {
    border-color: var(--xi-cascade-highlight-color);
    box-shadow: 0 0 0 2px
      color-mix(in srgb, var(--xi-cascade-highlight-color) 20%, transparent);
    transform: translateZ(0) scale(1);
  }
}

/* Reset Button Container */
.xi-cascade-reset-container {
  flex: 0 0 auto;
  min-width: 50px;
  display: none;
  flex-direction: column;
}

.xi-cascade-reset-container label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #374151;
  font-size: 14px;
  /* Let height be natural like other labels */
}

.xi-cascade-reset {
  width: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid #fe6b01;
  border-radius: 6px;
  background: #fe6b01;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xi-cascade-reset:hover {
  background: #d4580a;
  border-color: #d4580a;
  color: #ffffff;
}

.xi-cascade-reset .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  color: #ffffff !important;
  animation: none;
  transition: transform 0.3s ease;
}

.xi-cascade-reset:hover .dashicons {
  transform: rotate(-45deg);
}

/* Loading States */
.xi-cascade-select.xi-loading {
  opacity: 0.6;
  background-image: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  background-size: 200% 100%;
  animation: xi-shimmer 1.5s infinite;
  box-shadow: 0 0 0 2px transparent !important;
  box-sizing: border-box !important;
}

@keyframes xi-shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.xi-cascade-select.xi-loading option[disabled] {
  background: linear-gradient(90deg, #f3f4f6, #e5e7eb, #f3f4f6);
  background-size: 200% 100%;
  animation: xi-shimmer 1.5s infinite;
  color: transparent;
}

/* Results Container */
.xi-cascade-results.active {
  padding: 10px 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

/* Results Header */
.xi-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.xi-results-count {
  font-weight: 600;
  color: #374151;
  font-size: 16px;
}

.xi-results-layout-toggle {
  display: flex;
  gap: 5px;
}

.xi-layout-btn {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #6b7280;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.xi-layout-btn:hover,
.xi-layout-btn.active {
  background: #667eea;
  color: #ffffff;
  border-color: #667eea;
}

/* Products Grid Layout */
.xi-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.xi-products-grid .xi-product-item,
.xi-products-grid .xi-custom-product-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.xi-products-grid .xi-product-item:hover,
.xi-products-grid .xi-custom-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.xi-products-grid .xi-product-image {
  position: relative;
  overflow: hidden;
}

.xi-products-grid .xi-product-image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.xi-products-grid .xi-product-item:hover .xi-product-image img,
.xi-products-grid .xi-custom-product-card:hover .xi-product-image img {
  transform: scale(1.05);
}

.xi-products-grid .xi-product-content {
  padding: 15px;
}

/* Product card inner elements - FORCE VISIBILITY */
.xi-products-grid .xi-product-image,
.xi-products-grid .xi-custom-product-card .xi-product-image,
.xi-custom-product-card .xi-product-image {
  display: block !important;
  width: 100% !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.xi-products-grid .xi-product-image img,
.xi-products-grid .xi-custom-product-card .xi-product-image img,
.xi-custom-product-card .xi-product-image img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  max-width: 100% !important;
}

.xi-products-grid .xi-product-title,
.xi-products-grid .xi-custom-product-card .xi-product-title,
.xi-custom-product-card .xi-product-title {
  margin: 10px 15px !important;
  font-size: 16px !important;
  line-height: 1.3 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  color: #374151 !important;
}

.xi-products-grid .xi-product-title a,
.xi-products-grid .xi-custom-product-card .xi-product-title a,
.xi-custom-product-card .xi-product-title a {
  color: #374151 !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  display: inline !important;
  visibility: visible !important;
}

.xi-products-grid .xi-product-title a:hover,
.xi-products-grid .xi-custom-product-card .xi-product-title a:hover,
.xi-custom-product-card .xi-product-title a:hover {
  color: #667eea !important;
}

.xi-products-grid .xi-product-price,
.xi-products-grid .xi-custom-product-card .xi-product-price,
.xi-custom-product-card .xi-product-price {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #059669 !important;
  margin: 0 15px 15px 15px !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.xi-products-grid .xi-product-price .price {
  border-bottom: 2px solid #dc2626;
  padding-bottom: 2px;
  display: inline-block;
}

/* Products List Layout */
.xi-products-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.xi-products-list .xi-product-item {
  display: flex;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.xi-products-list .xi-product-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.xi-products-list .xi-product-image {
  flex-shrink: 0;
  width: 120px;
}

.xi-products-list .xi-product-image img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.xi-products-list .xi-product-content {
  flex: 1;
  padding: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.xi-products-list .xi-product-title {
  margin: 0 0 8px 0;
  font-size: 18px;
}

.xi-products-list .xi-product-title a {
  color: #374151;
  text-decoration: none;
  font-weight: 600;
}

.xi-products-list .xi-product-title a:hover {
  color: #667eea;
}

.xi-products-list .xi-product-price {
  font-size: 16px;
  font-weight: 700;
  color: #059669;
  margin-bottom: 10px;
}

/* Product Actions */
.xi-product-actions,
.xi-custom-product-card .xi-product-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 15px 15px 15px;
}

.xi-add-to-cart {
  background: #667eea !important;
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.2s ease;
  border: none;
  display: inline-block;
}

.xi-add-to-cart:hover {
  background: #5a67d8 !important;
  color: #ffffff !important;
}

/* No Products */
.xi-no-products {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 16px;
  background: #f8f9fa;
  border-radius: 8px;
}

/* Pagination */
.xi-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 20px 0;
}

.xi-pagination a {
  padding: 8px 12px;
  color: #374151;
  text-decoration: none;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.xi-pagination a:hover,
.xi-pagination a.current {
  background: #667eea;
  color: #ffffff;
  border-color: #667eea;
}

.xi-pagination a.current {
  cursor: default;
}

/* Loading */
.xi-cascade-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: #6b7280;
  font-size: 16px;
}

.xi-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: xi-spin 1s linear infinite;
}

@keyframes xi-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Category select with images */
.xi-cascade-select-with-images option {
  padding: 8px 12px 8px 40px;
  line-height: 1.5;
  min-height: 32px;
}

.xi-cascade-select-with-images option[data-image] {
  background-repeat: no-repeat;
  background-position: 8px center;
  background-size: auto 28px;
}

/* Custom dropdown for images (fallback for browsers that don't support option images) */
.xi-category-select-wrapper {
  position: relative;
}

.xi-category-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
  min-height: 44px;
}

.xi-category-display img {
  width: auto;
  max-height: 28px;
  max-width: 40px;
  object-fit: contain;
  border-radius: 4px;
}

.xi-category-display span {
  flex: 1;
}

/* Breadcrumbs */
.xi-cascade-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  padding: 10px 15px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  color: #6b7280;
  flex-wrap: wrap;
}

.xi-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #d1d5db;
  transition: all 0.2s ease;
  text-decoration: none;
  color: #374151;
}

a.xi-breadcrumb-item:hover {
  background: #f3f4f6;
  border-color: #667eea;
  color: #667eea;
  text-decoration: none;
}

.xi-breadcrumb-item.current {
  background: #667eea;
  color: #ffffff;
  border-color: #667eea;
  pointer-events: none;
}

.xi-breadcrumb-item img {
  width: auto;
  max-height: 24px;
  max-width: 40px;
  object-fit: contain;
  border-radius: 3px;
}

.xi-breadcrumb-separator {
  color: #9ca3af;
  font-weight: 500;
}

/* Custom Select with Images */
.xi-cascade-field.has-images {
  position: relative;
}

.xi-category-select-custom {
  position: relative;
  cursor: pointer;
}

.xi-category-select-custom .xi-select-display {
  width: 100%;
  padding: 12px 35px 12px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  min-height: 48px;
  background-color: #ffffff;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color 0.2s ease;
  position: relative;
}

.xi-category-select-custom .xi-select-display::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23374151' viewBox='0 0 16 16'><path d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
}

.xi-category-select-custom .xi-select-display:hover {
  border-color: #667eea;
}

.xi-category-select-custom .xi-select-display.open {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.xi-category-select-custom .xi-cat-image-container {
  width: 100px;
  height: 25px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
}

.xi-category-select-custom .xi-cat-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.xi-category-select-custom .xi-dropdown-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.xi-category-select-custom .xi-dropdown-options.open {
  display: block;
}

.xi-category-select-custom .xi-dropdown-option {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid #f3f4f6;
}

.xi-category-select-custom .xi-dropdown-option:last-child {
  border-bottom: none;
}

.xi-category-select-custom .xi-dropdown-option:hover {
  background-color: #f8f9fa;
}

.xi-category-select-custom .xi-dropdown-option.selected {
  background-color: #e8f4f8;
}

.xi-category-select-custom .xi-dropdown-option .xi-image-container {
  width: 100px;
  height: 30px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  background: #f8f9fa;
}

.xi-category-select-custom .xi-dropdown-option img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

.xi-category-select-custom .xi-dropdown-option span {
  font-size: 18px;
  font-weight: 500;
  color: #374151;
}

/* Enhanced select field for first level with images */
.xi-cascade-field-enhanced {
  position: relative;
}

.xi-category-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  min-height: 40px;
}

.xi-category-option img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 10px;
}

.xi-category-option .category-name {
  flex: 1;
}

.xi-sidebar-filter {
  padding: 5px !important;
}

.xi-woo-catalog-sidebar {
  margin-top: 20px;
  padding: 5px !important;
}

/* Hide breadcrumbs on mobile if disabled */
@media (max-width: 768px) {
  .xi-cascade-breadcrumb.hide-mobile {
    display: none !important;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .xi-cascade-dropdowns {
    flex-direction: column;
  }

  .xi-cascade-option span {
    font-size: 14px;
  }
  .xi-cascade-field {
    min-width: auto;
  }

  .xi-cascade-actions {
    flex-direction: column;
  }

  .xi-cascade-search,
  .xi-cascade-reset {
    width: 100%;
    justify-content: center;
  }

  .xi-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
  }

  .xi-products-list .xi-product-item {
    flex-direction: column;
  }

  .xi-products-list .xi-product-image {
    width: 100%;
  }

  .xi-products-list .xi-product-image img {
    height: 200px;
  }

  .xi-results-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
}

/* Products Rows Layout (Simple Horizontal Layout) */
.xi-products-rows {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.xi-product-row {
  display: flex !important;
  align-items: center !important;
  gap: 20px !important;
  padding: 15px !important;
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  flex-direction: row !important;
}

.xi-product-row:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
  transform: translateY(-1px);
}

.xi-product-row-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  overflow: hidden;
  border-radius: 6px;
  background: #f9fafb;
}

.xi-product-row-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: all 0.3s ease;
}

.xi-product-row-image:hover img {
  transform: scale(1.05);
}

.xi-product-row-content {
  flex: 1;
  min-width: 0;
  padding-right: 10px;
}

.xi-product-row .xi-product-title {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  color: #1f2937;
}

.xi-product-row .xi-product-title a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.xi-product-row .xi-product-title a:hover {
  color: #667eea;
}

.xi-product-row .xi-product-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

.xi-product-row-price {
  flex-shrink: 0;
  width: 100px;
  text-align: center;
  padding: 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: #059669;
  /* margin-bottom: 15px; */
}

.xi-product-row-price .price {
  border-bottom: 2px solid #dc2626;
  padding-bottom: 2px;
  display: inline-block;
}

.xi-product-row-actions {
  flex-shrink: 0;
  width: 180px;
}

@media (max-width: 768px) {
  .xi-cascade-results.active {
    padding: 5px !important;
  }

  .xi-sidebar-filter {
    padding: 5px !important;
  }

  .xi-woo-catalog-sidebar {
    padding: 5px !important;
  }

  .xi-product-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 12px !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    margin-bottom: 12px !important;
  }

  .xi-product-row-image {
    width: 80px !important;
    height: 80px !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    border-radius: 6px !important;
  }

  .xi-product-row-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .xi-product-row-content {
    flex: 1 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
  }

  .xi-product-row-content h3 {
    font-size: 14px !important;
    line-height: 1.3 !important;
    margin: 0 !important;
    font-weight: 600 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    word-wrap: break-word !important;
  }

  .xi-product-row-content .xi-product-description {
    display: none !important;
  }

  .xi-product-row-price {
    width: auto !important;
    min-width: 50px !important;
    text-align: center !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    font-size: 14px !important;
  }

  .xi-product-row-price .price,
  .xi-product-row-price .woocommerce-Price-amount,
  .xi-product-row-price span.woocommerce-Price-amount.amount {
    font-size: 14px !important;
  }

  .xi-product-row-actions {
    width: auto !important;
    min-width: 90px !important;
    display: flex !important;
    align-items: center !important;
  }

  .xi-product-row-actions .xi-product-actions {
    width: 100% !important;
  }

  .xi-product-row-actions .xi-product-actions .button {
    font-size: 11px !important;
    padding: 8px 12px !important;
    white-space: nowrap !important;
    width: 100% !important;
    text-align: center !important;
  }
}

@media (max-width: 480px) {
  .xi-products-grid {
    grid-template-columns: 1fr;
  }

  .xi-pagination {
    flex-wrap: wrap;
  }

  .xi-product-row {
    gap: 8px !important;
    padding: 5px !important;
  }

  .xi-product-row-image {
    width: 60px !important;
    height: 60px !important;
  }

  .xi-product-row-content h3 {
    font-size: 13px !important;
    -webkit-line-clamp: 2 !important;
  }

  .xi-product-row-content .xi-product-description {
    display: none !important;
  }

  .xi-product-row-price {
    min-width: 45px !important;
    font-size: 12px !important;
  }

  .xi-product-row-price .price,
  .xi-product-row-price .woocommerce-Price-amount,
  .xi-product-row-price span.woocommerce-Price-amount.amount {
    font-size: 12px !important;
  }

  .xi-product-row-actions {
    min-width: 80px !important;
  }

  .xi-product-row-actions .xi-product-actions .button {
    font-size: 10px !important;
    padding: 6px 8px !important;
  }
}
