/* hafa.fi-style faceted filters on the Kylpyhuone category tree (scoped by body.hafa-filter-archive) */
body.hafa-filter-archive .hafa-filter-results { position: relative; }
body.hafa-filter-archive .hafa-filter-results.is-loading ul.products,
body.hafa-filter-archive .hafa-filter-results.is-loading .woocommerce-pagination { opacity: .45; pointer-events: none; transition: opacity .15s; }

.hafa-filter { margin: 1.25rem 0 1rem; color: #000; }
.hafa-filter__form { display: none; }
.hafa-filter__actions { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.hafa-filter__compact { flex: 1 1 0; min-width: 0; }

/* "Suodata" button (mobile) */
.hafa-filter__open { display: none; align-items: center; gap: .3125rem; background: #4a4a48; color: #fefefe; border: 1px solid #4a4a48; font: inherit; font-size: 1rem; line-height: 1.2; padding: .5rem .9375rem; cursor: pointer; border-radius: 0; transition: background-color .2s; }
.hafa-filter__open:hover, .hafa-filter__open:focus { background: #525250; border-color: #525250; color: #fefefe; outline: none; }
.hafa-filter__open svg { width: 1rem; height: 1rem; fill: #fefefe; }
.hafa-filter__badge { display: inline-block; min-width: 2.1em; padding: .3em; border-radius: 50%; font-size: .6rem; line-height: 1; text-align: center; background: #fefefe; color: #000; margin-left: .3125rem; font-weight: 600; }

/* Group pills (desktop) */
.hafa-filter__groups { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.hafa-filter__group { position: relative; list-style: none; margin: 0; padding: 0; }
.hafa-filter__group-header { display: flex; align-items: center; font: inherit; font-size: 1rem; line-height: 1; padding: .625rem; margin: .1875rem .625rem .1875rem 0; background: #f5f2f0; color: #111; border: 0; border-radius: .25rem; cursor: pointer; text-transform: none; }
.hafa-filter__group-header:hover, .hafa-filter__group-header:focus { background: #ece6e2; outline: none; color: #111; }
.hafa-filter__group-header::after { content: ""; display: inline-block; width: 1rem; height: 1rem; margin-left: .625rem; background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 01.708 0L8 10.293l5.646-5.647a.5.5 0 01.708.708l-6 6a.5.5 0 01-.708 0l-6-6a.5.5 0 010-.708z'/%3E%3C/svg%3E") 50% no-repeat; transition: transform .2s; }
.hafa-filter__group.is-open .hafa-filter__group-header::after { transform: rotate(180deg); }

.hafa-filter__sublist { display: none; position: absolute; top: calc(100% - 1px); left: 0; width: 18.75rem; max-width: calc(100vw - 2rem); background: #fefefe; border: 1px solid #999; box-shadow: 1px 1px 4px 0 rgba(0,0,0,.3); padding: .625rem .625rem 0; z-index: 40; user-select: none; }
.hafa-filter__sublist::before { content: ""; position: absolute; top: -.375rem; left: .875rem; width: .75rem; height: .75rem; background: #fefefe; transform: rotate(45deg); border: 1px solid; border-color: #999 transparent transparent #999; }
.hafa-filter__group.is-open .hafa-filter__sublist { display: block; }
.hafa-filter__items { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.hafa-filter__item { list-style: none; display: flex; margin: 0 0 5px; padding: 0; }
.hafa-facet { display: flex; align-items: center; cursor: pointer; margin: 0; font-weight: 400; white-space: nowrap; position: relative; }
.hafa-facet__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.hafa-facet__label { display: flex; align-items: center; font-size: .875rem; line-height: 2em; color: #000; }
.hafa-facet__label::before { content: ""; display: inline-block; flex: 0 0 auto; width: 1rem; height: 1rem; margin: 0 .3125rem 0 0; border: 1px solid #444; background: #fff; transition: border-color .2s; box-sizing: border-box; }
.hafa-facet:hover .hafa-facet__label::before { border-color: #000; }
.hafa-facet__input:focus-visible + .hafa-facet__label::before { outline: 2px solid #4a4a48; outline-offset: 1px; }
.hafa-facet__input:checked + .hafa-facet__label::before { background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M12.736 3.97a.733.733 0 011.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 01-1.065.02L3.217 8.384a.757.757 0 010-1.06.733.733 0 011.047 0l3.052 3.093 5.4-6.425a.247.247 0 01.02-.022z'/%3E%3C/svg%3E") 50% / 75% no-repeat #fff; }
.hafa-facet__qty { color: #333; margin-left: .25em; }
.hafa-filter__select { display: block; width: calc(100% + 1.25rem); margin: .625rem -.625rem 0; padding: 1rem; background: #111; color: #fefefe; border: 0; border-radius: 0; font: inherit; font-size: 1rem; cursor: pointer; transition: background-color .3s; }
.hafa-filter__select:hover, .hafa-filter__select:focus { background: #000; color: #fefefe; }
.hafa-filter__show-more { display: none; }
.hafa-filter__panel-head, .hafa-filter__panel-tags, .hafa-filter__close { display: none; }

/* Hits + sort */
.hafa-filter__sort { display: flex; align-items: center; justify-content: flex-end; flex: 0 0 auto; gap: .3125rem; padding-top: .5rem; }
.hafa-filter__hits { font-size: .875rem; line-height: 1; white-space: nowrap; }
body.hafa-filter-archive .hafa-filter__sort .woocommerce-ordering { margin: 0; padding: 0; float: none; }
body.hafa-filter-archive .hafa-filter__sort .orderby { width: auto; border: 0; background: transparent; font: inherit; font-size: .875rem; font-weight: 600; color: #000; padding: 0 1.25rem 0 .25rem; margin: 0; cursor: pointer; line-height: 1.2; height: auto; min-height: 0; box-shadow: none; }
body.hafa-filter-archive .hafa-filter__sort .orderby:hover { color: #333; }
body.hafa-filter-archive .hafa-filter__sort .orderby:focus { outline: none; color: #333; }

/* Selected filter tags */
.hafa-filter__tags { display: flex; flex-wrap: wrap; gap: .625rem; margin-top: .625rem; }
.hafa-filter__tags:empty { display: none; }
.hafa-filter__tag { display: inline-flex; align-items: center; padding: .5rem .625rem; background: #f5f2f0; color: #000; font: inherit; font-size: .875rem; line-height: 1; border: 0; border-radius: 3px; cursor: pointer; transition: background-color .3s; }
.hafa-filter__tag::after { content: ""; display: inline-block; width: .625rem; height: .625rem; margin-left: .3125rem; background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M2.146 2.854a.5.5 0 11.708-.708L8 7.293l5.146-5.147a.5.5 0 01.708.708L8.707 8l5.147 5.146a.5.5 0 01-.708.708L8 8.707l-5.146 5.147a.5.5 0 01-.708-.708L7.293 8 2.146 2.854z'/%3E%3C/svg%3E") 50% / contain no-repeat; }
.hafa-filter__tag:hover, .hafa-filter__tag:focus { background: #c7b8ad; color: #000; outline: none; }

/* ---- Mobile / tablet: "Suodata" button + off-canvas panel (hafa.fi breakpoint 1024px) ---- */
@media (max-width: 1023px) {
  .hafa-filter__actions { flex-wrap: wrap; }
  .hafa-filter__open { display: inline-flex; }
  .hafa-filter__panel { position: fixed; top: 0; left: 0; width: 300px; max-width: 88vw; height: 100vh; height: 100dvh; overflow-y: auto; overflow-x: hidden; background: #fefefe; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; z-index: 100000; box-shadow: 0 0 3px 1px rgba(0,0,0,.1); padding-bottom: 2.5rem; }
  .hafa-filter.is-open .hafa-filter__panel { transform: none; visibility: visible; }
  .hafa-filter__panel-head { display: flex; align-items: center; justify-content: space-between; padding: .3125rem 0 0 1.25rem; font-size: .875rem; text-transform: uppercase; font-weight: 600; }
  .hafa-filter__close { display: block; background: none; border: 0; padding: .9375rem; cursor: pointer; line-height: 1; }
  .hafa-filter__close::before { content: ""; display: inline-block; width: 1rem; height: 1rem; background: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M2.146 2.854a.5.5 0 11.708-.708L8 7.293l5.146-5.147a.5.5 0 01.708.708L8.707 8l5.147 5.146a.5.5 0 01-.708.708L8 8.707l-5.146 5.147a.5.5 0 01-.708-.708L7.293 8 2.146 2.854z'/%3E%3C/svg%3E") 50% no-repeat; }
  .hafa-filter__panel-tags { display: flex; flex-wrap: wrap; gap: .625rem; min-height: 1.875rem; padding: 0 .625rem; }
  .hafa-filter__groups { display: block; }
  .hafa-filter__group { margin: .9375rem 0 .3125rem; padding: 0 .625rem 0 1.25rem; }
  .hafa-filter__group-header { display: block; background: none; padding: 0; margin: 0 0 .3125rem; font-size: .875rem; text-transform: uppercase; font-style: italic; font-weight: 500; color: #111; cursor: default; border-radius: 0; }
  .hafa-filter__group-header:hover, .hafa-filter__group-header:focus { background: none; }
  .hafa-filter__group-header::after { display: none; }
  .hafa-filter__sublist { display: block; position: static; width: auto; max-width: none; border: 0; box-shadow: none; padding: 0; }
  .hafa-filter__sublist::before { display: none; }
  .hafa-filter__items { max-height: none; overflow: visible; }
  .hafa-filter__items.is-collapsible:not(.is-expanded) .hafa-filter__item:nth-child(n+6) { display: none; }
  .hafa-filter__show-more { display: block; background: none; border: 0; padding: 0 0 .25rem; font: inherit; font-size: .875rem; color: #c7b8ad; cursor: pointer; }
  .hafa-filter__show-more:hover { color: #b3a195; }
  .hafa-filter__select { display: none; }
  .hafa-filter__sort { width: 100%; justify-content: center; margin-top: 0; padding-top: 0; }
  body.hafa-filter-panel-open { overflow: hidden; }
}
