/* Lumingerie — new product filter UI (pilotti: Rintaliivit).
   Loaded only by layouts/category-filters.inc. All selectors use `.lp-`
   prefix so nothing collides with main.css / lumingerie.css / media.css. */

.lp-filterbar-wrap,
.lp-filters-section,
.lp-drawer,
.lp-sheet,
.lp-popover,
.lp-active-row {
    --lp-purple:        #71538F;
    --lp-purple-dark:   #5a4173;
    --lp-purple-light:  #BDAECD;
    --lp-purple-pale:   #f1ecf5;
    --lp-purple-50:     #faf8fc;
    --lp-ink:           #1a1a1a;
    --lp-text:          #2a2230;
    --lp-mute:          #6c6273;
    --lp-mute-2:        #9c93a4;
    --lp-line:          #e3dee7;
    --lp-line-2:        #ebe7ee;
    --lp-bg:            #ffffff;
    --lp-bg-alt:        #f7f5f9;
    --lp-shadow-pop:    0 18px 48px rgba(40, 20, 60, 0.18), 0 2px 8px rgba(40, 20, 60, 0.06);
    --lp-font:          "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* Hide the legacy SetFilterSearch markup that we keep in the DOM to
   proxy state into — the new pill UI replaces it visually. */
.lp-legacy-hidden .product-list-filter-search,
.lp-legacy-hidden .show-filters,
.lp-legacy-hidden .product-sorting,
.lp-legacy-hidden ul.set-listing,
.lp-legacy-hidden .js-show-filters,
.lp-filters-mobile-legacy { display: none !important; }

/* ============= Sub-/sibling-category chip lists =============
   Override Lumingerien default subcategory- ja siblingcategory-listan
   ulkoasu pelkästään tällä layoutilla — kaarettomat vaaleanharmaat chipit
   vaakavieritettävässä rivissä, yhtenäisinä filter-pillirivin kanssa. */

/* main.css lisää eron sister- ja subcategory-listojen väliin; ei tarvita
   uudessa chip-rivissä. */
.siblingcategories + .subcategories { border-top: 0 !important; }

ul.subcategories.plain.cf,
ul.siblingcategories.plain.cf {
    display: flex;
    /* Desktop oletuksena wrap (ei vaakaskrollia) — vaakaskrollaus
       aktivoituu vain mobiili-mediakyselyssä alempana. */
    flex-wrap: wrap;
    /* main.css asettaa `.subcategories { justify-content: center }` joka
       wrap-tilassa keskittäisi rivin viimeisetkin chipit. Halutaan
       vasemmasta reunasta alkava rivitys. */
    justify-content: flex-start;
    gap: 8px;
    margin: 0 0 16px;
    padding: 4px 0;
    list-style: none;
}

ul.subcategories.plain.cf .subcategory-item,
ul.siblingcategories.plain.cf .siblingcategory-item {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    float: none;
    list-style: none;
    background: none;
}
ul.subcategories.plain.cf .subcategory-item::before,
ul.siblingcategories.plain.cf .siblingcategory-item::before { display: none; }

ul.subcategories.plain.cf .subcategory-link,
ul.siblingcategories.plain.cf .siblingcategory-link {
    display: inline-block;
    padding: 9px 14px;
    background: #f0eeec;
    color: #1a1a1a;
    font-weight: 700;
    font-size: 13.5px;
    line-height: 1.2;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid transparent;
    white-space: nowrap;
    transition: background .12s, color .12s, border-color .12s;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
ul.subcategories.plain.cf .subcategory-link:hover,
ul.siblingcategories.plain.cf .siblingcategory-link:hover {
    background: #e5e2df;
}
ul.subcategories.plain.cf .subcategory-link.is-active,
ul.siblingcategories.plain.cf .siblingcategory-link.is-active {
    background: #71538F;
    color: #fff;
}

/* ============= Filter pill bar ============= */

/* Section ympäröi otsikon ja pilliriviä — vaakaviiva erottaa kategoriat
   ylhäällä ja filter-section alhaalla. */
.lp-filters-section {
    margin-top: 6px;
    padding-top: 18px;
    border-top: 1px solid var(--lp-line);
    font-family: var(--lp-font);
}
.lp-filters-heading {
    /* lumingerie.css:llä on `h2 { font-size: 1.5em !important }` ja
       main.css:llä `h2 { text-transform: uppercase }` — !important
       tarvitaan voittamaan ne. */
    font-size: 12px !important;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lp-mute);
    margin: 0 0 12px;
    padding: 0;
    font-family: var(--lp-font);
    line-height: 1.2;
    text-align: left;
}

.lp-filterbar-wrap {
    padding: 0 0 18px;
    position: relative;
    font-family: var(--lp-font);
    color: var(--lp-text);
    box-sizing: border-box;
}
.lp-filterbar-wrap *, .lp-drawer *, .lp-sheet *, .lp-popover * { box-sizing: border-box; }

.lp-filterbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.lp-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    border: 1px solid var(--lp-ink);
    border-radius: 8px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--lp-ink);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
    min-height: 42px;
    font-family: inherit;
}
.lp-pill .chev {
    font-size: 10px;
    transition: transform 0.2s;
}
.lp-pill.open {
    background: var(--lp-purple-50);
    border-color: var(--lp-purple);
    color: var(--lp-purple-dark);
}
.lp-pill.open .chev { transform: rotate(180deg); }
.lp-pill.has-value {
    background: var(--lp-purple);
    color: #fff;
    border-color: var(--lp-purple);
}
.lp-pill .ct {
    background: rgba(255,255,255,0.22);
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    margin-left: -2px;
}
.lp-pill.has-value .ct { background: rgba(255,255,255,0.25); }

