/**
 * Products AJAX Filter Styles
 * 
 * @package HelloElementorChild
 * @since 2.1.0
 */

/* Container */
.um-ajax-products-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
  direction: rtl;
}

/* Categories Navigation */
.um-categories-nav {
  margin-bottom: 2.5rem;
  padding: 1.25rem 0;
  border-bottom: 2px solid rgba(126, 78, 36, 0.1);
}

.um-categories-scroll {
  display: flex;
  justify-content: center; /* توسيط التصنيفات */
  gap: 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #E8A972 #f1f5f9;
  padding: 0.75rem 1rem;
  flex-wrap: wrap; /* السماح بالالتفاف */
}

.um-categories-scroll::-webkit-scrollbar {
  height: 6px;
}

.um-categories-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.um-categories-scroll::-webkit-scrollbar-thumb {
  background: #E8A972;
  border-radius: 3px;
}

.um-categories-scroll::-webkit-scrollbar-thumb:hover {
  background: #7E4E24;
}

/* Category Links */
.um-category-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 50px;
  color: #64748b;
  font-weight: 700;
  font-size: 15px;
  font-family: 'Cairo', 'Tajawal', sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  min-width: fit-content;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.um-category-link:hover {
  background: #ffffff;
  border-color: #E8A972;
  color: #7E4E24;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(126, 78, 36, 0.2);
}

.um-category-link.active {
  background: linear-gradient(135deg, #7E4E24 0%, #E8A972 100%);
  border-color: #7E4E24;
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(126, 78, 36, 0.35);
  transform: translateY(-2px);
}

.um-category-link .count {
  display: inline-block;
  margin-right: 0.5rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}

/* Products Wrapper */
.um-products-wrapper {
  min-height: 400px;
  position: relative;
}

/* Products Grid - 4 columns Desktop, 2 Mobile */
.um-products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columns on desktop */
  gap: 1.5rem;
  direction: rtl;
}

/* Loading State */
.um-products-wrapper.um-loading {
  opacity: 0.6;
  pointer-events: none;
}

.um-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  gap: 1rem;
}

.um-loader .spinner {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 4px solid #f3f4f6;
  border-top-color: #7E4E24;
  border-radius: 50%;
  animation: um-spin 0.8s linear infinite;
}

@keyframes um-spin {
  to { transform: rotate(360deg); }
}

.um-loader p {
  font-size: 16px;
  color: #64748b;
  font-weight: 600;
}

/* No Products Message */
.um-no-products,
.um-error {
  text-align: center;
  padding: 3rem 1rem;
  color: #64748b;
}

.um-no-products p,
.um-error p {
  font-size: 18px;
  margin: 0;
}

.um-error {
  color: #dc2626;
}

/* Responsive */
@media (max-width: 1024px) {
  .um-products-grid {
    grid-template-columns: repeat(3, 1fr); /* 3 columns on tablet */
    gap: 1.25rem;
  }
}

@media (max-width: 768px) {
  .um-ajax-products-container {
    padding: 1.5rem 1rem;
  }
  
  .um-categories-nav {
    margin-bottom: 1.75rem;
    padding: 1rem 0;
  }
  
  .um-categories-scroll {
    gap: 0.65rem;
    padding: 0.65rem 0.75rem 0.75rem;
    justify-content: center;
  }
  
  .um-category-link {
    padding: 0.75rem 1.5rem;
    font-size: 14px;
  }
  
  .um-products-grid {
    grid-template-columns: repeat(2, 1fr); /* 2 columns on mobile */
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .um-ajax-products-container {
    padding: 1.25rem 0.75rem;
  }
  
  .um-categories-scroll {
    gap: 0.5rem;
    padding: 0.5rem;
  }
  
  .um-category-link {
    padding: 0.7rem 1.25rem;
    font-size: 13px;
  }
  
  .um-category-link .count {
    font-size: 11px;
    padding: 0.15rem 0.4rem;
  }
  
  .um-products-grid {
    grid-template-columns: repeat(2, 1fr); /* Keep 2 columns */
    gap: 0.75rem;
  }
}
