body {
  padding-top: 70px; /* adjust depending on navbar height */
}

/* Make the entire filter column sticky */
@media (min-width: 768px) {
  aside.col-md-3 {
    position: sticky;
    top: 80px; /* match navbar height */
    align-self: flex-start; /* ensures proper sticky alignment in Bootstrap grid */
    height: fit-content; /* ensures it doesn't stretch */
  }
}

/* Fade animations for product grid */
.fade-out {
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.fade-in {
  opacity: 1;
  transition: opacity 0.3s ease-in;
}

/* Prevent layout shifts during filter operations */
#productGrid {
  min-height: 200px; /* Ensure minimum height to reduce layout shifts */
}

/* Disabled materials filter styling for both desktop and mobile */
input[name='filterMaterials']:disabled {
  opacity: 0.5 !important;
  cursor: not-allowed !important;
}

input[name='filterMaterials']:disabled + label,
input[name='filterMaterials']:disabled + .form-check-label {
  color: #6c757d !important;
  opacity: 0.6 !important;
  cursor: not-allowed !important;
}

/* Disabled materials count badges - target the flex container structure */
.form-check:has(input[name='filterMaterials']:disabled) .materials-count {
  background-color: #6c757d !important;
  opacity: 0.6 !important;
}

/* Fallback for browsers that don't support :has() - use JavaScript instead */
.materials-count.disabled {
  background-color: #6c757d !important;
  opacity: 0.6 !important;
}

/* Mobile-specific styling to prevent interaction */
#mobileFiltersOffcanvas input[name='filterMaterials']:disabled,
#mobileFiltersOffcanvas input[name='filterMaterials']:disabled + .form-check-label {
  pointer-events: none;
}

/* Add bottom margin to product grid on mobile to account for sticky filter button */
@media (max-width: 767px) {
  #productGrid {
    margin-bottom: 60px; /* Space for the sticky filter button (button height + padding + extra space) */
  }
}

/* ========================
   Modern Category Cards
   ======================== */

.modern-category-card {
  background: #ffffff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  height: 100%;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modern-category-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Image Container */
.card-image-container {
  position: relative;
  height: 280px;
  overflow: hidden;
}

.category-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: all 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
  filter: brightness(1.05) contrast(1.1);
}

.modern-category-card:hover .category-image {
  transform: scale(1.1);
  filter: brightness(1.1) contrast(1.2);
}

/* Image Overlay */
.image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.3) 100%
  );
  opacity: 0;
  transition: opacity 0.4s ease;
}

.modern-category-card:hover .image-overlay {
  opacity: 1;
}

/* Status Badges */
.status-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  z-index: 2;
}

.available-badge {
  background: rgba(34, 197, 94, 0.9);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.coming-soon-badge {
  background: rgba(251, 191, 36, 0.9);
  color: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.modern-category-card:hover .status-badge {
  transform: scale(1.05);
}

/* Coming Soon Overlay */
.coming-soon-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.25) 0%,
    rgba(0, 0, 0, 0.15) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 1;
}

.coming-soon:hover .coming-soon-overlay {
  opacity: 1;
}

.coming-soon-content {
  text-align: center;
  color: white;
  transform: translateY(20px);
  transition: transform 0.4s ease;
}

.coming-soon:hover .coming-soon-content {
  transform: translateY(0);
}

.coming-soon-content h4 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.coming-soon-content p {
  font-size: 1rem;
  opacity: 0.9;
  margin: 0;
}

/* Card Content */
.card-content {
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
  height: calc(100% - 280px);
}

.category-info {
  flex: 1;
  margin-bottom: 25px;
}

.category-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 12px;
  line-height: 1.3;
}

.category-description {
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0;
}

/* Modern Buttons */
.modern-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  width: 100%;
}

.primary-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
  color: white;
  text-decoration: none;
}

.secondary-btn {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
  border: 2px solid rgba(107, 114, 128, 0.2);
}

.secondary-btn:hover:not(:disabled) {
  background: rgba(107, 114, 128, 0.15);
  border-color: rgba(107, 114, 128, 0.3);
  transform: translateY(-2px);
}

.secondary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modern-btn svg {
  transition: transform 0.3s ease;
}

.modern-btn:hover svg {
  transform: translateX(3px);
}

/* Coming Soon Card Styling */
.coming-soon .category-image {
  filter: brightness(1.4) contrast(0.85) saturate(0.8);
  opacity: 0.9;
}

.coming-soon .category-title,
.coming-soon .category-description {
  opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 992px) {
  .card-image-container {
    height: 240px;
  }
  
  .card-content {
    padding: 25px 20px;
    height: calc(100% - 240px);
  }
  
  .category-title {
    font-size: 1.35rem;
  }
}

@media (max-width: 768px) {
  .modern-category-card {
    margin-bottom: 2rem;
    border-radius: 16px;
  }
  
  .card-image-container {
    height: 220px;
  }
  
  .card-content {
    padding: 20px 18px;
    height: calc(100% - 220px);
  }
  
  .category-title {
    font-size: 1.25rem;
  }
  
  .category-description {
    font-size: 0.9rem;
  }
  
  .status-badge {
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    font-size: 0.8rem;
  }
  
  .modern-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .card-image-container {
    height: 200px;
  }
  
  .card-content {
    padding: 18px 16px;
    height: calc(100% - 200px);
  }
  
  .modern-category-card:hover {
    transform: translateY(-6px) scale(1.01);
  }
  
  .coming-soon-content h4 {
    font-size: 1.3rem;
  }
}
