/* O404 Filtro de productos — v0.4.0. Colores de Lupa: rojo #a41515, Quicksand. */
:root {
    --o404f-accent: #a41515;
    --o404f-accent-dark: #8B1919;
    --o404f-accent-soft: #F9ECEC;
    --o404f-text: #1f2328;
    --o404f-muted: #6B7280;
    --o404f-line: #ECE6E6;
    --o404f-track: #E9DFDF;
    --o404f-font: 'Quicksand', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --o404f-side: 280px;
}

/* =========================================================
 * BLOQUE 1: layout (escritorio = columna fija a la izquierda)
 * ========================================================= */
.o404f-layout { display: flex; align-items: flex-start; gap: 32px; width: 100%; }
.o404f-layout > #o404f-drawer { flex: 0 0 var(--o404f-side); width: var(--o404f-side); min-width: 0; }
.o404f-layout > .o404f-main { flex: 1 1 auto; min-width: 0; }
.o404f-main.o404f-loading { opacity: .4; pointer-events: none; transition: opacity .16s ease; }

/* =========================================================
 * BLOQUE 2: barra sobre la rejilla (botón solo en móvil, chips siempre)
 * ========================================================= */
#o404f-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; width: 100%; margin: 0 0 14px; font-family: var(--o404f-font); }
#o404f-bar:empty { display: none; }
#o404f-bar .o404f-open {
    display: none; align-items: center; gap: 8px;
    border: 0; border-radius: 10px; background: var(--o404f-accent); color: #fff;
    padding: 10px 16px; font: 700 14px/1 var(--o404f-font); cursor: pointer;
}
#o404f-bar .o404f-open:hover, #o404f-bar .o404f-open:focus { background: var(--o404f-accent-dark); color: #fff; }
.o404f-ico { width: 18px; height: 18px; flex: 0 0 18px; display: block; }
.o404f-open-badge { min-width: 20px; height: 20px; border-radius: 999px; background: #fff; color: var(--o404f-accent); font-size: 11px; line-height: 20px; text-align: center; padding: 0 6px; }
#o404f-bar .o404f-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#o404f-bar .o404f-chip {
    display: inline-flex; align-items: center; gap: 6px; border-radius: 999px;
    background: var(--o404f-accent-soft); color: var(--o404f-accent);
    padding: 6px 11px; font-size: 12px; font-weight: 600; text-decoration: none; line-height: 1.2;
}
#o404f-bar .o404f-chip:hover { background: #F2D9D9; color: var(--o404f-accent); }
.o404f-clear { color: var(--o404f-accent); font-size: 12px; font-weight: 700; text-decoration: underline; padding: 6px 4px; }

/* =========================================================
 * BLOQUE 3: panel (escritorio)
 * ========================================================= */
#o404f-panel { font-family: var(--o404f-font); color: var(--o404f-text); }
#o404f-panel * { box-sizing: border-box; }
#o404f-drawer .o404f-overlay,
#o404f-panel .o404f-head,
#o404f-panel .o404f-foot { display: none; }
#o404f-panel .o404f-scroll { display: flex; flex-direction: column; gap: 12px; padding: 0; margin: 0; }
#o404f-panel.o404f-loading .o404f-scroll { opacity: .5; pointer-events: none; }

/* =========================================================
 * BLOQUE 4: secciones
 * ========================================================= */
#o404f-panel .o404f-section { flex: 0 0 auto; margin: 0; background: #fff; border: 1px solid var(--o404f-line); border-radius: 14px; overflow: hidden; }
#o404f-panel .o404f-section summary {
    list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin: 0;
    padding: 15px 16px; color: var(--o404f-accent); text-transform: uppercase; letter-spacing: .05em; font-size: 12px; font-weight: 700; line-height: 1.2;
}
#o404f-panel .o404f-section summary::-webkit-details-marker { display: none; }
#o404f-panel .o404f-badge { margin-left: auto; background: var(--o404f-accent); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 10px; letter-spacing: 0; text-transform: none; white-space: nowrap; }
#o404f-panel .o404f-chevron { position: relative; width: 18px; height: 18px; flex: 0 0 18px; margin-left: auto; transition: transform .18s ease; }
#o404f-panel .o404f-badge + .o404f-chevron { margin-left: 0; }
#o404f-panel .o404f-chevron::before {
    content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px;
    border-right: 2px solid var(--o404f-accent); border-bottom: 2px solid var(--o404f-accent);
    transform: translate(-50%, -65%) rotate(45deg);
}
#o404f-panel .o404f-section[open] .o404f-chevron { transform: rotate(180deg); }
#o404f-panel .o404f-body { border-top: 1px solid #F3EEEE; padding: 12px 14px 14px; }