.lp-pill-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    border: 1.5px solid var(--lp-ink);
    border-radius: 8px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--lp-ink);
    cursor: pointer;
    min-height: 42px;
    font-family: inherit;
}
.lp-pill-all:hover {
    background: var(--lp-ink);
    color: #fff;
}
.lp-pill-all svg { width: 16px; height: 16px; }

.lp-pill-divider {
    width: 1px;
    height: 22px;
    background: var(--lp-line);
    margin: 0 4px;
}

/* Active applied chips row */
.lp-active-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--lp-line-2);
    font-family: var(--lp-font);
}
.lp-active-label {
    font-size: 12px;
    color: var(--lp-mute);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-right: 4px;
}
.lp-active-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--lp-purple-pale);
    color: var(--lp-purple-dark);
    border: 1px solid #e0d4ea;
    border-radius: 999px;
    padding: 5px 6px 5px 12px;
    font-size: 12.5px;
    font-weight: 500;
}
.lp-active-chip .x {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--lp-purple);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}
.lp-active-clear {
    margin-left: auto;
    font-size: 12.5px;
    color: var(--lp-ink);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
}

/* ============= Popover (desktop dropdown) ============= */

.lp-popover {
    position: absolute;
    background: #fff;
    border: 1px solid var(--lp-line);
    border-radius: 12px;
    box-shadow: var(--lp-shadow-pop);
    padding: 0;
    width: 380px;
    z-index: 60;
    overflow: hidden;
    font-family: var(--lp-font);
    color: var(--lp-text);
}
/* Koko-popoverissa on usein 30+ koko-arvoa; leveämpi popover mahduttaa
   enemmän chipsejä per rivi, joten popover ei kasva ylettömän pitkäksi. */
.lp-popover--size { width: 640px; max-width: calc(100vw - 32px); }
.lp-popover-body {
    padding: 20px 22px;
    max-height: 480px;
    overflow-y: auto;
}
.lp-popover-foot {
    display: flex;
    border-top: 1px solid var(--lp-line);
    background: #fbfaff;
}
.lp-popover-foot button {
    flex: 1;
    border: 0;
    background: transparent;
    padding: 14px 16px;
    font-size: 13.5px;
    font-family: inherit;
    cursor: pointer;
}
.lp-popover-foot .clear { color: var(--lp-mute); }
.lp-popover-foot .clear:hover { color: var(--lp-ink); }
.lp-popover-foot .clear:disabled { color: var(--lp-mute-2); cursor: default; }
.lp-popover-foot .save {
    background: var(--lp-purple);
    color: #fff;
    font-weight: 600;
}
.lp-popover-foot .save:hover { background: var(--lp-purple-dark); }

/* Size grid */
.lp-size-help {
    font-size: 13px;
    color: var(--lp-mute);
    line-height: 1.5;
    margin: 0 0 16px;
}
.lp-size-help strong { color: var(--lp-purple-dark); font-weight: 600; }
.lp-size-section-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--lp-mute);
    margin: 14px 0 8px;
}
.lp-size-section-title:first-child { margin-top: 0; }

