/* ==========================================================================
   Qemmah — Sidebar product filter (searchmodule filter components)
   Pushed by the filter component itself. Scoped to .qm-filter.
   ========================================================================== */

.qm-filter {
    --qf-line: rgba(161, 120, 92, .14);
    --qf-text: #4a3a31;
    --qf-muted: #8a7466;
}

.qm-filter .qm-filter__box {
    display: block;
    width: 100%;
    margin: 0 !important;
    padding: 0 20px 10px !important; /* no top padding: the gradient head sits flush with the rounded top */
    overflow: hidden;
    background: #fff;
    border: 0;
    border-radius: 22px;
    box-shadow: 0 0 0 1px rgba(161, 120, 92, .1), 0 30px 60px -40px rgba(58, 34, 25, .45);
}

/* ----- Head ----- */

.qm-filter__head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 -20px;
    padding: 18px 20px 16px;
    background:
        radial-gradient(240px 90px at 100% 0, rgba(226, 193, 156, .35), transparent 70%),
        linear-gradient(180deg, #fdf9f5, #fff);
    border-bottom: 1px solid var(--qf-line);
}

.qm-filter__head h4 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 16px; font-weight: 800; color: var(--qm-ink); white-space: nowrap; }

.qm-filter__head h4 i {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    font-size: 13px;
    color: #fff;
    background: var(--qm-gloss-gold);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5), 0 6px 14px -8px rgba(107, 62, 46, .8);
}

.qm-filter__reset {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--qm-brown);
    background: transparent;
    border: 0;
    border-radius: 999px;
    white-space: nowrap;
    transition: background-color .2s;
}

.qm-filter__reset:hover { background: #f6ede4; }
.qm-filter__reset i { font-size: 11px; }

/* ----- Groups ----- */

.qm-filter__group { border-bottom: 1px solid var(--qf-line); }
.qm-filter__group:last-child { border-bottom: 0; }

.qm-filter__group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--qm-ink);
    list-style: none;
    cursor: pointer;
}

.qm-filter__group > summary::-webkit-details-marker { display: none; }

.qm-filter__group > summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-size: 11px;
    font-weight: 900;
    color: var(--qm-gold-4);
    transition: transform .3s var(--qm-ease);
}

.qm-filter__group[open] > summary::after { transform: rotate(180deg); }
.qm-filter__group[open] > summary + * { animation: qf-in .3s var(--qm-ease); }

@keyframes qf-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: none; }
}

/* ----- Gender: segmented choice ----- */

.qm-filter__segment {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 18px;
    padding: 4px;
    background: #f6efe8;
    border: 1px solid var(--qf-line);
    border-radius: 12px;
}

.qm-filter__segment label { position: relative; margin: 0 !important; cursor: pointer; }
.qm-filter__segment input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.qm-filter__segment span {
    display: grid;
    place-items: center;
    height: 34px;
    font-size: 13px;
    font-weight: 700;
    color: var(--qf-muted);
    border-radius: 9px;
    transition: background-color .2s, color .2s, box-shadow .2s;
}

.qm-filter__segment input:checked + span { color: var(--qm-brown); background: #fff; box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 6px 14px -8px rgba(58, 34, 25, .45); }
.qm-filter__segment input:focus-visible + span { box-shadow: 0 0 0 3px rgba(199, 154, 114, .35); }

/* ----- Colour swatches ----- */

/* equal-width pills in two columns, so the list reads as a tidy grid */
.qm-filter__swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-bottom: 18px; }

.qm-swatch {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    margin: 0 !important;
    padding: 5px 12px 5px 6px;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--qf-text);
    background: #faf6f2;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    transition: border-color .2s, background-color .2s, box-shadow .2s;
}

[dir="rtl"] .qm-swatch { padding: 5px 6px 5px 12px; }
.qm-swatch:hover { border-color: rgba(161, 120, 92, .3); }
.qm-swatch__name { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.qm-swatch input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.qm-swatch__dot {
    position: relative;
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--qm-swatch);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12), 0 2px 4px -2px rgba(0, 0, 0, .3);
}

