/* =====================================================
   PRODUCTOS.CSS - 100% RESPONSIVE
   ✅ Optimizado para todas las resoluciones
   ✅ Touch-friendly (botones 44px mínimo)
   ✅ Grid adaptativo inteligente
   ===================================================== */

/* =====================================================
   VARIABLES HEREDADAS
   ===================================================== */
:root {
  /* Colores principales */
  --producto-brown: #8B4513;
  --producto-brown-dark: #5d4037;
  --producto-brown-light: #8d6e63;
  --producto-gold: #d4af37;
  --producto-white: #ffffff;
  --producto-gray-bg: #f8f9fa;
  --producto-gray-text: #666;
  --producto-gray-border: #dee2e6;
  
  /* Estados */
  --producto-success: #00b894;
  --producto-warning: #fdcb6e;
  --producto-danger: #d63031;
  --producto-info: #00cec9;
  
  /* Espaciado */
  --producto-spacing-xs: 0.5rem;
  --producto-spacing-sm: 0.75rem;
  --producto-spacing-md: 1rem;
  --producto-spacing-lg: 1.5rem;
  --producto-spacing-xl: 2rem;
  
  /* Transiciones */
  --producto-transition: all 0.3s ease;
  
  /* Sombras */
  --producto-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --producto-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --producto-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --producto-shadow-brown: 0 4px 15px rgba(93, 64, 55, 0.3);
}

/* =====================================================
   SIDEBAR DE FILTROS - ULTRA RESPONSIVE
   ===================================================== */
.filter-sidebar {
  background: white;
  border-radius: 12px;
  padding: clamp(1rem, 2vw, 1.5rem);
  box-shadow: var(--producto-shadow-sm);
  position: sticky;
  top: 120px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar personalizado */
.filter-sidebar::-webkit-scrollbar {
  width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
  background: var(--producto-gray-bg);
  border-radius: 10px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
  background: var(--producto-gold);
  border-radius: 10px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--producto-brown);
}

.filter-header {
  color: var(--producto-brown-dark);
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--producto-gray-bg);
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.filter-group {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--producto-gray-border);
}

.filter-group:last-child {
  border-bottom: none;
  margin-bottom: 1rem;
}

.filter-title {
  font-weight: 600;
  color: var(--producto-brown-dark);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

/* Lista de categorías con scroll */
.category-list {
  max-height: 200px;
  overflow-y: auto;
}

.category-list::-webkit-scrollbar {
  width: 4px;
}

.category-list::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* Form checks responsive */
.form-check {
  margin-bottom: 0.75rem;
}

.form-check-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin-right: 0.5rem;
}

.form-check-label {
  font-size: clamp(0.85rem, 1.5vw, 0.9rem);
  color: var(--producto-gray-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.form-check-input:checked ~ .form-check-label {
  color: var(--producto-brown-dark);
  font-weight: 500;
}

/* Price range inputs */
.price-range input {
  border: 1px solid var(--producto-gray-border);
  transition: var(--producto-transition);
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.price-range input:focus {
  border-color: var(--producto-gold);
  box-shadow: 0 0 0 0.2rem rgba(212, 175, 55, 0.25);
  outline: none;
}

/* =====================================================
   HEADER DE RESULTADOS - RESPONSIVE
   ===================================================== */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: clamp(1rem, 2vw, 1.5rem);
  background: white;
  border-radius: 12px;
  box-shadow: var(--producto-shadow-sm);
  flex-wrap: wrap;
  gap: 1rem;
}

.results-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.results-count {
  font-size: clamp(1rem, 2vw, 1.1rem);
  color: var(--producto-brown-dark);
  font-weight: 600;
}

.search-query {
  color: var(--producto-gray-text);
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
}

.search-query strong {
  color: var(--producto-gold);
}

.results-controls {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Sort options responsive */
.sort-options {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.sort-options label {
  font-size: clamp(0.85rem, 1.5vw, 0.9rem);
  color: var(--producto-gray-text);
  margin: 0;
  white-space: nowrap;
}

.sort-options select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--producto-gray-border);
  border-radius: 6px;
  font-size: clamp(0.85rem, 1.5vw, 0.9rem);
  min-height: 44px;
  cursor: pointer;
}

/* View options - Touch friendly */
.view-options {
  display: flex;
  gap: 0.5rem;
}

.view-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--producto-gray-border);
  background: white;
  cursor: pointer;
  transition: var(--producto-transition);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.view-btn:hover {
  border-color: var(--producto-gold);
  color: var(--producto-gold);
}

.view-btn.active {
  background: var(--producto-gold);
  color: white;
  border-color: var(--producto-gold);
}

/* =====================================================
   GRID DE PRODUCTOS - ULTRA RESPONSIVE
   ===================================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: clamp(1rem, 2vw, 2rem);
  margin-bottom: 3rem;
}

/* Vista lista - Responsive */
.product-grid.list-view {
  grid-template-columns: 1fr;
}

/* =====================================================
   PRODUCT CARD - OPTIMIZADO
   ===================================================== */
.product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  transition: var(--producto-transition);
  box-shadow: var(--producto-shadow-sm);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--producto-shadow-lg);
}

