/* Layout principal */
.shop-layout { display: flex; gap: 30px; align-items: flex-start; }

/* Sidebar */
.shop-sidebar { flex: 0 0 280px; min-width: 280px; position: sticky; top: 20px; align-self: flex-start; }

/* Contenido principal */
.shop-main-content { flex: 1; min-width: 0; }

/* ============================================
   HEADER DE LA TIENDA
   ============================================ */
.shop-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 25px; padding-bottom: 15px; border-bottom: 2px solid #f1f3f5; }
.shop-title { font-size: 28px; font-weight: 700; margin: 0; color: var(--rojo900); }
.shop-toolbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.shop-ordering .woocommerce-ordering { margin: 0; }
.shop-ordering .woocommerce-ordering select { padding: 8px 35px 8px 15px; border: 2px solid #e9ecef; border-radius: 8px; font-size: 14px; background: white; color: #333; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 15px center; }
.shop-ordering .woocommerce-ordering select:focus { border-color: var(--rojo500); outline: none; }
.shop-results-count { font-size: 14px; color: #666; background: #f8f9fa; padding: 8px 15px; border-radius: 8px; white-space: nowrap; }

/* ============================================
   FILTROS SIDEBAR
   ============================================ */
.shop-filters-sidebar-wrapper { background: #f8f9fa; border-radius: 12px; padding: 20px; border: 1px solid #e9ecef; }
.filters-title { font-size: 20px; font-weight: 700; color: var(--rojo900); margin: 0 0 20px 0; padding-bottom: 15px; border-bottom: 2px solid var(--rojo400); display: flex; align-items: center; gap: 10px; }
.filters-icon { font-size: 22px; }

/* Secciones de filtros */
.filter-section { margin-bottom: 25px; padding-bottom: 20px; border-bottom: 1px solid #e9ecef; }
.filter-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.filter-section-title { font-size: 15px; font-weight: 600; color: var(--rojo800); margin: 0 0 12px 0; display: flex; align-items: center; gap: 8px; }
.section-icon { font-size: 16px; }

/* ============================================
   BUSCADOR
   ============================================ */
.filter-search-section .search-input-wrapper { position: relative; }
.filter-search-section .product-search-input { width: 100%; padding: 10px 45px 10px 15px; border: 2px solid #e9ecef; border-radius: 8px; font-size: 14px; transition: all 0.3s ease; background: white; color: #333; }
.filter-search-section .product-search-input:focus { outline: none; border-color: var(--rojo500); box-shadow: 0 0 0 3px rgba(255, 46, 43, 0.2); }
.filter-search-section .search-loader { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); font-size: 18px; animation: spin 1s linear infinite; }

@keyframes spin { from { transform: translateY(-50%) rotate(0deg); } to { transform: translateY(-50%) rotate(360deg); } }

/* Resultados de búsqueda en sidebar */
.search-results-sidebar { margin-top: 10px; background: white; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.1); max-height: 300px; overflow-y: auto; border: 1px solid #e9ecef; }
.search-results-sidebar .search-result-item { display: flex; align-items: center; padding: 10px 15px; border-bottom: 1px solid #f1f3f5; cursor: pointer; transition: background 0.2s ease; text-decoration: none; }
.search-results-sidebar .search-result-item:hover { background: #f8f9fa; }
.search-results-sidebar .result-image { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; margin-right: 12px; }
.search-results-sidebar .result-info { flex: 1; }
.search-results-sidebar .result-title { font-weight: 600; color: #333; font-size: 14px; }
.search-results-sidebar .result-price { color: var(--rojo600); font-weight: 600; font-size: 13px; }
.search-results-sidebar .no-results { padding: 15px; text-align: center; color: #999; font-size: 14px; }

/* ============================================
   CATEGORÍAS EN ÁRBOL
   ============================================ */
.categories-tree { list-style: none; padding: 0; margin: 0; }
.categories-tree .category-item { margin-bottom: 2px; }
.categories-tree .category-link { display: flex; align-items: center; padding: 8px 12px; color: #555; text-decoration: none; border-radius: 6px; transition: all 0.2s ease; gap: 8px; font-size: 14px; }
.categories-tree .category-link:hover { background: #e9ecef; color: var(--rojo600); }
.categories-tree .category-item.active > .category-link { background: var(--rojo-gradient); color: white; }
.categories-tree .category-link .cat-icon { width: 20px; height: 20px; object-fit: cover; border-radius: 4px; }
.categories-tree .category-link .category-name { flex: 1; }
.categories-tree .category-link .category-count { font-size: 12px; color: #999; margin-left: auto; }
.categories-tree .category-item.active .category-count { color: rgba(255,255,255,0.8); }
.categories-tree .category-link .cat-toggle { transition: transform 0.3s ease; font-size: 10px; margin-left: 5px; }
.categories-tree .category-item.open > .category-link .cat-toggle { transform: rotate(90deg); }

/* Subcategorías */
.categories-tree .subcategories-tree { list-style: none; padding: 0; margin: 0 0 0 20px; display: none; }
.categories-tree .category-item.open .subcategories-tree { display: block; }
.categories-tree .subcategory-item .subcategory-link { display: flex; align-items: center; padding: 6px 12px 6px 20px; color: #666; text-decoration: none; border-radius: 6px; transition: all 0.2s ease; font-size: 13px; gap: 8px; }
.categories-tree .subcategory-item .subcategory-link:hover { background: #e9ecef; color: var(--rojo600); }
.categories-tree .subcategory-item.active .subcategory-link { background: var(--rojo-gradient); color: white; }
.categories-tree .subcategory-item .category-count { font-size: 12px; color: #999; margin-left: auto; }
.categories-tree .subcategory-item.active .category-count { color: rgba(255,255,255,0.8); }

/* ============================================
   PRECIO - SLIDER
   ============================================ */
.price-slider-wrapper { padding: 5px 0; }
.price-slider-container { position: relative; padding: 15px 0; }
.price-slider-track { position: relative; height: 4px; background: #e9ecef; border-radius: 2px; }
.price-slider-range { position: absolute; height: 4px; background: var(--rojo-gradient); border-radius: 2px; }
.price-slider-input { -webkit-appearance: none; appearance: none; position: absolute; top: -6px; width: 100%; height: 0; background: transparent; pointer-events: none; margin: 0; }
.price-slider-input::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; background: var(--rojo-gradient); border-radius: 50%; cursor: pointer; pointer-events: auto; border: 2px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.price-slider-input::-moz-range-thumb { width: 16px; height: 16px; background: var(--rojo-gradient); border-radius: 50%; cursor: pointer; pointer-events: auto; border: 2px solid white; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
.price-slider-input:focus { outline: none; }
.price-slider-input:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px rgba(197, 8, 5, 0.3); }
.price-slider-values { display: flex; justify-content: center; align-items: center; gap: 15px; margin: 15px 0; font-size: 16px; font-weight: 600; color: var(--rojo900); }
.price-separator { color: #999; }
.price-filter-btn { width: 100%; padding: 10px 20px; background: var(--rojo-gradient); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: all 0.3s ease; text-transform: uppercase; letter-spacing: 1px; }
.price-filter-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(197, 8, 5, 0.4); }
.price-filter-btn:active { transform: translateY(0); }

/* ============================================
   PRODUCTOS GRID
   ============================================ */
.products-container ul.products { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin: 0; padding: 0; }
.products-container ul.products li.product { margin: 0; padding: 0; width: 100% !important; float: none !important; background: white; border-radius: 8px; overflow: hidden; box-shadow: rgba(50, 50, 93, 0.25) 0px 2px 5px -1px, rgba(0, 0, 0, 0.3) 0px 1px 3px -1px; transition: all 0.3s ease; }
.products-container ul.products li.product:hover { transform: translateY(-5px); box-shadow: 0 5px 25px rgba(0,0,0,0.1); }
.products-container ul.products li.product .button { background: var(--rojo800) !important; border: none !important; transition: all 0.3s ease !important; color: var(--blanco) !important; }
.products-container ul.products li.product .button:hover { transform: scale(1.05) !important; box-shadow: 0 4px 15px rgba(197, 8, 5, 0.4) !important; }
img.woo-entry-image-main { width: 100%; object-fit: cover; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
 .shop-sidebar { flex: 0 0 250px; min-width: 250px; }
  }

@media (max-width: 992px) { 
    .shop-layout { flex-direction: column; } 
    .shop-sidebar { flex: 1; width: 100%; min-width: 0; position: static; } 
    .shop-filters-sidebar-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; } 
    .filters-title { grid-column: 1 / -1; } .filter-section { margin-bottom: 0; padding-bottom: 0; border-bottom: none; } 
    .products-container ul.products { grid-template-columns: repeat(3, 1fr); gap: 20px; } 
}

@media (max-width: 768px) { 
    .shop-header { flex-direction: column; align-items: stretch; gap: 10px; } 
    .shop-toolbar { justify-content: space-between; } 
    .shop-filters-sidebar-wrapper { grid-template-columns: 1fr; } 
    .products-container ul.products { grid-template-columns: repeat(2, 1fr); gap: 25px; } 
    .products-container ul.products li.product img { height: 100px; object-fit: cover; }
 }

@media (max-width: 480px) { 
    .products-container ul.products { grid-template-columns: 1fr 1fr; gap: 20px; } 
    .shop-title { font-size: 22px; } 
    .shop-sidebar .product-search-input { font-size: 14px; } 
}

/* ============================================
   ESTADO DE CARGA
   ============================================ */
.products-container.loading { opacity: 0.6; pointer-events: none; position: relative; min-height: 200px; }
.products-container.loading::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--rojo500); border-radius: 50%; animation: spin 1s linear infinite; z-index: 100; }

/* ============================================
   BOTÓN DE BORRAR EN BUSCADOR
   ============================================ */
.search-clear-btn { position: absolute; right: 45px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #999; font-size: 18px; cursor: pointer; padding: 5px; transition: all 0.3s ease; z-index: 2; }
.search-clear-btn:hover { color: var(--rojo600); transform: translateY(-50%) scale(1.1); }
.search-clear-btn:focus { outline: none; }

/* ============================================
   INDICADOR DE CARGA PARA PRECIO
   ============================================ */
.price-slider-loading { text-align: center; font-size: 13px; color: #999; margin-top: 10px; padding: 5px; background: #f8f9fa; border-radius: 6px; }
.price-slider-loading i { color: var(--rojo600); }

/* ============================================
   AJUSTE DEL BUSCADOR
   ============================================ */
.filter-search-section .search-input-wrapper { position: relative; }
.filter-search-section .product-search-input { width: 100%; padding: 10px 70px 10px 15px; border: 2px solid #e9ecef; border-radius: 8px; font-size: 14px; transition: all 0.3s ease; background: white; color: #333; }
.filter-search-section .product-search-input:focus { outline: none; border-color: var(--rojo500); box-shadow: 0 0 0 3px rgba(255, 46, 43, 0.2); }
.filter-search-section .search-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: 0.5; pointer-events: none; }
.filter-search-section .search-loader { position: absolute; right: 45px; top: 50%; transform: translateY(-50%); font-size: 18px; }

/* ============================================
   BÚSQUEDA EN EL GRID (resultados destacados)
   ============================================ */
.search-highlight { background: rgba(255, 46, 43, 0.15); padding: 0 3px; border-radius: 3px; font-weight: 600; }
.search-results-grid-message { background: var(--rojo-gradient); color: white; padding: 12px 20px; border-radius: 8px; margin-bottom: 20px; display: flex; justify-content: space-between; align-items: center; }
.search-results-grid-message .results-count { font-weight: 600; }
.search-results-grid-message .clear-search-btn { background: rgba(255,255,255,0.2); border: none; color: white; padding: 5px 15px; border-radius: 50px; cursor: pointer; transition: all 0.3s ease; font-size: 14px; }
.search-results-grid-message .clear-search-btn:hover { background: rgba(255,255,255,0.3); }

/* ============================================
   BOTÓN RESTAURAR FILTROS
   ============================================ */
.filters-actions { margin-bottom: 20px; text-align: center; }
.reset-filters-btn { width: 100%; padding: 10px 20px; background: #f8f9fa; color: #666; border: 2px solid #e9ecef; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; transition: all 0.3s ease; display: flex; align-items: center; justify-content: center; gap: 10px; }
.reset-filters-btn:hover:not(:disabled) { background: var(--rojo-gradient); color: white; border-color: var(--rojo500); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(197, 8, 5, 0.3); }
.reset-filters-btn:active:not(:disabled) { transform: translateY(0); }
.reset-filters-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.reset-filters-btn.visible { display: flex !important; animation: fadeInUp 0.3s ease; }

@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.reset-filters-btn i { font-size: 16px; }
.reset-filters-btn .btn-text { flex: 1; }
.filters-changed-indicator { display: none; font-size: 12px; color: var(--rojo600); padding: 5px 10px; background: rgba(255, 46, 43, 0.1); border-radius: 50px; margin-top: 5px; }
.filters-changed-indicator.active { display: inline-block; animation: pulse 1.5s ease infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.reset-filters-btn .filter-badge { background: var(--rojo600); color: white; border-radius: 50%; padding: 2px 8px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; }
.reset-filters-btn:hover .filter-badge { background: white; color: var(--rojo600); }