#o404f-panel .o404f-trail { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 13px; }
#o404f-panel .o404f-up { color: var(--o404f-accent); font-weight: 700; text-decoration: none; white-space: nowrap; }

#o404f-panel .o404f-list { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; }
#o404f-panel .o404f-list > a,
#o404f-panel .o404f-check {
    display: flex; align-items: center; gap: 8px; width: 100%; border-radius: 8px; padding: 8px 8px;
    color: var(--o404f-text); text-decoration: none; font-size: 13px; line-height: 1.35;
}
#o404f-panel .o404f-list > a:hover { background: var(--o404f-accent-soft); color: var(--o404f-text); }
#o404f-panel .o404f-box { position: relative; width: 17px; height: 17px; flex: 0 0 17px; border: 1.5px solid #D5C8C8; border-radius: 4px; background: #fff; }
#o404f-panel .o404f-check.on { font-weight: 700; }
#o404f-panel .o404f-check.on .o404f-box { background: var(--o404f-accent); border-color: var(--o404f-accent); }
#o404f-panel .o404f-check.on .o404f-box::after { content: ""; position: absolute; left: 5px; top: 2px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
#o404f-panel .o404f-check.is-disabled { color: #ADA5A5; cursor: not-allowed; }
#o404f-panel .o404f-check.is-disabled .o404f-box { border-color: #EAE3E3; background: #FAF7F7; }
#o404f-panel .o404f-label { flex: 1 1 auto; min-width: 0; }
#o404f-panel .o404f-count { flex: 0 0 auto; margin-left: auto; color: var(--o404f-muted); font-size: 11px; }
#o404f-panel .o404f-sep { display: block; flex: 0 0 1px; height: 1px; margin: 4px 2px; background: #F0EAEA; }
#o404f-panel .o404f-notice { margin: 0 0 8px; background: var(--o404f-accent-soft); color: var(--o404f-accent); border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.4; }

/* =========================================================
 * BLOQUE 5: precio (tramo seleccionado, sin recortes en los extremos)
 * ========================================================= */
#o404f-panel .o404f-price-values { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 14px; }
#o404f-panel .o404f-price-values span { min-width: 76px; border-radius: 8px; background: var(--o404f-accent); color: #fff; text-align: center; padding: 6px 10px; font-size: 12px; font-weight: 700; }
#o404f-panel .o404f-range { position: relative; height: 22px; margin: 0 9px 4px; }
#o404f-panel .o404f-track { position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: var(--o404f-track); }
#o404f-panel .o404f-fill { position: absolute; top: 0; bottom: 0; left: var(--o404f-a, 0%); right: calc(100% - var(--o404f-b, 100%)); border-radius: 4px; background: var(--o404f-accent); }
/* !important solo en lo que el tema (Astra) pone a todos los inputs: fondo, borde, sombra, relleno, alto. */
#o404f-panel .o404f-range input[type="range"] {
    position: absolute; left: -9px; right: -9px; top: 0; width: calc(100% + 18px) !important; height: 22px !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important;
    -webkit-appearance: none; appearance: none; background: transparent !important; box-shadow: none !important;
    pointer-events: none; outline: none; min-height: 0 !important;
}
#o404f-panel .o404f-range input[type="range"]:focus { background: transparent !important; box-shadow: none !important; border: 0 !important; }
#o404f-panel .o404f-range input[type="range"]::-webkit-slider-runnable-track { height: 22px; background: transparent !important; border: 0 !important; box-shadow: none !important; }
#o404f-panel .o404f-range input[type="range"]::-moz-range-track { height: 22px; background: transparent !important; border: 0 !important; box-shadow: none !important; }
#o404f-panel .o404f-range input[type="range"]::-moz-range-progress { background: transparent !important; }
#o404f-panel .o404f-range input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: pointer;
    width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
    border: 3px solid var(--o404f-accent); background: #fff; box-shadow: 0 1px 3px rgba(60, 15, 15, .2);
}
#o404f-panel .o404f-range input[type="range"]::-moz-range-thumb {
    pointer-events: auto; cursor: pointer; width: 12px; height: 12px; border-radius: 50%;
    border: 3px solid var(--o404f-accent); background: #fff; box-shadow: 0 1px 3px rgba(60, 15, 15, .2);
}

