/* ============================================
   PRODUCTS PAGE - OPTIMIZED
   ============================================ */

/* ====================
   PAGE CONTAINER
   ==================== */
main section.product-fade-in {
  padding: 80px 20px;
  background: #0a0c10;
  position: relative;
  min-height: 100vh;
}

/* Steel Pattern Background */
main section.product-fade-in::before {
  content: "";
  position: absolute;
  inset: 0; /* Shorthand for top/left/right/bottom: 0 */
  background-image:
    linear-gradient(90deg, transparent 98%, rgba(212, 175, 55, 0.03) 100%),
    linear-gradient(0deg, transparent 98%, rgba(212, 175, 55, 0.03) 100%);
  background-size: 50px 50px;
  opacity: 0.2;
  pointer-events: none;
}

/* ====================
   PAGE HEADING
   ==================== */
main section.product-fade-in h1 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  text-align: center;
  margin-bottom: 60px;
  color: transparent;
  background: linear-gradient(90deg, #ffffff 0%, #d4af37 50%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  background-size: 200% auto;
  position: relative;
  padding-bottom: 15px;
}

main section.product-fade-in h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 3px;
  background: linear-gradient(90deg, #d4af37, #ffd700);
  border-radius: 2px;
}

/* ====================
   PRODUCTS GRID
   ==================== */
#products-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;

  /* CSS Grid */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 30px;

  /* Make sure rows are uniform */
  align-items: stretch;
}

/* ====================
   PRODUCT CARD
   ==================== */
.product-card {
  background: rgba(26, 29, 36, 0.7);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.4s ease;
  position: relative;

  /* ✅ OPTIMIZATION: Ensure card has substantial height */
  display: flex;
  flex-direction: column;
  min-height: 320px;

  opacity: 0;
  animation: cardSlideUp 0.6s ease forwards;
}

@keyframes cardSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card:hover {
  transform: translateY(-8px);
  border-color: #d4af37;
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(212, 175, 55, 0.15);
}

/* Gold top border */
.product-card:hover::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4af37, #ffd700);
  z-index: 2;
}

/* ====================
   PRODUCT IMAGE
   ==================== */
.product-image {
  width: 100%;
  height: 100%; /* Fill the card */
  min-height: 320px; /* Ensure image covers the full card height */
  object-fit: cover;
  display: block;
  transition: all 0.5s ease;
  filter: grayscale(20%);
}

.product-card:hover .product-image {
  filter: grayscale(0%);
  transform: scale(1.05);
}

/* Dark Gradient Overlay for text readability */
.product-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(10, 12, 16, 0.9) 90%
  );
  pointer-events: none;
}

/* ====================
   PRODUCT TEXT
   ==================== */
.product-title {
  position: absolute;
  bottom: 50px;
  left: 0;
  right: 0;
  padding: 0 20px;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  z-index: 3;
  opacity: 0.9;
  transition: all 0.3s ease;

  /* Prevent text from running off */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card:hover .product-title {
  opacity: 1;
  transform: translateY(-5px);
}

.product-price {
  position: absolute;
  bottom: 15px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 3;
  padding: 0 20px;
}

.product-price strong {
  color: #d4af37;
  font-size: 1.4rem;
  font-weight: 700;
}

/* ====================
   LOAD MORE
   ==================== */
.load-more-container {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 60px;
  padding: 30px 0;
}

.load-more-btn {
  padding: 14px 40px;
  background: transparent;
  border: 2px solid #d4af37;
  border-radius: 25px;
  color: #d4af37;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-width: 180px;
}

.load-more-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #d4af37, #ffd700);
  transition: left 0.4s ease;
  z-index: -1;
}

.load-more-btn:hover {
  color: #0a0c10;
  border-color: transparent;
}

.load-more-btn:hover::before {
  left: 0;
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ====================
   RESPONSIVE
   ==================== */
@media (max-width: 768px) {
  #products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 0 10px;
  }

  .product-title {
    font-size: 1rem;
    bottom: 40px;
  }

  .product-price strong {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  #products-grid {
    grid-template-columns: 1fr;
    max-width: 350px;
  }
}
