/* ===== CATEGORY PAGE STYLES ===== */

/* Hero Section */
.category-hero {
  background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
  position: relative;
  overflow: hidden;
}

.category-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.breadcrumb a {
  transition: color 0.3s ease;
}

.breadcrumb a:hover {
  color: white !important;
}

/* Product Cards */
.product-card {
  transition: all 0.3s ease;
  border-radius: 12px;
  overflow: hidden;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.product-image-container {
  height: 200px;
  position: relative;
  overflow: hidden;
  background: #f8f9fa;
}

.product-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-card:hover .product-image-container img {
  transform: scale(1.05);
}

.placeholder-image {
  height: 100%;
  background: linear-gradient(45deg, #f1f3f4, #e1e5e9);
}

/* Price styling */
.price-container .fs-5 {
  font-weight: 700;
}

/* Category Cards */
.category-card {
  transition: all 0.3s ease;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border-color: #3498db;
}

.category-card .card-body {
  padding: 1rem 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .category-hero {
    padding: 3rem 0 !important;
  }
  
  .category-hero .display-5 {
    font-size: 2rem !important;
  }
  
  .product-image-container {
    height: 160px;
  }
  
  .category-card .card-body {
    padding: 0.75rem 0.25rem;
  }
}

@media (max-width: 576px) {
  .product-image-container {
    height: 140px;
  }
  
  .category-hero .display-5 {
    font-size: 1.5rem !important;
  }
}

/* Filter section */
.bg-light.border-bottom {
  border-color: #dee2e6 !important;
}

/* Sort dropdown */
#sortProducts {
  min-width: 150px;
  border-radius: 6px;
}

/* Stock badges */
.badge {
  border-radius: 20px;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
}

/* Empty state */
.text-center.py-5 {
  padding: 4rem 0 !important;
}

/* Button improvements */
.btn {
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.btn-primary {
  background: #3498db;
  border-color: #3498db;
}

.btn-primary:hover {
  background: #2980b9;
  border-color: #2980b9;
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: #3498db;
  border-color: #3498db;
}

.btn-outline-primary:hover {
  background: #3498db;
  border-color: #3498db;
  transform: translateY(-1px);
}

/* Use the same btn-add-cart styling from front.css */
.btn-add-cart {
  /* Already defined in front.css, this ensures compatibility */
  border-radius: 6px !important;
}

/* Make sure flex-fill works properly */
.flex-fill {
  flex: 1 1 auto;
}

/* Product card actions */
.product-card .d-flex.gap-2 {
  gap: 0.5rem !important;
}

.product-card .btn {
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

.product-card .flex-fill {
  flex: 1 1 auto;
  min-width: 0; /* Prevents overflow */
}

/* Ensure icons in buttons are properly spaced */
.product-card .btn i {
  margin-right: 0.25rem;
}

/* Stock info styling */
.stock-info small {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Loading states */
.add-to-cart:disabled {
  pointer-events: none;
}

.add-to-cart.loading {
  position: relative;
  color: transparent;
}

.add-to-cart.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Dropdown improvements */
.dropdown-menu {
  border: 1px solid #e9ecef;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border-radius: 8px;
}

.dropdown-item {
  padding: 0.5rem 1rem;
  transition: background-color 0.3s ease;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

/* Breadcrumb improvements */
.breadcrumb {
  background: none;
  padding: 0;
  margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: rgba(255,255,255,0.6);
}

/* Grid improvements */
#productsGrid {
  min-height: 300px;
}

/* Animation for grid reordering */
.product-item {
  transition: all 0.3s ease;
}

/* Success/error states */
.btn-success {
  background: #27ae60;
  border-color: #27ae60;
}

.btn-success:hover {
  background: #229954;
  border-color: #229954;
}
