/**
 * CSS OPTIMIZADO PARA WC PRODUCTOS TEMPLATE
 * Estilo inspirado en MercadoLibre - Versión Limpia
 * 
 * NOTA IMPORTANTE: 
 * - Los estilos de FILTROS están en: filtros-sidebar.css
 * - Este archivo maneja: layout, productos, botones, paginación
 * 
 * @package WC_Productos_Template
 * @version 4.0
 */

/* ===== 1. RESET Y CONFIGURACIÓN BASE ===== */
.wc-productos-template * {
    box-sizing: border-box;
}

.wc-productos-template {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
    line-height: 1.4;
}

.wc-productos-template img {
    max-width: 100%;
    height: auto;
}

/* ===== 2. HEADER PRINCIPAL ESTILO MERCADOLIBRE ===== */
.wc-productos-template .productos-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #fff159 0%, #ffee2a 100%);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
    border-bottom: 2px solid #e5e7eb;
}

.wc-productos-template .productos-header h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* ===== 3. BARRA DE BÚSQUEDA ESTILO MERCADOLIBRE ===== */
.wc-productos-template .productos-search {
    max-width: 600px;
    margin: 0 auto 20px auto;
    position: relative;
}

.wc-productos-template .productos-search form,
.wc-productos-template .productos-search-form {
    display: flex;
    width: 100%;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.wc-productos-template .productos-search input[type="text"],
.wc-productos-template #productos-search-input {
    width: 100%;
    padding: 14px 50px 14px 16px;
    border: none;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.wc-productos-template .productos-search input[type="text"]:focus,
.wc-productos-template #productos-search-input:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.wc-productos-template .productos-search button,
.wc-productos-template .productos-search-button {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 50px;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-productos-template .productos-search button:hover,
.wc-productos-template .productos-search-button:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: scale(1.05);
}

/* ===== 4. BOTÓN LIMPIAR FILTROS ===== */
.wc-productos-template .productos-actions {
    margin-top: 15px;
    text-align: center;
}

.wc-productos-template .clear-filters-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.wc-productos-template .clear-filters-btn[data-hidden="true"] {
    display: none;
}

.wc-productos-template .clear-filters-btn:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71e2a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.wc-productos-template .clear-filters-btn i {
    font-size: 12px;
}

/* Estados del botón */
.wc-productos-template .clear-filters-btn.clearing {
    animation: shake 0.5s ease-in-out;
}

.wc-productos-template .clear-filters-btn.has-filters {
    animation: pulse 2s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes pulse {
    0% { box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3); }
    50% { box-shadow: 0 4px 16px rgba(220, 53, 69, 0.5); }
    100% { box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3); }
}

/* ===== 5. LAYOUT PRINCIPAL DE DOS COLUMNAS ===== */
.wc-productos-template .productos-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: flex-start;
}

/* ===== 6. SIDEBAR - SOLO ESTRUCTURA BÁSICA ===== */
/* NOTA: Los estilos detallados están en filtros-sidebar.css */
/* IMPORTANTE: NO incluir estilos de sidebar-toggle aquí para evitar conflictos */
.wc-productos-template .productos-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    border: 1px solid #e5e7eb;
    padding: 0;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999998 !important; /* Z-INDEX ALTO */
    overflow: hidden;
}

.wc-productos-template .productos-sidebar.collapsed {
    width: 60px;
    padding: 15px 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    z-index: 999998 !important; /* Mantener z-index */
}

/* Asegurar que el layout no interfiera con el botón toggle */
.wc-productos-template .productos-layout {
    position: relative;
    z-index: 1;
}

/* El área principal debe tener z-index menor */
.wc-productos-template .productos-main {
    position: relative;
    z-index: 1;
}

/* IMPORTANTE: sidebar-toggle se maneja SOLO en filtros-sidebar.css */

/* ===== 7. ÁREA PRINCIPAL DE PRODUCTOS ===== */
.wc-productos-template .productos-main {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
}

/* Breadcrumbs estilo MercadoLibre */
.wc-productos-template .productos-breadcrumb {
    margin-bottom: 15px;
    padding: 10px 0;
    font-size: 14px;
    color: #6b7280;
}

.wc-productos-template .productos-breadcrumb a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wc-productos-template .productos-breadcrumb a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Información de productos */
.wc-productos-template .productos-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #f3f4f6;
}

