/**
 * Estilos de Filtros de Productos - Frontend
 */

/* ================================
   CONTENEDOR PRINCIPAL
   ================================ */
.izar-product-filters {
    font-size: 14px;
    line-height: 1.5;
}

.izar-filters-main-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #eee;
}

/* ================================
   GRUPO DE FILTRO
   ================================ */
.izar-filter-group {
    margin-bottom: 20px;
}

.izar-filter-group:last-child {
    margin-bottom: 0;
}

/* Header del Filtro */
.izar-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    user-select: none;
}

.izar-filter-header .izar-filter-title {
    font-weight: 600;
    font-size: 15px;
    color: #1d2327;
    cursor: pointer;
    flex: 1;
}

.izar-filter-header .izar-filter-title:hover {
    color: #2271b1;
}

.izar-filter-toggle {
    width: 24px;
    height: 24px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.izar-filter-toggle:hover {
    background: #f0f0f1;
}

.izar-filter-toggle::before,
.izar-filter-toggle::after {
    content: '';
    position: absolute;
    background: #666;
    transition: transform 0.3s ease;
}

.izar-filter-toggle::before {
    width: 12px;
    height: 2px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.izar-filter-toggle::after {
    width: 2px;
    height: 12px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.izar-filter-header.open .izar-filter-toggle::after {
    transform: translate(-50%, -50%) rotate(90deg);
    opacity: 0;
}

/* Contenido del Filtro */
.izar-filter-content {
    padding: 15px 0;
}

/* ================================
   LISTA DE OPCIONES
   ================================ */
.izar-filter-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.izar-filter-list.hierarchical .izar-filter-children {
    margin-left: 20px;
    padding-top: 5px;
}

.izar-filter-item {
    margin-bottom: 8px;
}

.izar-filter-item:last-child {
    margin-bottom: 0;
}

.izar-filter-item label {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease;
}

.izar-filter-item label:hover {
    color: #2271b1;
}

.izar-filter-item input[type="checkbox"],
.izar-filter-item input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0 10px 0 0;
    cursor: pointer;
    accent-color: #2271b1;
}

.izar-filter-label {
    flex: 1;
}

.izar-filter-count {
    color: #999;
    font-size: 12px;
    margin-left: 5px;
}

/* ================================
   DROPDOWN
   ================================ */
.izar-filter-dropdown {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
}

.izar-filter-dropdown:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* ================================
   COLORES (SWATCHES)
   ================================ */
.izar-filter-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.izar-color-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
}

.izar-color-swatch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.izar-color-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ddd;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.izar-color-swatch:hover .izar-color-circle {
    transform: scale(1.1);
    border-color: #999;
}

.izar-color-swatch input:checked + .izar-color-circle {
    border-color: #2271b1;
    box-shadow: 0 0 0 2px #2271b1;
}

.izar-color-name {
    font-size: 11px;
    margin-top: 5px;
    color: #666;
    text-align: center;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================
   RANGO (PRECIO)
   ================================ */
.izar-filter-range {
    padding: 10px 0;
}

.izar-range-slider {
    height: 6px;
    background: #e5e5e5;
    border-radius: 3px;
    margin-bottom: 15px;
    position: relative;
}

.izar-range-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
}

.izar-range-min,
.izar-range-max {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.izar-range-min:focus,
.izar-range-max:focus {
    outline: none;
    border-color: #2271b1;
}

.izar-range-separator {
    color: #999;
    font-weight: 600;
}

/* ================================
   BOTONES DE ACCIÓN
   ================================ */
.izar-filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.izar-filter-apply,
.izar-filter-reset {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.izar-filter-apply {
    background: #2271b1;
    color: #fff;
}

.izar-filter-apply:hover {
    background: #135e96;
}

.izar-filter-reset {
    background: #f0f0f1;
    color: #50575e;
}

.izar-filter-reset:hover {
    background: #e0e0e0;
}

/* ================================
   ESTADOS DE CARGA
   ================================ */
.izar-products-loading {
    position: relative;
    min-height: 200px;
}

.izar-products-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 10;
}

.izar-products-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: izar-filter-spin 0.8s linear infinite;
    z-index: 11;
}

@keyframes izar-filter-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade animation */
.izar-products-fade {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* Loading en contenedor de filtros (modo URL) */
.izar-product-filters.izar-filters-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.izar-product-filters.izar-filters-loading::after {
    content: '';
    position: absolute;
    top: 20px;
    right: 20px;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: izar-filter-spin 0.8s linear infinite;
}

/* ================================
   FILTROS ACTIVOS (TAGS)
   ================================ */
.izar-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.izar-active-filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    background: #f0f0f1;
    border-radius: 3px;
    font-size: 12px;
}

.izar-active-filter-tag .remove {
    margin-left: 8px;
    cursor: pointer;
    opacity: 0.6;
}

.izar-active-filter-tag .remove:hover {
    opacity: 1;
}

/* ================================
   RESPONSIVE
   ================================ */
@media screen and (max-width: 768px) {
    .izar-filter-actions {
        flex-direction: column;
    }
    
    .izar-filter-colors {
        gap: 8px;
    }
    
    .izar-color-circle {
        width: 25px;
        height: 25px;
    }
}

/* ================================
   NO RESULTADOS
   ================================ */
.izar-no-filters-notice {
    padding: 20px;
    background: #f9f9f9;
    border: 1px dashed #ddd;
    border-radius: 4px;
    text-align: center;
    color: #666;
}