/* =========================================================
 * BLOQUE 6: disponibilidad e interruptores
 * ========================================================= */
#o404f-panel .o404f-toggle { display: flex; align-items: center; gap: 10px; padding: 8px 4px; color: var(--o404f-text); text-decoration: none; font-size: 13px; line-height: 1.3; }
#o404f-panel .o404f-toggle:hover { color: var(--o404f-text); }
#o404f-panel .o404f-toggle .o404f-count { margin-left: 0; }
#o404f-panel .o404f-switch { position: relative; width: 38px; height: 21px; flex: 0 0 38px; margin-left: auto; background: #DDD3D3; border-radius: 999px; }
#o404f-panel .o404f-toggle .o404f-count + .o404f-switch { margin-left: 0; }
#o404f-panel .o404f-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: left .15s ease; }
#o404f-panel .o404f-toggle.on .o404f-switch { background: var(--o404f-accent); }
#o404f-panel .o404f-toggle.on .o404f-switch::after { left: 20px; }

/* =========================================================
 * BLOQUE 7: móvil y tablet (drawer)
 * ========================================================= */
@media (max-width: 1024px) {
    .o404f-layout { display: block; }
    html.o404f-js #o404f-bar .o404f-open { display: inline-flex; }

    html.o404f-js #o404f-drawer .o404f-overlay {
        display: block; position: fixed; inset: 0; z-index: 99997; background: rgba(30, 10, 10, .38);
        opacity: 0; visibility: hidden; transition: opacity .18s ease, visibility .18s ease;
    }
    html.o404f-js #o404f-panel {
        position: fixed; z-index: 99998; top: 0; left: 0; bottom: 0;
        width: min(92vw, 380px); height: 100vh; height: 100dvh; margin: 0;
        display: flex; flex-direction: column;
        background: #FBF8F8; box-shadow: none; visibility: hidden;
        transform: translateX(-105%); transition: transform .22s ease, visibility 0s linear .22s;
    }
    html.o404f-is-open { overflow: hidden; }
    html.o404f-is-open #o404f-drawer .o404f-overlay { opacity: 1; visibility: visible; }
    html.o404f-is-open #o404f-panel { transform: translateX(0); visibility: visible; box-shadow: 12px 0 36px rgba(60, 15, 15, .18); transition: transform .22s ease; }

    html.o404f-js #o404f-panel .o404f-head {
        display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto;
        padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--o404f-line); color: var(--o404f-accent); font-size: 16px;
    }
    #o404f-panel .o404f-close {
        display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0;
        border: 0; border-radius: 8px; background: var(--o404f-accent); color: #fff; font-size: 16px; cursor: pointer;
    }
    html.o404f-js #o404f-panel .o404f-scroll {
        flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
        padding: 14px 16px;
    }
    html.o404f-js #o404f-panel .o404f-foot {
        display: flex; align-items: center; gap: 12px; flex: 0 0 auto;
        padding: 12px 16px; background: #fff; border-top: 1px solid var(--o404f-line);
    }
    #o404f-panel .o404f-show {
        flex: 1; border: 0; border-radius: 10px; background: var(--o404f-accent); color: #fff;
        padding: 13px 16px; font: 700 14px/1 var(--o404f-font); cursor: pointer;
    }
}
