/* Container principal */
.wc-attribute-button-container {
    margin: 15px 0;
}

/* Grupos de filtros */
.filter-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clear-single-filter {
    font-size: 18px;
    color: #999;
    text-decoration: none;
    padding: 0 5px;
    line-height: 1;
    transition: color 0.2s;
}

.clear-single-filter:hover {
    color: #333;
}

/* Wrapper de botones */
.filter-buttons-wrapper {
    padding: 0;
}

/* Contenedor de botones - Grid layout */
.filter-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

/* Botones de filtro */
.filter-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    text-align: center;
    position: relative;
    user-select: none;
    outline: none;
    min-width: 0;
    white-space: nowrap;
}

.filter-button:hover {
    border-color: #fed700;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.filter-button.active {
    background: #fed700;
    color: black;
    font-weight: bold;
    border-color: #fed700;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(254, 215, 0, 0.3);
}

/* Acciones */
.filter-actions {
    text-align: center;
    margin-top: 20px;
}

.clear-all-filters {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: #999;
    text-decoration: underline;
    transition: color 0.2s;
}

.clear-all-filters:hover {
    color: #666;
}

/* Loading state */
.wc-button-filter-form.loading {
    position: relative;
    opacity: 0.6;
    pointer-events: none;
}

.wc-button-filter-form.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #fed700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Animación de click */
.filter-button {
    position: relative;
    overflow: hidden;
}

.filter-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.filter-button:active::before {
    width: 100px;
    height: 100px;
}

/* Focus state para accesibilidad */
.filter-button:focus {
    outline: 2px solid #fed700;
    outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .filter-button {
        font-size: 12px;
        padding: 6px 12px;
    }

    .filter-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .filter-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .filter-button {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Para pantallas muy pequeñas */
@media (max-width: 360px) {
    .filter-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    .filter-button {
        font-size: 10px;
        padding: 5px 8px;
    }
}

/* Integración con sidebar de WooCommerce */
.widget_wc_attribute_button_filter {
    margin-bottom: 30px;
}

.widget_wc_attribute_button_filter .widget-title {
    margin-bottom: 20px;
}

/* Compatibilidad con temas populares */
.storefront-sidebar .wc-attribute-button-container,
.shop-sidebar .wc-attribute-button-container {
    padding: 0;
}

/* Visual feedback mejorado */
.filter-button {
    transform: translateY(0);
}

.filter-button:active {
    transform: translateY(1px);
}

/* Animación de entrada */
.wc-attribute-button-container {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grupo con filtro activo */
.filter-group.has-active-filter {
    position: relative;
}



/* Ajustes para sidebar estrecho */
.widget-area .filter-buttons,
aside .filter-buttons {
    /*grid-template-columns: repeat(2, 1fr);*/
}

/* Si el sidebar es muy estrecho */
@media (max-width: 300px) {
    .widget-area .filter-buttons,
    aside .filter-buttons {
        grid-template-columns: 1fr;
    }
}


/* para la seleccion de botones multiple*/

/* Indicador de selección múltiple */
.filter-group .selection-count {
    color: #666;
    font-size: 0.9em;
    margin-left: 5px;
    font-weight: normal;
}

/* Estado de múltiples selecciones */
.filter-button.active + .filter-button.active {
    margin-left: -5px;
}

/* Efecto visual para múltiples activos */
.filter-buttons-wrapper:has(.filter-button.active:nth-child(n+2)) .filter-button.active {
    box-shadow: 0 2px 12px rgba(254, 215, 0, 0.4);
}