/* Vista Lista - Responsive */
.list-view .product-card {
  flex-direction: row;
  height: auto;
  min-height: 180px;
}

/* =====================================================
   IMAGEN DE PRODUCTO - ASPECT RATIO
   ===================================================== */
.product-image {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--producto-gray-bg);
}

.product-image a {
  display: block;
  width: 100%;
  height: 100%;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--producto-transition);
}

.product-card:hover .product-image img {
  transform: scale(1.1);
}

/* Vista lista - imagen más pequeña */
.list-view .product-image {
  width: 200px;
  aspect-ratio: 1;
  flex-shrink: 0;
}

/* Badges - Responsive */
.product-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2;
}

.badge-oferta,
.badge-nuevo,
.badge-destacado {
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: clamp(0.7rem, 1.5vw, 0.8rem);
  font-weight: 600;
  box-shadow: var(--producto-shadow-sm);
  white-space: nowrap;
}

.badge-oferta {
  background: linear-gradient(135deg, #ff4757, #ee5a6f);
}

.badge-nuevo {
  background: linear-gradient(135deg, #00b894, #00cec9);
}

.badge-destacado {
  background: linear-gradient(135deg, #fdcb6e, #f39c12);
}

/* Acciones Rápidas - Touch Friendly */
.product-actions {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity var(--producto-transition);
  z-index: 2;
}

.product-card:hover .product-actions {
  opacity: 1;
}

.action-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--producto-shadow-md);
  cursor: pointer;
  transition: var(--producto-transition);
  color: var(--producto-gray-text);
}

.action-btn:hover {
  background: var(--producto-gold);
  color: white;
  transform: scale(1.1);
}

.action-btn.active {
  background: var(--producto-gold);
  color: white;
}

/* =====================================================
   INFORMACIÓN DE PRODUCTO - RESPONSIVE
   ===================================================== */
.product-info {
  padding: clamp(1rem, 2vw, 1.5rem);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-category {
  color: var(--producto-gray-text);
  font-size: clamp(0.75rem, 1.5vw, 0.8rem);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.product-name {
  font-weight: 600;
  font-size: clamp(0.95rem, 2vw, 1.05rem);
  color: #2c3e50;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
  line-height: 1.2;
}

.product-name a {
  color: inherit;
  text-decoration: none;
  transition: color var(--producto-transition);
}

.product-name a:hover {
  color: var(--producto-gold);
}

.product-sku {
  font-size: clamp(0.75rem, 1.5vw, 0.8rem);
  color: var(--producto-gray-text);
  margin-bottom: 0.8rem;
}

.product-variante {
  font-size: clamp(0.8rem, 1.5vw, 0.9rem);
  color: #495057;
  margin-bottom: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--producto-gray-bg);
  border-radius: 4px;
  display: inline-block;
  margin-right: 0.5rem;
}

/* Precio - Responsive */
.product-price {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.price-current {
  font-size: clamp(1.2rem, 3vw, 1.4rem);
  font-weight: 700;
  color: var(--producto-gold);
}

.price-original {
  font-size: clamp(0.9rem, 2vw, 1rem);
  color: var(--producto-gray-text);
  text-decoration: line-through;
}

/* Stock indicators */
.product-stock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: clamp(0.8rem, 1.5vw, 0.85rem);
  margin-bottom: 1rem;
}

.stock-available {
  color: var(--producto-success);
  font-weight: 500;
}

.stock-low {
  color: var(--producto-warning);
  font-weight: 500;
}

.stock-out {
  color: var(--producto-danger);
  font-weight: 500;
}

/* =====================================================
   BOTONES DE PRODUCTO - TOUCH FRIENDLY
   ===================================================== */
.product-footer {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  flex-wrap: wrap;
}

.btn-add-cart,
.btn-quote {
  flex: 1;
  border: none;
  padding: 0.75rem;
  cursor: pointer;
  transition: var(--producto-transition);
  font-size: clamp(0.85rem, 1.5vw, 0.9rem);
  border-radius: 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 120px;
}

.btn-add-cart {
  background: linear-gradient(135deg, var(--producto-brown-dark), var(--producto-brown-light));
  color: white;
}

.btn-add-cart:hover {
  transform: translateY(-2px);
  box-shadow: var(--producto-shadow-brown);
}

.btn-add-cart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-quote {
  background: transparent;
  color: var(--producto-gold);
  border: 2px solid var(--producto-gold);
}

.btn-quote:hover {
  background: var(--producto-gold);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

/* =====================================================
   PAGINACIÓN - TOUCH FRIENDLY
   ===================================================== */
.pagination {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.page-link {
  color: var(--producto-brown-dark);
  border: 1px solid var(--producto-gray-border);
  transition: var(--producto-transition);
  padding: 0.5rem 0.75rem;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  text-decoration: none;
}

.page-link:hover {
  color: white;
  background-color: var(--producto-gold);
  border-color: var(--producto-gold);
}

.page-item.active .page-link {
  background-color: var(--producto-gold);
  border-color: var(--producto-gold);
  color: white;
}

/* =====================================================
   MODAL VISTA RÁPIDA
   ==================================================== */
#quickViewModal .modal-content {
  border-radius: 12px;
  border: none;
}

#quickViewModal .modal-header {
  background: linear-gradient(135deg, var(--producto-brown-dark), var(--producto-brown-light));
  color: white;
  border-radius: 12px 12px 0 0;
  border: none;
}

#quickViewModal .modal-body {
  padding: clamp(1rem, 3vw, 2rem);
}

.quickview-content {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.quickview-images {
  flex: 1;
  min-width: 280px;
  max-width: 400px;
}

.quickview-info {
  flex: 1;
  min-width: 280px;
}

/* =====================================================
   RESPONSIVE - MÓVIL EXTRA PEQUEÑO (< 400px)
   ===================================================== */
@media (max-width: 399.98px) {
  .product-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .filter-sidebar {
    position: relative;
    top: auto;
    max-height: none;
    margin-bottom: 1rem;
  }
  
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .results-controls {
    width: 100%;
    flex-direction: column;
    gap: 1rem;
  }
  
  .sort-options {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  
  .sort-options select {
    width: 100%;
  }
  
  .view-options {
    justify-content: center;
    width: 100%;
  }
  
  .product-footer {
    flex-direction: column;
  }
  
  .btn-add-cart,
  .btn-quote {
    width: 100%;
    min-width: auto;
  }
  
  .list-view .product-card {
    flex-direction: column;
  }
  
  .list-view .product-image {
    width: 100%;
    aspect-ratio: 4 / 3;
  }
  
  .product-badges {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* =====================================================
   RESPONSIVE - MÓVIL PEQUEÑO (400px - 575px)
   ===================================================== */
@media (max-width: 575.98px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
    gap: 1rem;
  }
  
  .filter-sidebar {
    position: relative;
    top: auto;
    max-height: none;
  }
  
  .product-image {
    aspect-ratio: 1;
  }
  
  .product-actions {
    opacity: 1;
  }
  
  .action-btn {
    width: 40px;
    height: 40px;
  }
  
  .quickview-content {
    flex-direction: column;
  }
  
  .quickview-images,
  .quickview-info {
    max-width: 100%;
  }
}

/* =====================================================
   RESPONSIVE - TABLET PEQUEÑA (576px - 767px)
   ===================================================== */
@media (max-width: 767.98px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
  }
  
  .list-view .product-card {
    flex-direction: column;
  }
  
  .list-view .product-image {
    width: 100%;
    aspect-ratio: 4 / 3;
  }
  
  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .results-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .sort-options {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  
  .sort-options select {
    width: 100%;
  }
}

/* =====================================================
   RESPONSIVE - TABLET (768px - 991px)
   ===================================================== */
@media (max-width: 991.98px) {
  .filter-sidebar {
    position: relative;
    top: auto;
    max-height: none;
    margin-bottom: 2rem;
  }
}
