/**
 * WooCommerce Horizontal Filter - Frontend Styles
 */

.wc-horizontal-filter-wrapper {
    margin-bottom: 30px;
    position: relative;
}

.wc-horizontal-filter {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wc-hf-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.wc-hf-filter-item {
    flex: 0 1 auto;
    min-width: 150px;
}

.wc-hf-filter-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wc-hf-filter-select:hover,
.wc-hf-filter-select:focus {
    border-color: #333;
    outline: none;
}

/* Botones de filtro */
.wc-hf-button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wc-hf-filter-button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.wc-hf-filter-button:hover {
    background: #f0f0f0;
    border-color: #333;
}

.wc-hf-filter-button.active {
    background: #333;
    color: white;
    border-color: #333;
}

.wc-hf-filter-button .count {
    opacity: 0.7;
    font-size: 12px;
}

/* Checkboxes */
.wc-hf-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wc-hf-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
}

.wc-hf-checkbox-label input[type="checkbox"] {
    margin-right: 5px;
}

/* Filtro de precio */
.wc-hf-price-slider {
    min-width: 200px;
}

.wc-hf-price-slider label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
}

.price-slider-wrapper {
    padding: 10px;
    background: white;
    border-radius: 4px;
}

#wc-hf-price-slider {
    margin: 15px 0;
}

.price-slider-amount {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #666;
}

.wc-hf-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-hf-price-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wc-hf-price-apply {
    padding: 6px 12px;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

.wc-hf-price-apply:hover {
    background: #555;
}

/* Filtros activos */
.wc-hf-active-filters {
    margin-bottom: 15px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.wc-hf-active-label {
    font-weight: 600;
    font-size: 14px;
}

.wc-hf-active-filter {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #333;
    color: white;
    border-radius: 20px;
    font-size: 13px;
}

.wc-hf-remove-filter {
    margin-left: 8px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
}

.wc-hf-remove-filter:hover {
    color: #ff4444;
}

/* Botón de reiniciar - Diseño minimalista */
.wc-hf-reset-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 36px;
}

.wc-hf-reset-button:hover {
    background: #e9ecef;
    color: #495057;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.wc-hf-reset-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.wc-hf-reset-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.wc-hf-reset-button:hover .wc-hf-reset-icon {
    transform: scale(1.1);
}

.wc-hf-reset-text {
    font-size: 13px;
    line-height: 1;
}

/* Estilos específicos para cada variante del botón */
.wc-hf-reset-icon_only {
    min-width: 36px;
    padding: 8px;
    justify-content: center;
}

.wc-hf-reset-text_only {
    gap: 0;
}

.wc-hf-reset-icon_text {
    /* Estilo por defecto ya definido arriba */
}

/* Toggle móvil */
.wc-hf-mobile-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.wc-hf-toggle-icon {
    font-size: 20px;
}

.wc-hf-active-count {
    background: #e74c3c;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .wc-hf-filters-container {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    .wc-hf-filters-container::-webkit-scrollbar {
        height: 6px;
    }
    
    .wc-hf-filters-container::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 3px;
    }
    
    .wc-hf-filters-container::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 3px;
    }
    
    .wc-hf-filter-item {
        flex: 0 0 auto;
    }
}

/* Responsive - Móvil */
@media (max-width: 480px) {
    .wc-horizontal-filter {
        padding: 10px;
    }
    
    /* Botón de reset más compacto en móvil */
    .wc-hf-reset-button {
        padding: 6px 8px;
        min-height: 32px;
        gap: 4px;
    }
    
    .wc-hf-reset-icon_only {
        min-width: 32px;
        padding: 6px;
    }
    
    .wc-hf-reset-icon {
        width: 14px;
        height: 14px;
    }
    
    .wc-hf-reset-text {
        font-size: 12px;
    }
    
    .wc-hf-mobile-toggle {
        display: flex;
    }
    
    .wc-hf-filters-container {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        z-index: 9999;
        flex-direction: column;
        padding: 20px;
        overflow-y: auto;
    }
    
    .wc-hf-filters-container.active {
        display: flex;
    }
    
    .wc-hf-filter-item {
        width: 100%;
        min-width: 100%;
    }
    
    .wc-hf-button-group {
        flex-direction: column;
    }
    
    .wc-hf-filter-button {
        width: 100%;
        text-align: left;
        padding: 10px 12px;
    }
    
    .wc-hf-checkbox-group {
        flex-direction: column;
    }
    
    .wc-hf-active-filters {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Agregar botón de cerrar en móvil */
    .wc-hf-filters-container.active::before {
        content: "✕";
        position: absolute;
        top: 10px;
        right: 15px;
        font-size: 24px;
        cursor: pointer;
        z-index: 10;
    }
}

/* Animaciones */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wc-hf-filters-container {
    animation: slideDown 0.3s ease;
}

/* Loading state */
.wc-hf-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.wc-hf-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #333;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Estilos para el modo horizontal scroll en móvil */
.wc-horizontal-filter.horizontal-scroll .wc-hf-filters-container {
    display: flex !important;
    overflow-x: auto;
    position: relative;
    background: #f5f5f5;
    padding: 10px;
}

/* Estilos para el modo colapsar */
.wc-horizontal-filter.collapse-mode .wc-hf-filters-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.wc-horizontal-filter.collapse-mode .wc-hf-filters-container.expanded {
    max-height: 500px;
}

/* Estilos para el selector de ordenamiento dentro del filtro */
.wc-hf-ordering select {
    min-width: 200px;
}

/* Ocultar el ordenamiento predeterminado de WooCommerce cuando esté configurado */
body.wc-hf-hide-default-ordering .woocommerce-ordering {
    display: none !important;
}

/* Ocultar el header de productos de WooCommerce cuando esté configurado */
body.wc-hf-hide-products-header .woocommerce-products-header,
body.wc-hf-hide-products-header .woocommerce-archive-description,
body.wc-hf-hide-products-header .term-description,
body.wc-hf-hide-products-header .page-description {
    display: none !important;
}

/* Ajustar márgenes cuando el header esté oculto */
body.wc-hf-hide-products-header .wc-horizontal-filter-wrapper {
    margin-top: 0;
}

/* Compatibilidad con temas populares */
.storefront .wc-horizontal-filter-wrapper,
.flatsome .wc-horizontal-filter-wrapper,
.astra .wc-horizontal-filter-wrapper {
    margin-top: 20px;
}

/* Print styles */
@media print {
    .wc-horizontal-filter-wrapper {
        display: none;
    }
}