/* ============================================================
   FERRASOL FILTRO DE PRODUCTOS  — filtro.css
   Estilo: acordeón limpio, categorías jerarquizadas,
   tipografía industrial, sin badges circulares.
   ============================================================ */

/* ── Variables ── */
:root {
    --ff-accent:      #c0392b;   /* rojo Ferrasol */
    --ff-accent-dark: #96281b;
    --ff-text:        #1a1a1a;
    --ff-muted:       #666;
    --ff-border:      #e2e2e2;
    --ff-bg:          #ffffff;
    --ff-hover-bg:    #fafafa;
    --ff-radius:      3px;
    --ff-font:        inherit;
    --ff-track-h:     4px;
    --ff-thumb-size:  16px;
}

/* ── Contenedor ── */
.ff-sidebar {
    font-family: var(--ff-font);
    color: var(--ff-text);
    width: 100%;
    max-width: 280px;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    overflow: hidden;
}

/* ── Header del filtro ── */
.ff-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--ff-accent);
    color: #fff;
}
.ff-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
}
.ff-reset {
    background: none;
    border: 1px solid rgba(255,255,255,0.5);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 2px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: background 0.15s;
    display: none; /* se muestra via JS cuando hay filtros activos */
}
.ff-reset:hover {
    background: rgba(255,255,255,0.2);
}
.ff-reset.ff-visible {
    display: inline-block;
}

/* ── Secciones (acordeón) ── */
.ff-section {
    border-bottom: 1px solid var(--ff-border);
}
.ff-section:last-of-type {
    border-bottom: none;
}
.ff-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.2px;
    cursor: pointer;
    user-select: none;
    background: var(--ff-bg);
    transition: background 0.1s;
}
.ff-section-header:hover {
    background: var(--ff-hover-bg);
}
.ff-arrow {
    font-size: 16px;
    font-weight: 400;
    color: var(--ff-muted);
    line-height: 1;
    transition: transform 0.2s;
}
.ff-section.ff-open .ff-arrow {
    color: var(--ff-accent);
}
.ff-section-body {
    padding: 4px 0 12px;
}

/* ── Slider de precio ── */
.ff-price-range {
    padding: 8px 18px 4px;
}
.ff-price-track {
    position: relative;
    height: var(--ff-track-h);
    background: var(--ff-border);
    border-radius: 99px;
    margin: 20px 0 12px;
}
.ff-price-fill {
    position: absolute;
    height: 100%;
    background: var(--ff-accent);
    border-radius: 99px;
    pointer-events: none;
}

/* Inputs range superpuestos */
.ff-range {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: var(--ff-track-h);
    background: transparent;
    pointer-events: none;
    outline: none;
    margin: 0;
}
.ff-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: var(--ff-thumb-size);
    height: var(--ff-thumb-size);
    background: #fff;
    border: 2px solid var(--ff-accent);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ff-range::-moz-range-thumb {
    width: var(--ff-thumb-size);
    height: var(--ff-thumb-size);
    background: #fff;
    border: 2px solid var(--ff-accent);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: all;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.ff-range::-webkit-slider-thumb:hover,
.ff-range:active::-webkit-slider-thumb {
    border-color: var(--ff-accent-dark);
    box-shadow: 0 0 0 4px rgba(192,57,43,0.12);
}
.ff-price-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: var(--ff-text);
}

/* ── Lista de categorías ── */
.ff-cat-list,
.ff-cat-children {
    list-style: none;
    margin: 0;
    padding: 0;
}
.ff-cat-list {
    padding: 2px 0 6px;
}
.ff-cat-item {
    margin: 0;
}
.ff-cat-row {
    display: flex;
    align-items: center;
    padding: 7px 18px 7px 14px;
    transition: background 0.1s;
    cursor: default;
}
.ff-cat-row:hover {
    background: var(--ff-hover-bg);
}
.ff-cat-toggle {
    width: 18px;
    min-width: 18px;
    text-align: center;
    font-size: 15px;
    font-weight: 300;
    color: var(--ff-accent);
    cursor: pointer;
    line-height: 1;
    margin-right: 4px;
    user-select: none;
}
.ff-cat-spacer {
    width: 22px;
    min-width: 22px;
}
.ff-cat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    font-size: 14px;
}
.ff-cat-name {
    flex: 1;
    line-height: 1.3;
}

/* Subcategorías — indentadas */
.ff-cat-children {
    padding-left: 22px;
    border-left: 2px solid var(--ff-border);
    margin-left: 23px;
    margin-bottom: 4px;
}
.ff-cat-children .ff-cat-row {
    padding-top: 5px;
    padding-bottom: 5px;
}
.ff-cat-children .ff-cat-name {
    font-size: 13px;
    color: var(--ff-muted);
}
.ff-cat-children .ff-cat-row:hover .ff-cat-name {
    color: var(--ff-text);
}

/* ── Atributos ── */
.ff-attr-list {
    list-style: none;
    margin: 0;
    padding: 2px 0 6px;
}
.ff-attr-item {
    padding: 6px 18px;
    transition: background 0.1s;
}
.ff-attr-item:hover {
    background: var(--ff-hover-bg);
}
.ff-check-label {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    font-size: 14px;
}

/* ── Checkbox personalizado ── */
.ff-check-label input[type="checkbox"] {
    display: none;
}
.ff-check-box {
    width: 16px;
    min-width: 16px;
    height: 16px;
    border: 1.5px solid #bbb;
    border-radius: 3px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}
.ff-check-box::after {
    content: '';
    width: 8px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px);
    opacity: 0;
    transition: opacity 0.1s;
}
.ff-check-label input:checked ~ .ff-check-box {
    background: var(--ff-accent);
    border-color: var(--ff-accent);
}
.ff-check-label input:checked ~ .ff-check-box::after {
    opacity: 1;
}
.ff-check-text {
    flex: 1;
    line-height: 1.3;
}

/* ── Contador de productos ── */
.ff-count {
    font-size: 11px;
    color: #999;
    font-weight: 500;
    margin-left: auto;
    padding-left: 4px;
}

/* ── Botón Aplicar (móvil) ── */
.ff-apply-btn {
    display: none;
    width: calc(100% - 36px);
    margin: 10px 18px 14px;
    padding: 11px;
    background: var(--ff-accent);
    color: #fff;
    border: none;
    border-radius: var(--ff-radius);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: background 0.15s;
}
.ff-apply-btn:hover {
    background: var(--ff-accent-dark);
}

/* ── Sin resultados ── */
.ff-no-results {
    padding: 20px;
    color: var(--ff-muted);
    font-size: 14px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ff-sidebar {
        max-width: 100%;
    }
    .ff-apply-btn {
        display: block;
    }
}

/* ── Estado activo: categoría seleccionada ── */
.ff-cat-label input:checked ~ .ff-check-box {
    background: var(--ff-accent);
    border-color: var(--ff-accent);
}
.ff-cat-label input:checked ~ .ff-check-box::after {
    opacity: 1;
}
.ff-cat-label input:checked ~ .ff-cat-name {
    font-weight: 700;
    color: var(--ff-accent);
}

/* ── Auto-submit: loading overlay ── */
.ff-sidebar.ff-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.6);
    z-index: 10;
    border-radius: var(--ff-radius);
}