.lp-size-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.lp-size-grid.cup { grid-template-columns: repeat(8, 1fr); }
/* Auto-variantti vaihtelevan mittaisille koko-arvoille — esim.
   "42 / UK16" tai "S/36-38 - 4XL/58-60". Solut kasvavat sisällön mukaan,
   rivittyvät luonnollisesti. */
.lp-size-grid-auto {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.lp-size-grid-auto .lp-size-cell {
    padding: 8px 12px;
    min-width: 56px;
    white-space: nowrap;
    /* main.css:n globaali "button { width: 100%; margin: .5em 0; height: 38px }"
       pakottaisi solut omille riveilleen mobiilissa — override:t. */
    width: auto;
    margin: 0;
    height: auto;
}
.lp-size-cell {
    border: 1px solid var(--lp-line);
    background: #fff;
    padding: 10px 4px;
    font-size: 12.5px;
    font-weight: 500;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    color: var(--lp-ink);
}
.lp-size-cell:hover { border-color: var(--lp-purple); color: var(--lp-purple-dark); }
.lp-size-cell.selected {
    border-color: var(--lp-purple);
    background: var(--lp-purple);
    color: #fff;
}

/* Color swatches */
.lp-color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.lp-color-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--lp-line);
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    font-size: 13px;
    color: var(--lp-ink);
}
.lp-color-row:hover { border-color: var(--lp-purple); }
.lp-color-row.selected {
    border-color: var(--lp-purple);
    background: var(--lp-purple-50);
    color: var(--lp-purple-dark);
    font-weight: 600;
}
.lp-color-sw {
    width: 28px; height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.08);
    flex: 0 0 28px;
}

/* Brand list w/ search */
.lp-search-input {
    width: 100%;
    border: 1px solid var(--lp-line);
    border-radius: 8px;
    padding: 10px 12px 10px 36px;
    font-size: 13.5px;
    font-family: inherit;
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c6273' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
    box-sizing: border-box;
}
.lp-search-input:focus { outline: none; border-color: var(--lp-purple); }

.lp-checklist {
    display: flex;
    flex-direction: column;
    margin-top: 12px;
}
.lp-checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    font-size: 13.5px;
    cursor: pointer;
    border-bottom: 1px solid var(--lp-line-2);
    color: var(--lp-ink);
}
.lp-checklist-item:last-child { border-bottom: 0; }
.lp-checklist-item .ck {
    width: 18px; height: 18px;
    border: 1.5px solid var(--lp-mute-2);
    border-radius: 4px;
    flex: 0 0 18px;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 12px;
    background: #fff;
    line-height: 1;
}
.lp-checklist-item.checked .ck {
    background: var(--lp-purple);
    border-color: var(--lp-purple);
}
.lp-checklist-item .ct {
    margin-left: auto;
    font-size: 12px;
    color: var(--lp-mute);
}
/* "Lajittele" pill uses radio look — round, not square */
.lp-checklist-item.lp-radio .ck {
    border-radius: 50%;
}
.lp-checklist-item.lp-radio.checked .ck {
    background: var(--lp-purple);
    border-color: var(--lp-purple);
}

/* ============= Kaikki filtterit overlay ============= */

.lp-drawer-backdrop {
    position: fixed; inset: 0;
    background: rgba(40, 20, 60, 0.32);
    z-index: 1000;
}
.lp-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 460px;
    max-width: 100vw;
    background: #fff;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 32px rgba(40, 20, 60, 0.2);
    font-family: var(--lp-font);
    color: var(--lp-text);
}
.lp-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--lp-line-2);
}
.lp-drawer-head h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--lp-ink);
    font-family: inherit;
}
.lp-drawer-close {
    width: 36px; height: 36px;
    border: 1px solid var(--lp-line);
    background: #fff;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: var(--lp-ink);
    font-family: inherit;
}
.lp-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}
.lp-drawer-section {
    border-bottom: 1px solid var(--lp-line-2);
    padding: 18px 16px;
}
.lp-drawer-section:last-child { border-bottom: 0; }
.lp-drawer-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}
.lp-drawer-section-head h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    color: var(--lp-ink);
    font-family: inherit;
}
.lp-drawer-section-head .val {
    font-size: 12.5px;
    color: var(--lp-purple-dark);
    font-weight: 500;
}
.lp-drawer-section-head .chev2 {
    font-size: 11px;
    color: var(--lp-mute);
    margin-left: 10px;
}
.lp-drawer-section-body {
    padding-top: 14px;
}
.lp-drawer-foot {
    display: flex;
    gap: 10px;
    padding: 14px 22px 22px;
    border-top: 1px solid var(--lp-line-2);
    background: #fff;
}
.lp-drawer-foot .clear {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid var(--lp-ink);
    color: var(--lp-ink);
    border-radius: 8px;
    padding: 14px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}