.wc-productos-template .resultados-info {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

.wc-productos-template .ordenar-select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.wc-productos-template .ordenar-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ===== 8. GRILLA DE PRODUCTOS ADAPTATIVA ===== */
.wc-productos-template .productos-wrapper {
    width: 100%;
}

/* Grid por defecto (4 columnas cuando sidebar está contraído) */
.wc-productos-template ul.products,
.wc-productos-template .productos-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    width: 100% !important;
    margin: 0 0 30px 0 !important;
    padding: 0 !important;
    list-style: none !important;
    transition: all 0.3s ease;
}

/* Grid cuando sidebar está expandido (3 columnas) */
.wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main ul.products,
.wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main .productos-grid {
    grid-template-columns: repeat(3, 1fr) !important;
}

/* ===== 9. TARJETAS DE PRODUCTO ESTILO MERCADOLIBRE ===== */
.wc-productos-template ul.products li.product,
.wc-productos-template .productos-grid li.product {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    position: relative;
}

.wc-productos-template ul.products li.product:hover,
.wc-productos-template .productos-grid li.product:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-color: #3b82f6;
}

/* Interior de la tarjeta */
.wc-productos-template .producto-interior {
    padding: 15px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Imagen del producto */
.wc-productos-template .producto-imagen,
.wc-productos-template .producto-imagen-link {
    display: block;
    width: 100%;
    margin-bottom: 15px;
    border-radius: 6px;
    overflow: hidden;
}

.wc-productos-template .producto-imagen img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #f8fafc;
    padding: 10px;
    transition: transform 0.3s ease;
}

.wc-productos-template .producto-imagen:hover img {
    transform: scale(1.05);
}

/* Información del producto */
.wc-productos-template .producto-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.wc-productos-template .producto-titulo {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wc-productos-template .producto-titulo a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.wc-productos-template .producto-titulo a:hover {
    color: #3b82f6;
}

/* Precio del producto */
.wc-productos-template .producto-precio {
    margin: 10px 0;
    font-size: 18px;
    font-weight: 700;
    color: #059669;
}

/* Botones del producto */
.wc-productos-template .productos-botones {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
}

.wc-productos-template .productos-boton {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.wc-productos-template .productos-boton.add_to_cart_button {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    flex: 1;
}

.wc-productos-template .productos-boton.add_to_cart_button:hover {
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    transform: translateY(-1px);
}

.wc-productos-template .productos-boton.quick-view {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    width: 40px;
    height: 36px;
    padding: 0;
}

.wc-productos-template .productos-boton.quick-view:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

/* ===== 10. MENSAJE SIN PRODUCTOS ===== */
.wc-productos-template .no-products-found {
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 12px;
    margin: 40px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 2px dashed #d1d5db;
}

.wc-productos-template .no-products-found h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #6b7280;
    font-weight: 600;
}

.wc-productos-template .no-products-found p {
    font-size: 16px;
    color: #9ca3af;
    margin: 0;
}

/* ===== 11. PAGINACIÓN ESTILO MERCADOLIBRE ===== */
.wc-productos-template .productos-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 40px 0;
    gap: 15px;
    padding: 30px 0;
    border-top: 2px solid #e5e7eb;
}

.wc-productos-template .pagination-info {
    font-size: 14px;
    color: #6b7280;
}

.wc-productos-template .pagination-info strong {
    color: #374151;
    font-weight: 600;
}

