/* ==========================================
   VARIABLES Y ESTILOS GLOBALES
   ========================================== */
:root {
  --primary: #10b981;        /* Verde característico de la marca */
  --primary-dark: #059669;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --bg-body: #f9fafb;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
}

/* ==========================================
   LAYOUT PRINCIPAL
   ========================================== */
.catalog-container {
  max-width: 1280px;
  margin: 40px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
}

/* ==========================================
   HEADER DEL CATÁLOGO & BUSCADOR
   ========================================== */
.catalog-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.brand-tag {
  color: var(--primary);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  display: block;
}

.catalog-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

.search-box {
  position: relative;
  width: 320px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
}

/* ==========================================
   MENÚ LATERAL (SIDEBAR)
   ========================================== */
.sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border-color);
  height: fit-content;
}

.sidebar h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-main);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 8px;
}

.category-list {
  list-style: none;
}

/* Estilos de botones de categoría unificados */
.category-list li button {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  padding: 8px 10px;
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 6px;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.category-list li button:hover,
.category-list li button.active {
  background-color: #f0fdf4;
  color: #059669;
  font-weight: 700;
}

/* ==========================================
   CUADRÍCULA DE PRODUCTOS (GRID)
   ========================================== */
.products-grid {
  display: grid;
  /* Al fijar el máximo a 240px evita que las tarjetas se estiren horizontalmente si hay pocos productos */
  grid-template-columns: repeat(auto-fill, minmax(220px, 240px));
  align-content: start;
  gap: 20px;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 20px -8px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.img-wrapper {
  width: 100%;
  height: 180px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ffffff;
  overflow: hidden;
}

.img-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.product-card:hover .img-wrapper img {
  transform: scale(1.06);
}

.product-info {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background-color: #fafafa;
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.product-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.product-card:hover .product-title {
  color: var(--primary-dark);
}

/* ==========================================
   RESPONSIVO
   ========================================== */
@media (max-width: 900px) {
  .catalog-container {
    grid-template-columns: 1fr;
  }
  
  .catalog-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .search-box {
    width: 100%;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}