/* =========================================================
   LAYOUT ARCHIVO DE TIENDA (FULL WIDTH + FIX GRID)
   ========================================================= */

/* 1. CONTENEDOR PRINCIPAL: OCUPA TODO EL ANCHO */
.samom-shop {
  display: grid;
  grid-template-columns: 280px 1fr; /* Sidebar fija | Contenido flexible */
  gap: 30px;
  
  /* Configuración Full Width */
  width: 100%;
  max-width: 100%; /* Antes limitaba a 1600px, ahora lo liberamos */
  margin: 0;
  padding: 20px 40px; /* Aire a los costados */
  
  box-sizing: border-box; /* CLAVE: Evita que el padding genere scroll horizontal */
}

/* 2. SOLUCIÓN "PRIMERA TARJETA FANTASMA" (CRÍTICO) */
/* WooCommerce inserta elementos invisibles ::before que rompen el Grid. Los eliminamos. */
ul.products::before,
ul.products::after,
.woocommerce ul.products::before,
.woocommerce ul.products::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
}

/* =========================================================
   SIDEBAR DE FILTROS
   ========================================================= */
.shop-filters {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  
  /* Sticky: persigue al usuario al bajar */
  position: sticky;
  top: 100px; 
  height: fit-content;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  
  background: #fff;
  z-index: 10;
}

/* Scrollbar fina para el sidebar */
.shop-filters::-webkit-scrollbar { width: 4px; }
.shop-filters::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* Acordeones */
.shop-filters details {
  border-bottom: 1px solid #eee;
  padding: 12px 0;
}
.shop-filters details:last-child { border-bottom: 0; }

.shop-filters summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
  user-select: none;
}
.shop-filters summary::-webkit-details-marker { display: none; }

.shop-filters summary::after {
  content: "▾";
  font-size: 12px;
  transition: transform 0.2s ease;
}
.shop-filters details[open] summary::after {
  transform: rotate(180deg);
}

/* Listas */
.shop-filters .filter-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-filters .filter-scroll {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}
.filter-scroll::-webkit-scrollbar { width: 3px; }
.filter-scroll::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* Checkboxes */
.shop-filters label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}
.shop-filters label:hover { color: #000; }
.shop-filters input[type="checkbox"] {
  accent-color: #111;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Botones */
.filter-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #eee;
}
.btn-apply, .btn-clear {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-apply { background: #111; color: #fff; }
.btn-apply:hover { opacity: 0.9; }
.btn-clear { background: #f0f0f0; color: #333; border: 1px solid #e0e0e0; }
.btn-clear:hover { background: #e5e5e5; }


/* =========================================================
   RESULTADOS (GRILLA)
   ========================================================= */
.shop-results {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.woocommerce-products-header { margin-bottom: 24px; }
.woocommerce-products-header__title {
  font-size: 24px;
  margin: 0 0 5px 0;
  font-weight: 800;
  text-transform: uppercase;
}
.samom-filter-subtitle { font-size: 14px; color: #666; }

/* Grilla de productos */
.shop-results ul.products {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* Base 3 columnas */
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Mensaje Vacío */
.woocommerce-info {
  background: #f9f9f9;
  border: 1px dashed #ccc;
  padding: 40px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  color: #555;
  border-radius: 8px;
  margin-top: 20px;
}
.woocommerce-info::before {
  content: "🔍";
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
  opacity: 0.5;
}


/* =========================================================
   RESPONSIVO INTELIGENTE
   ========================================================= */

/* Pantallas Gigantes (Full HD+): 4 o 5 columnas */
@media (min-width: 1600px) {
  .shop-results ul.products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 2000px) {
  .shop-results ul.products {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Tablet (Menos de 992px): Columna única, filtros arriba */
@media (max-width: 992px) {
  .samom-shop {
    grid-template-columns: 1fr;
    padding: 20px; /* Menos padding en tablet */
    gap: 30px;
  }

  .shop-filters {
    position: static;
    border: 1px solid #e0e0e0;
  }
}

/* Mobile (Menos de 600px): 2 columnas de productos */
@media (max-width: 600px) {
  .samom-shop {
    padding: 15px; /* Menos padding en móvil */
  }
  
  .shop-results ul.products {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  
  .woocommerce-products-header__title { font-size: 20px; }
}