.wc-productos-template .pagination-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.wc-productos-template .page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.wc-productos-template .page-number:hover:not(.active) {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.wc-productos-template .page-number.active {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: #3b82f6;
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
    cursor: default;
    font-weight: 700;
}

.wc-productos-template .page-dots {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 4px;
    user-select: none;
}

/* ===== 12. FILTROS EN EL SIDEBAR ===== */
.wc-productos-template .filtro-grupo {
    margin-bottom: 25px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    border: 1px solid #e2e8f0;
}

.wc-productos-template .filtro-grupo h3 {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: #374151;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.wc-productos-template .filtro-grupo h3:hover {
    color: #3b82f6;
}

.wc-productos-template .filtro-grupo h3 i {
    color: #6b7280;
}

.wc-productos-template .filtro-lista {
    max-height: 300px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.wc-productos-template .filtro-opcion {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 2px 0;
}

.wc-productos-template .filtro-opcion:hover {
    background: #e5e7eb;
}

.wc-productos-template .filtro-opcion input[type="checkbox"],
.wc-productos-template .filtro-opcion input[type="radio"] {
    margin: 0;
    accent-color: #3b82f6;
}

.wc-productos-template .filtro-opcion label {
    flex: 1;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    margin: 0;
}

.wc-productos-template .product-count {
    font-size: 12px;
    color: #6b7280;
    background: #e5e7eb;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

/* ===== 13. ESTADOS DE CARGA ===== */
.wc-productos-template .loading {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

.wc-productos-template .loading i {
    font-size: 24px;
    margin-bottom: 15px;
    display: block;
    animation: spin 1s linear infinite;
    color: #3b82f6;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 14. RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .wc-productos-template ul.products,
    .wc-productos-template .productos-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main ul.products,
    .wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main .productos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .wc-productos-template {
        padding: 15px;
    }
    
    .wc-productos-template .productos-header {
        padding: 20px 15px;
    }
    
    .wc-productos-template .productos-header h1 {
        font-size: 2em;
    }
    
    .wc-productos-template .productos-search {
        max-width: 100%;
    }
    
    .wc-productos-template .productos-layout {
        flex-direction: column;
        gap: 15px;
    }
    
    .wc-productos-template .productos-sidebar {
        width: 100%;
        order: 2;
    }
    
    .wc-productos-template .productos-sidebar.collapsed {
        width: 100%;
        height: 60px;
        flex: none;
    }
    
    .wc-productos-template .productos-main {
        order: 1;
    }
    
    .wc-productos-template ul.products,
    .wc-productos-template .productos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }
    
    .wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main ul.products,
    .wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main .productos-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .wc-productos-template .clear-filters-btn {
        width: 100%;
        justify-content: center;
    }
    
    .wc-productos-template .productos-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .wc-productos-template .pagination-links {
        gap: 4px;
    }
    
    .wc-productos-template .page-number {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .wc-productos-template ul.products,
    .wc-productos-template .productos-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    
    .wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main ul.products,
    .wc-productos-template .productos-sidebar:not(.collapsed) ~ .productos-main .productos-grid {
        grid-template-columns: 1fr !important;
    }
    
    .wc-productos-template .productos-header h1 {
        font-size: 1.8em;
    }
    
    .wc-productos-template .producto-imagen img {
        height: 180px;
    }
}

/* ===== 15. UTILIDADES Y HELPERS ===== */
.wc-productos-template .ml-hidden {
    display: none !important;
}

.wc-productos-template .ml-visible {
    display: block !important;
}

.wc-productos-template .ml-flex {
    display: flex !important;
}

.wc-productos-template .ml-grid {
    display: grid !important;
}

/* ===== 16. MEJORAS PARA ACCESIBILIDAD ===== */
.wc-productos-template button:focus,
.wc-productos-template input:focus,
.wc-productos-template select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.wc-productos-template .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== 17. OPTIMIZACIONES DE RENDIMIENTO ===== */
.wc-productos-template .productos-sidebar,
.wc-productos-template .productos-main,
.wc-productos-template .productos-layout {
    will-change: transform;
}

.wc-productos-template * {
    transform: translateZ(0);
}

/* ===== 18. OVERRIDES PARA COMPATIBILIDAD CON TEMAS ===== */
.wc-productos-template ul.products li.product .button,
.wc-productos-template ul.products li.product .wc-block-grid__product-add-to-cart.wp-block-button .wp-block-button__link {
    width: auto !important;
    margin-bottom: 0 !important;
    flex: 1 !important;
}

/* Forzar grid cuando sea necesario */
html body .wc-productos-template ul.products,
html body .wc-productos-template .productos-grid {
    display: grid !important;
}

/* ===== 19. BADGES DE PRODUCTOS (STOCK Y PELIGRO) ===== */
.wc-productos-template .producto-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: none;
}

.wc-productos-template .producto-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    line-height: 1;
}

/* Badge de stock disponible */
.wc-productos-template .badge-stock {
    background: #00a650;
    color: white;
}

/* Badge de stock agotado */
.wc-productos-template .badge-out-stock {
    background: #f23c4c;
    color: white;
}

/* Badge de producto peligroso */
.wc-productos-template .badge-danger {
    background: #ff6900;
    color: white;
    animation: pulse 2s infinite;
}

/* Badge de producto seguro */
.wc-productos-template .badge-safe {
    background: #28a745;
    color: white;
}

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

/* ===== 20. PICTOGRAMAS DE PELIGRO GHS ===== */
.wc-productos-template .producto-pictogramas {
    margin-bottom: 8px;
    font-size: 10px;
}

.wc-productos-template .hazard-pictograms-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 3px !important;
    margin-top: 4px;
}

.wc-productos-template .hazard-pictogram {
    display: flex !important;
    align-items: center !important;
    background-color: #ffffff !important;
    border: 1px solid #dc3545 !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    font-size: 9px !important;
    transition: all 0.2s ease !important;
    line-height: 1 !important;
    cursor: help;
}

.wc-productos-template .hazard-pictogram:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3) !important;
}