/* "no colour": a struck-through ring */
.qm-swatch__dot.is-none { background: #fff; box-shadow: inset 0 0 0 1.5px #cdbcae; }
.qm-swatch__dot.is-none::after { content: ""; position: absolute; top: 50%; left: 3px; right: 3px; height: 1.5px; background: #cdbcae; transform: rotate(-45deg); }

.qm-swatch:has(input:checked) { color: var(--qm-ink); background: #fff; border-color: var(--qm-gold-3); box-shadow: 0 6px 14px -10px rgba(107, 62, 46, .7); }
.qm-swatch:has(input:checked) .qm-swatch__dot { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--qm-gold-4); }
.qm-swatch:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(199, 154, 114, .35); }

/* ----- Price ----- */

.qm-filter__price { padding: 6px 4px 18px; }

.qm-filter #slider-range { height: 4px; margin: 14px 10px 22px !important; background: #eadfd3; border: 0; border-radius: 4px; }
.qm-filter #slider-range .ui-slider-range { background: var(--qm-gloss-gold) !important; border: 0 !important; }

.qm-filter #slider-range .ui-slider-handle {
    top: -9px;
    width: 22px;
    height: 22px;
    margin-left: -11px;
    background: #fff !important;
    border: 2px solid var(--qm-gold-4) !important; /* custom.css forces .ui-state-default with !important */
    border-radius: 50% !important;
    box-shadow: 0 4px 12px -4px rgba(58, 34, 25, .5) !important;
    cursor: grab;
    outline: 0;
}

.qm-filter #slider-range .ui-slider-handle::after,
.qm-filter #slider-range .ui-slider-handle::before { display: none !important; }
.qm-filter #slider-range .ui-slider-handle:focus-visible { box-shadow: 0 0 0 4px rgba(199, 154, 114, .35) !important; }

.qm-filter__range { display: flex; align-items: center; gap: 8px; }

.qm-filter__val {
    display: grid;
    flex: 1;
    gap: 2px;
    padding: 8px 12px;
    background: #faf6f2;
    border: 1px solid var(--qf-line);
    border-radius: 12px;
}

.qm-filter__val small { font-size: 11px; font-weight: 600; color: var(--qf-muted); }
.qm-filter__val b { display: inline-flex; align-items: baseline; gap: 4px; font-size: 15px; font-weight: 800; color: var(--qm-ink); font-variant-numeric: tabular-nums; }
.qm-filter__val b svg { width: .8em; height: .8em; color: var(--qm-gold-4); fill: currentColor; }
.qm-filter__dash { flex: none; width: 10px; height: 2px; background: #d8c8b9; border-radius: 2px; }

/* ----- Category search + tree ----- */

.qm-filter__search { position: relative; margin-bottom: 10px; }

.qm-filter__search i {
    position: absolute;
    top: 50%;
    inset-inline-start: 12px;
    font-size: 12px;
    color: var(--qf-muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.qm-filter #accordion_search_bar {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    padding-inline-start: 34px;
    font-size: 13px;
    background: #faf6f2;
    border: 1px solid var(--qf-line);
    border-radius: 12px;
    transition: border-color .2s, background-color .2s;
}

.qm-filter #accordion_search_bar:focus { outline: 0; background: #fff; border-color: var(--qm-gold-3); }

.qm-filter__tree { max-height: 320px; padding-bottom: 14px; overflow-y: auto; scrollbar-width: thin; }

.qm-filter__child {
    margin-inline-start: 11px;
    padding-inline-start: 12px;
    border-inline-start: 1px dashed rgba(161, 120, 92, .3);
}

.qm-filter__check {
    position: relative;
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 6px 4px;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    color: var(--qf-text);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .2s;
}

.qm-filter__check:hover { background: #faf6f2; }
.qm-filter__check input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.qm-filter__check.is-parent { font-weight: 800 !important; color: var(--qm-ink); }

.qm-filter__box-ui {
    position: relative;
    flex: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 1.5px solid #d6c4b2;
    border-radius: 5px;
    transition: background-color .2s, border-color .2s;
}

.qm-filter__box-ui::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: transform .2s var(--qm-ease);
}

.qm-filter__check input:checked + .qm-filter__box-ui { background: var(--qm-gloss-gold); border-color: var(--qm-gold-4); }
.qm-filter__check input:checked + .qm-filter__box-ui::after { transform: rotate(45deg) scale(1); }
.qm-filter__check input:focus-visible + .qm-filter__box-ui { box-shadow: 0 0 0 3px rgba(199, 154, 114, .35); }
.qm-filter__check .category_text { font-size: inherit !important; color: inherit !important; }

@media (prefers-reduced-motion: reduce) {
    .qm-filter * { animation: none !important; transition: none !important; }
}
