/* ==========================================================================
   Layout Principal: Filtros y Catálogo
   ========================================================================== */
.main-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  padding-block: 2rem;
  scroll-margin-top: 5rem;
}

/* ==========================================================================
   Barra Lateral (Filtros de Categoría)
   ========================================================================== */
.sidebar-filters {
  background-color: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  height: fit-content;
}

.filter-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.category-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-btn {
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  padding: 0.6rem 0.85rem;
  border-radius: var(--border-radius);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover {
  background-color: var(--bg-color);
  color: var(--text-main);
}

.filter-btn.active {
  background-color: rgba(15, 98, 254, 0.1);
  color: var(--primary-color);
  font-weight: 600;
  border-color: rgba(15, 98, 254, 0.2);
}

/* ==========================================================================
   Catálogo y Grilla de Productos
   ========================================================================== */
.catalog-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  background-color: var(--surface-color);
  padding: 1rem 1.25rem;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

.catalog-search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 520px;
}

.catalog-search-box .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  opacity: 0.6;
  pointer-events: none;
}

.catalog-search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.6rem;
  border: 1px solid var(--border-color);
  border-radius: 9999px;
  background-color: var(--bg-color);
  font-size: 0.95rem;
  outline: none;
  transition: all var(--transition-fast);
}

.catalog-search-box input:focus {
  border-color: var(--primary-color);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.15);
}

.results-count {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* Tarjeta de Producto */
.product-card {
  background-color: var(--surface-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  border: 1px solid var(--border-color);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.product-image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 65%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.product-placeholder-img {
  position: absolute;
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background-color: rgba(22, 22, 22, 0.85);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--border-radius-sm);
  text-transform: uppercase;
}

.product-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-sku {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.product-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.product-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.btn-add-cart {
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.5rem 0.85rem;
  border-radius: var(--border-radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.btn-add-cart:hover {
  background-color: var(--primary-hover);
}

/* Estado Vacío (Sin resultados) */
.empty-catalog {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-catalog-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .main-layout {
    grid-template-columns: 1fr;
  }

  .category-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .filter-btn {
    white-space: nowrap;
    width: auto;
  }
}