.wc-productos-template .pictogram-symbol {
    font-size: 10px !important;
    margin-right: 2px !important;
    line-height: 1 !important;
}

.wc-productos-template .pictogram-name {
    font-size: 8px !important;
    color: #dc3545 !important;
    font-weight: 500 !important;
    line-height: 1 !important;
}

/* Pictogramas específicos GHS */
.wc-productos-template .pictogram-ghs01 { border-color: #ff6b35; } /* Explosivo */
.wc-productos-template .pictogram-ghs02 { border-color: #ff4444; } /* Inflamable */
.wc-productos-template .pictogram-ghs03 { border-color: #ff9500; } /* Comburente */
.wc-productos-template .pictogram-ghs04 { border-color: #0066cc; } /* Gas presión */
.wc-productos-template .pictogram-ghs05 { border-color: #cc0000; } /* Corrosivo */
.wc-productos-template .pictogram-ghs06 { border-color: #000000; } /* Tóxico */
.wc-productos-template .pictogram-ghs07 { border-color: #ff8800; } /* Nocivo */
.wc-productos-template .pictogram-ghs08 { border-color: #cc0099; } /* Peligro salud */
.wc-productos-template .pictogram-ghs09 { border-color: #009900; } /* Ambiental */

/* ===== 21. SISTEMA DE BOTONES MEJORADO ===== */
/* Botón base para todos los estados - ANCHO COMPLETO */
.wc-productos-template .producto-boton,
.wc-productos-template .productos-boton,
.wc-productos-template .add_to_cart_button,
.wc-productos-template .ajax_add_to_cart,
.wc-productos-template .view_cart_button,
.wc-productos-template .button {
    padding: 10px 16px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    width: 100% !important;
    min-height: 40px !important;
    line-height: 1 !important;
    border: 1px solid transparent !important;
    box-sizing: border-box !important;
}

/* OCULTAR BOTONES ADICIONALES DE WOOCOMMERCE */
/* Estos aparecen automáticamente después de añadir al carrito */
.wc-productos-template .added_to_cart,
.wc-productos-template .wc-forward,
.wc-productos-template .added_to_cart.wc-forward,
.wc-productos-template .woocommerce-message .button,
.wc-productos-template .woocommerce-message a.button,
.wc-productos-template .woocommerce-message .wc-forward {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Contenedor de botones - asegurar que solo haya uno visible */
.wc-productos-template .producto-accion {
    display: flex !important;
    width: 100% !important;
    position: relative !important;
}

.wc-productos-template .producto-accion > * {
    width: 100% !important;
    flex: 1 !important;
}

/* Botón "AÑADIR AL CARRITO" - AZUL */
.wc-productos-template .add_to_cart_button,
.wc-productos-template .ajax_add_to_cart,
.wc-productos-template .producto-boton.add_to_cart_button,
.wc-productos-template .producto-boton.ajax_add_to_cart {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%) !important;
    border-color: #3b82f6 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25) !important;
}

/* Botón "VER CARRITO" - VERDE */
.wc-productos-template .view_cart_button,
.wc-productos-template .producto-boton.view_cart_button {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    border-color: #28a745 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25) !important;
}

/* Estados hover */
.wc-productos-template .add_to_cart_button:hover,
.wc-productos-template .ajax_add_to_cart:hover,
.wc-productos-template .producto-boton.add_to_cart_button:hover,
.wc-productos-template .producto-boton.ajax_add_to_cart:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%) !important;
    border-color: #1d4ed8 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35) !important;
}

.wc-productos-template .view_cart_button:hover,
.wc-productos-template .producto-boton.view_cart_button:hover {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%) !important;
    border-color: #218838 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.35) !important;
}

/* Estado loading */
.wc-productos-template .producto-boton.loading,
.wc-productos-template .productos-boton.loading {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.wc-productos-template .producto-boton.loading i {
    animation: spin 1s linear infinite;
}

/* ===== 22. ESTADOS DE PRODUCTO ===== */
.wc-productos-template li.product.instock {
    opacity: 1;
    border-color: #e5e7eb;
}

.wc-productos-template li.product.outofstock {
    opacity: 0.75;
    position: relative;
}

.wc-productos-template li.product.outofstock::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    z-index: 2;
    border-radius: 8px;
}

.wc-productos-template li.product.product-added-to-cart {
    animation: productAdded 2s ease;
    border-color: #28a745;
}

@keyframes productAdded {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ===== 23. VISTA RÁPIDA EN IMAGEN ===== */
.wc-productos-template .producto-imagen {
    position: relative;
    overflow: hidden;
}

.wc-productos-template .producto-vista-rapida {
    position: absolute;
    bottom: -40px;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    text-align: center;
    padding: 8px 0;
    font-size: 12px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.wc-productos-template .producto-imagen:hover .producto-vista-rapida {
    bottom: 0;
}

.wc-productos-template .producto-vista-rapida:hover {
    background-color: rgba(59, 130, 246, 0.9);
}

/* ===== 24. INFORMACIÓN ADICIONAL ===== */
.wc-productos-template .storage-info {
    font-style: italic;
    font-size: 10px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.2;
}

.wc-productos-template .producto-referencia-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    font-size: 11px;
}

.wc-productos-template .producto-sku,
.wc-productos-template .producto-cas,
.wc-productos-template .producto-pureza {
    font-size: 10px;
    color: #6b7280;
    font-weight: 500;
}

.wc-productos-template .producto-sku strong,
.wc-productos-template .producto-cas strong,
.wc-productos-template .producto-pureza strong {
    color: #374151;
    font-weight: 600;
}

/* ===== 25. ESTADOS HOVER Y FOCUS MEJORADOS ===== */
/* NOTA: Los filtros tienen sus propios estilos en filtros-sidebar.css */
.wc-productos-template .producto-boton:focus,
.wc-productos-template .productos-boton:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

/* ===== 26. ANIMACIONES SUAVES ===== */
.wc-productos-template * {
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.wc-productos-template .producto-imagen img,
.wc-productos-template .producto-boton,
.wc-productos-template .productos-boton,
.wc-productos-template .page-number {
    transition-duration: 0.2s;
}

.wc-productos-template .productos-sidebar,
.wc-productos-template .clear-filters-btn {
    transition-duration: 0.3s;
}

/* ===== 27. OVERRIDES DE COMPATIBILIDAD FINAL ===== */
/* Forzar estilos correctos independientemente del tema */
html body .wc-productos-template .add_to_cart_button,
html body .wc-productos-template .ajax_add_to_cart {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
    width: 100% !important;
    display: flex !important;
}

html body .wc-productos-template .view_cart_button {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
    width: 100% !important;
    display: flex !important;
}

/* Asegurar que el JavaScript pueda transformar correctamente */
.wc-productos-template .button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.wc-productos-template .wc-cart-message {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.wc-productos-template .wc-cart-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
}

.wc-productos-template .wc-cart-message.error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #f87171;
}

/* ===== 28. ELIMINACIÓN COMPLETA DE ELEMENTOS DUPLICADOS ===== */
/* Ocultar TODOS los elementos que WooCommerce añade automáticamente */
.wc-productos-template .woocommerce-message,
.wc-productos-template .woocommerce-info,
.wc-productos-template .woocommerce-error,
.wc-productos-template .woocommerce-noreviews,
.wc-productos-template div.woocommerce-message,
.wc-productos-template div.woocommerce-info,
.wc-productos-template div.woocommerce-error {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* Ocultar específicamente enlaces "Ver carrito" automáticos */
.wc-productos-template a.added_to_cart,
.wc-productos-template .added_to_cart.wc-forward,
.wc-productos-template .button.wc-forward,
.wc-productos-template .wc-forward:not(.view_cart_button),
.wc-productos-template .woocommerce-message a:not(.view_cart_button) {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Asegurar que nuestros botones transformados sean los únicos visibles */
.wc-productos-template .view_cart_button {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    left: auto !important;
    height: auto !important;
    width: 100% !important;
}

/* Forzar ancho completo en todos los botones del sistema */
.wc-productos-template .producto-accion .button,
.wc-productos-template .producto-accion .add_to_cart_button,
.wc-productos-template .producto-accion .ajax_add_to_cart,
.wc-productos-template .producto-accion .view_cart_button,
.wc-productos-template .producto-accion .producto-boton {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 !important;
    box-sizing: border-box !important;
}
