/* css/products.css */
.products-section {
  padding: 80px 0;
  background-color: #f9fafb;
}

.products-section .container {
  max-width: 1200px;
}

.products-section h2 {
  text-align: center;
  margin-bottom: 40px;
}

/* Search and Filters */
.search-filters {
  padding: 40px 0 0 0;
  background-color: var(--white);
}

.search-container {
  margin-bottom: 30px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--light);
  border-radius: 30px;
  padding: 12px 20px;
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
}

.search-box .material-symbols-outlined,
.search-box .fas {
  color: var(--gray);
  margin-right: 10px;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  font-size: 1rem;
  outline: none;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.filters-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.filter-group {
  display: flex;
  align-items: center;
  background: var(--light);
  border-radius: 30px;
  padding: 8px 20px;
  box-shadow: var(--shadow);
}

.filter-group .material-symbols-outlined,
.filter-group .fas {
  color: var(--gray);
  margin-right: 8px;
}

.filter-group select {
  border: none;
  background: transparent;
  padding: 8px;
  font-size: 1rem;
  outline: none;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--dark);
  cursor: pointer;
}

#reset-filters {
  border-radius: 45px;
  padding: 10px 20px;
  font-weight: 600;
}

.products-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.product-card{
  background: var(--white);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  animation: fadeIn 0.5s ease forwards;
  opacity: 0;
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }
.product-card:nth-child(7) { animation-delay: 0.7s; }
.product-card:nth-child(8) { animation-delay: 0.8s; }
.product-card:nth-child(9) { animation-delay: 0.9s; }
.product-card:nth-child(10) { animation-delay: 1.0s; }
.product-card:nth-child(11) { animation-delay: 1.1s; }
.product-card:nth-child(12) { animation-delay: 1.2s; }

.product-card:hover{
  transform: translateY(-10px);
  box-shadow: var(--shadow-hover);
}

.product-media {
  height: 200px;
  overflow: hidden;
  border-radius: 30px 30px 0 0;
}

.product-media img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

.product-media {
  height: 200px;
  overflow: hidden;
  border-radius: 30px 30px 0 0;
  position: relative;
  background-color: #f0f0f0;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
  display: block;
}

/* Fallback cuando la imagen no carga */
.product-media img:not([src*='.']) {
  background-color: #f0f0f0;
  color: transparent;
}

.product-media img:not([src*='.'])::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-size: 14px;
}

.product-card:hover .product-media img{
  transform: scale(1.05);
}

.product-body{
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.product-title{
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
}

.product-price{
  font-weight: 700;
  color: var(--primary);
  font-size: 1.25rem;
  margin: 0;
}

.product-desc{
  font-size: 0.9rem;
  color: var(--gray);
  margin: 0;
  flex-grow: 1;
}

.product-actions{
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 10px;
}

.product-actions .qty{
  width: 70px;
  padding: 10px;
  border-radius: 45px;
  border: 1px solid var(--light-gray);
  background: var(--light);
  font-size: 1rem;
  text-align: center;
}

.btn-add{
  background: var(--primary);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 45px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  flex-grow: 1;
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  white-space: nowrap;
  box-sizing: border-box;
}

.btn-add:hover{
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.center {
  text-align: center;
  margin-top: 40px;
  position: relative;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 14px 32px;
  border-radius: 45px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  transition: all 0.3s ease;
  border: 2px solid var(--primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  white-space: nowrap;
  box-sizing: border-box;
}

.btn-primary:hover {
  background-color: transparent;
  color: var(--light);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.loading-spinner {
  display: none;
}

.all-loaded-message {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dark);
  margin-top: 20px;
  display: none;
}

/* Responsive */
@media (max-width: 344px) {
  .products-section {
    padding: 40px 0;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 20px;
  }
  
  .product-card {
    border-radius: 20px;
  }
  
  .product-media {
    height: 150px;
  }
  
  .product-body {
    padding: 15px;
    gap: 10px;
  }
  
  .product-title {
    font-size: 1.1rem;
  }
  
  .product-price {
    font-size: 1.1rem;
  }
  
  .product-desc {
    font-size: 0.8rem;
  }
  
  .product-actions {
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
  }
  
  .product-actions .qty {
    width: 100%;
    padding: 6px;
    font-size: 0.8rem;
  }
  
  .btn-add {
    padding: 6px 10px;
    min-height: 32px;
    font-size: 0.8rem;
    width: 100%;
  }
  
  .center {
    margin-top: 30px;
  }
  
  .btn-primary {
    padding: 10px 20px;
    min-height: 40px;
    font-size: 0.9rem;
  }
}

@media (max-width:1000px){
  .products-grid{
    grid-template-columns: repeat(2, 1fr);
  }
  
  .filters-container {
    gap: 10px;
  }
  
  .filter-group {
    padding: 6px 15px;
  }
}

@media (max-width:640px){
  .products-grid{
    grid-template-columns: 1fr;
  }
  
  .product-media {
    height: 220px;
  }
  
  .product-actions{
    flex-direction: column;
  }
  
  .product-actions .qty{
    width: 100%;
  }
  
  .btn-add{
    width: 100%;
  }
  
  .filters-container {
    flex-direction: column;
    align-items: center;
  }
  
  .filter-group {
    width: 100%;
    justify-content: center;
  }
  
  #reset-filters {
    width: 100%;
    text-align: center;
  }
  
  /* Mejoras adicionales para adaptaci¨Žn de botones */
  .btn-primary, .btn-outline, .btn-ghost, .btn-add {
    padding-left: 20px;
    padding-right: 20px;
    font-size: 0.9rem;
  }
  
  .product-actions .qty {
    width: 60px;
    padding: 8px;
    font-size: 0.9rem;
  }
  
  .btn-add {
    padding: 8px 12px;
    min-height: 38px;
  }
  
  #load-more-products {
    width: 100%;
    padding: 12px 20px;
  }
}