/*
 * The Finmarket filter panel shared by every product list (loans, deposits, cards, accounts,
 * payments & transfers, diaspora): the white card holding the filter fields, the active filter
 * chips underneath and the results count with the "Renditur sipas" dropdown.
 *
 * Page stylesheets (loans.css, deposits.css, …) still own the result rows below the panel.
 */

.dep-filters-panel {
    position: relative;
    border: 2px solid rgba(109, 54, 30, 0.16);
    border-radius: 32px;
    padding: 28px 36px;
    margin-bottom: 3rem;
    box-shadow: 0 18px 50px rgba(109, 54, 30, 0.1);
    box-sizing: border-box;
}

    /* Frosted rather than solid: the panel is tinted with the brand cream at low opacity and blurred, so the
       page's hero image reads through it instead of being cut out by a white card.
       The frost lives on a pseudo-element rather than on .dep-filters-panel itself because backdrop-filter
       creates a stacking context, which would trap the sort and bank dropdowns inside the panel and let the
       result cards' info points paint over them. */
    .dep-filters-panel::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: -1;
        border-radius: inherit;
        -webkit-backdrop-filter: blur(10px) saturate(1.1);
        backdrop-filter: blur(12px);
    }

/* Browsers without backdrop-filter would show the flat 45% tint over the image, which is too faint to
   read against; they get a denser fill instead. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .dep-filters-panel::before {
        background: rgba(254, 252, 245, 0.9);
    }
}

/* The field row: every filter grows evenly, the submit button keeps its own width. */
.dep-filters-panel .dep-filters {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

/* .dep-filter__field is a column flexbox with its own gap, so the label only clears its inherited padding. */
.dep-filters-panel .dep-filter__label {
    padding: 0;
    margin: 0;
    color: var(--color-brand);
    font-size: 15px;
    line-height: 1.2;
}

/* Every control inside the panel reads in the brand brown rather than the lighter mid tone the page
   stylesheets set, which the frosted background would otherwise wash out. */
.dep-filters-panel .dep-filter__input,
.dep-filters-panel .dep-filter__icon,
.dep-filters-panel .dep-filter__suffix,
.dep-filters-panel .hp-custom-select__trigger,
.dep-filters-panel .hp-custom-select__option {
    color: var(--color-brand);
}

    .dep-filters-panel .dep-filter__input::placeholder {
        color: var(--color-brand);
        opacity: 0.65;
    }

.dep-filters-panel .dep-filters .hp-btn {
    width: auto;
    min-width: 150px;
    flex: 0 0 auto;
}

/* ── Second row: active filters on the left, result count + sorting on the right ── */

.dep-filters__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid rgba(109, 54, 30, 0.14);
}

.dep-active-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

    .dep-active-filters[hidden] {
        display: none;
    }

.dep-active-filters__label {
    color: var(--color-brand);
    font-size: 15px;
}

.dep-active-filters__list {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* The id beats the "#depSearch, #depClear { width: 160px }" button rule the page stylesheets still carry
   for the search button, which the clear link used to share. */
.dep-filters__bar #depClear,
.dep-active-filters__clear {
    width: auto;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-brand);
    font: inherit;
    font-size: 15px;
    text-decoration: underline;
    cursor: pointer;
}

    .dep-active-filters__clear:hover {
        color: var(--color-brand-mid);
    }

.dep-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 16px;
    border-radius: 30px;
    background: rgba(173, 96, 58, 0.1);
    color: var(--color-brand);
    font-size: 15px;
    line-height: 1.3;
    max-width: 100%;
}

.dep-chip__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dep-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(109, 54, 30, 0.12);
    color: var(--color-brand);
    cursor: pointer;
    transition: background 0.15s;
}

    .dep-chip__remove:hover {
        background: rgba(109, 54, 30, 0.24);
    }

    .dep-chip__remove svg {
        width: 11px;
        height: 11px;
    }

.dep-results-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

    /* The count lives inside the panel now, so it drops the standalone spacing it had above the list. */
    .dep-results-meta .dep-results-count {
        margin: 0;
        padding: 0;
        color: var(--color-brand);
        font-size: 15px;
        font-weight: var(--fw-bold, 700);
    }

.dep-results-meta__sep {
    color: var(--color-brand);
}

/* The count hides itself while empty (see site.css), so the separator has to follow it. */
.dep-results-count:empty + .dep-results-meta__sep {
    display: none;
}

/* ── "Renditur sipas" dropdown ── */