.lp-drawer-foot .apply {
    flex: 1;
    background: var(--lp-purple);
    border: 0;
    color: #fff;
    border-radius: 8px;
    padding: 14px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

/* ============= Mobile sheet ============= */

.lp-sheet {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    font-family: var(--lp-font);
    color: var(--lp-text);
}
.lp-sheet-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--lp-line);
}
.lp-sheet-head .close {
    width: 32px; height: 32px;
    border: 1px solid var(--lp-ink);
    background: #fff;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--lp-ink);
    flex: 0 0 32px;
    font-family: inherit;
    font-size: 18px;
    line-height: 1;
}
.lp-sheet-head h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: var(--lp-ink);
    font-family: inherit;
}
.lp-sheet-head .right {
    margin-left: auto;
    font-size: 13.5px;
    color: var(--lp-ink);
    text-decoration: underline;
    cursor: pointer;
}
.lp-sheet-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
}
.lp-sheet-foot {
    padding: 14px 16px 18px;
    border-top: 1px solid var(--lp-line);
    background: #fff;
}
.lp-sheet-foot .btn {
    width: 100%;
    background: var(--lp-purple);
    color: #fff;
    border: 0;
    border-radius: 8px;
    padding: 16px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    /* main.css "button { height:38px }" puristaisi paddingin tekstin ulos
       sentteristä — flex-keskitys + auto height varmistaa keskityksen. */
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.lp-sheet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 18px;
    border-bottom: 1px solid var(--lp-line-2);
    cursor: pointer;
}
.lp-sheet-row .lbl {
    font-size: 15.5px;
    font-weight: 700;
    color: var(--lp-ink);
}
.lp-sheet-row .val {
    font-size: 13px;
    color: var(--lp-purple-dark);
    margin-top: 3px;
    font-weight: 500;
}
.lp-sheet-row .chev3 { color: var(--lp-mute); font-size: 14px; }

/* ============= Mobile compact pill strip on category page ============= */

@media (max-width: 776px) {
    /* Mobiilissa kategorialistat skrollaavat sivuttain (yhdellä rivillä)
       desktopin wrap-tyylin sijaan. */
    ul.subcategories.plain.cf,
    ul.siblingcategories.plain.cf {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    ul.subcategories.plain.cf::-webkit-scrollbar,
    ul.siblingcategories.plain.cf::-webkit-scrollbar { display: none; }

    /* Vaaka-scrollaava pillirivi mobiilissa — pillit eivät kierry uudelle
       riville vaan käyttäjä voi vierittää sivuttain. Piilotetaan scrollbar
       visuaalisesti mutta jätetään toiminto. */
    .lp-filterbar {
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: none;
        -ms-overflow-style: none;
        /* Päätetilan reuna katkoo viimeisen pillin siististi, jotta käyttäjä
           näkee että jatkoa löytyy oikealta. */
        padding-bottom: 4px;
        margin-right: -16px;
        padding-right: 16px;
    }
    .lp-filterbar::-webkit-scrollbar { display: none; }
    /* main.css globaali "button { width:100%; margin:.5em 0; height:38px }"
       pakottaisi pillit täysleveiksi mobiilissa — override:t alla. */
    .lp-filterbar > .lp-pill,
    .lp-filterbar > .lp-pill-all {
        flex: 0 0 auto;
        width: auto;
        margin: 0;
        height: auto;
        min-height: 38px;
        padding: 9px 13px;
        font-size: 13px;
    }
    .lp-pill-divider { display: none; }
    .lp-popover {
        position: fixed !important;
        inset: 0 !important;
        width: auto !important;
        height: auto !important;
        max-width: 100vw;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    .lp-popover-body { max-height: none; flex: 1; }

    /* Sivun chatbot-widget (Tarvitsetko apua?) on position:fixed bottom-right
       ja peittäisi "Näytä tuotteet" -napin oikean reunan. Nostetaan footer
       chatbotin yläpuolelle ylimääräisellä alapaddingilla. */
    .lp-sheet-foot { padding-bottom: 64px; }
}