.dep-sort {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.dep-sort__prefix {
    color: var(--color-brand);
    font-size: 15px;
}

.dep-sort__trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    border: 1.5px solid var(--color-brand-mid);
    border-radius: 30px;
    background: transparent;
    color: var(--color-brand);
    font: inherit;
    font-size: 15px;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

    .dep-sort__trigger:hover {
        border-color: var(--color-brand);
        background: rgba(173, 96, 58, 0.06);
    }

.dep-sort__chevron {
    display: inline-flex;
    flex-shrink: 0;
}

    .dep-sort__chevron svg {
        width: 15px;
        height: 15px;
        transition: transform 0.25s ease;
    }

.dep-sort--open .dep-sort__chevron svg {
    transform: rotate(180deg);
}

.dep-sort__panel {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 140;
    min-width: max(100%, 280px);
    max-width: min(420px, 90vw);
    padding: 8px 0;
    /* Opaque, unlike the panel behind it: a dropdown has to stay readable over whatever the hero image
       happens to be showing underneath. */
    background: var(--color-white, #fbfbfb);
    border: 1px solid rgba(109, 54, 30, 0.12);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(109, 54, 30, 0.16);
}

.dep-sort--open .dep-sort__panel {
    display: block;
}

.dep-sort__option {
    display: block;
    width: 100%;
    padding: 11px 22px;
    border: none;
    background: transparent;
    color: var(--color-brand);
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

    .dep-sort__option:hover {
        background: rgba(109, 54, 30, 0.06);
    }

.dep-sort__option--selected {
    font-weight: 600;
}

/* ── Bank multi-select ── */

.dep-bank-select {
    position: relative;
    display: block;
}

/* Padding, border and line height mirror .hp-custom-select__trigger so the "Banka" pill lines up with the
   other filter fields, which the row aligns on their bottom edge. */
.dep-bank-select__trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 18px;
    border: 2px solid var(--color-brand);
    border-radius: 30px;
    background: transparent;
    color: var(--color-brand);
    font: inherit;
    font-size: 16px;
    line-height: var(--lh-body, 1.65);
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

    .dep-bank-select__trigger:hover {
        border-color: var(--color-brand-mid);
    }

.dep-bank-select__label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dep-bank-select__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    flex-shrink: 0;
    padding: 0 7px;
    border-radius: 12px;
    background: var(--color-brand);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-sizing: border-box;
}

    .dep-bank-select__badge[hidden] {
        display: none;
    }

.dep-bank-select__chevron {
    display: inline-flex;
    flex-shrink: 0;
}

    .dep-bank-select__chevron svg {
        width: 16px;
        height: 16px;
        transition: transform 0.25s ease;
    }

.dep-bank-select--open .dep-bank-select__chevron svg {
    transform: rotate(180deg);
}

/* Wider than the trigger, so the longer bank names fit without being clipped. */
.dep-bank-select__panel {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    z-index: 150;
    min-width: max(100%, 400px);
    max-width: min(440px, 88vw);
    padding: 14px 0 8px;
    /* Opaque for the same reason as the sort panel: the bank list has to stay readable over the hero image. */
    background: var(--color-white, #fbfbfb);
    border: 1px solid rgba(109, 54, 30, 0.12);
    border-radius: 22px;
    box-shadow: 0 16px 48px rgba(109, 54, 30, 0.18);
}

.dep-bank-select--open .dep-bank-select__panel {
    display: block;
}

.dep-bank-select__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 22px 12px;
}

.dep-bank-select__count {
    color: var(--color-brand);
    font-size: 15px;
}

.dep-bank-select__link {
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-brand);
    font: inherit;
    font-size: 15px;
    text-decoration: underline;
    cursor: pointer;
}

    .dep-bank-select__link:hover {
        color: var(--color-brand-mid);
    }

.dep-bank-select__list {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-brand-mid) transparent;
}

    .dep-bank-select__list::-webkit-scrollbar {
        width: 8px;
    }

    .dep-bank-select__list::-webkit-scrollbar-thumb {
        background: rgba(109, 54, 30, 0.4);
        border-radius: 4px;
    }

.dep-bank-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 22px;
    color: var(--color-brand);
    cursor: pointer;
    transition: background 0.15s;
}

    .dep-bank-option:hover {
        background: rgba(109, 54, 30, 0.05);
    }

.dep-bank-option__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dep-bank-option__box {
    position: relative;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    box-sizing: border-box;
    border: 1.5px solid var(--color-brand);
    border-radius: 6px;
}

.dep-bank-option__input:checked + .dep-bank-option__box {
    background: var(--color-brand);
}

    .dep-bank-option__input:checked + .dep-bank-option__box::after {
        content: "";
        position: absolute;
        left: 7px;
        top: 3px;
        width: 5px;
        height: 10px;
        border: solid #fff;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
    }

.dep-bank-option__input:focus-visible + .dep-bank-option__box {
    outline: 2px solid var(--color-brand-mid);
    outline-offset: 2px;
}

.dep-bank-option__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 10px;
    background: rgba(173, 96, 58, 0.14);
    color: var(--color-brand);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.dep-bank-option__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dep-bank-option__count {
    flex-shrink: 0;
    color: var(--color-brand);
    font-size: 15px;
}

/* ── Responsive ── */

@media (max-width: 1100px) {
    .dep-filters-panel {
        padding: 24px 24px;
        border-radius: 26px;
    }

    .dep-filters-panel .dep-filters .hp-btn {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .dep-filters-panel {
        padding: 20px 18px;
        border-radius: 22px;
    }

        .dep-filters-panel .dep-filters {
            gap: 14px;
        }

    .dep-filters__bar {
        align-items: flex-start;
        flex-direction: column;
        margin-top: 18px;
        padding-top: 18px;
    }

    .dep-results-meta {
        margin-left: 0;
    }

    .dep-sort {
        flex-wrap: wrap;
    }

    .dep-sort__panel {
        left: 0;
        right: auto;
    }

    .dep-bank-select__panel {
        min-width: 0;
        max-width: none;
        right: 0;
    }
}
