.filters-bar {
    margin: 0 0 1.5rem;
}

.filters-bar__form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;

    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    position: relative;
}

.filters-bar__group {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    position: relative;
    flex: 0 0 auto;
}

.filters-bar__group--sort {
    margin-left: auto;
    margin-top: 0.45rem;
}

.filters-bar__group--sort .filters-bar__select {
    min-width: 130px;
    min-height: 40px;
    padding-right: 2rem;
    font-size: 0.95rem;
}

.filters-bar__label {
    display: none;
}

.filters-bar__select {
    min-width: 70px;
    width: auto;
    min-height: 44px;
    padding: 0 2.2rem 0 0.9rem;
    border: 1px solid #d7e3f4;
    border-radius: 2px;
    background: #ffffff;
    color: var(--color-text);
    font: inherit;
    box-shadow: 0 2px 8px rgba(13, 36, 90, 0.04);
}

.filters-bar__select:focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 4px rgba(61, 123, 224, 0.12);
}

.filters-bar__actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.filters-bar__button {
    display: none;
}

.filters-bar__actions--icon,
.filters-bar__extras {
    display: flex;
    align-items: center;
}

.filters-bar__icon-button {
    min-width: 0;
    width: auto;
    min-height: 44px;
    padding: 0 0.9rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;

    background: #063195;
    border: 1px solid #063195;
    border-radius: 2px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(13, 36, 90, 0.04);

    transition:
        background 0.2s ease,
        transform 0.15s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.filters-bar__icon-button strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.filters-bar__icon-button span {
    display: block;
    width: 18px;
    height: 2.5px;
    background: #ffffff;
    border-radius: 999px;
    box-shadow:
        0 -6px 0 #ffffff,
        0 6px 0 #ffffff;
}

.filters-bar__icon-button:hover {
    background: #0d245a;
    border-color: #0d245a;
    transform: translateY(-1px);
}

.filters-bar__icon-button.is-open {
    background: #0d245a;
    border-color: #0d245a;
    transform: translateY(-1px);
}

/*filtros extra*/

.filters-bar__extras {
    position: static;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.filters-extras-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 6001;

    width: min(430px, calc(100vw - 1rem));
    max-width: 100%;
    height: 100dvh;
    padding: 1.25rem 1.25rem 1.5rem;

    background: #0d245a;
    color: #ffffff;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0;
    overflow-y: auto;

    transform: translate3d(100%, 0, 0);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;

    box-shadow: -12px 0 30px rgba(15, 23, 42, 0.14);
}

.filters-extras-panel.is-open {
    transform: translate3d(0, 0, 0);
}

body.filters-drawer-open {
    overflow: hidden;
}

.filters-extras-backdrop {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: rgba(23, 59, 143, 0.22);
    opacity: 0;
    transition: opacity 0.35s ease;
    will-change: opacity;
}

.filters-extras-backdrop.is-open {
    opacity: 1;
}

.filters-extras-panel__clear {
    display: inline-block;
    width: fit-content;
    margin: 1.2rem 0 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 0.98rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.filters-extras-panel__clear:hover {
    color: #ffffff;
}

.filters-extras-panel__close {
    position: absolute;
    top: 18px;
    right: 18px;

    width: 44px;
    height: 44px;
    z-index: 6002;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 0px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    cursor: pointer;

    font-size: 24px;
    line-height: 1;
    color: #173b8f;

    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.filters-extras-panel__close:hover {
    background: #f5f8ff;
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-1px);
}

.filters-extras-panel__grid {
    display: grid;
    gap: 1.15rem;
    margin-top: 4.4rem;
}

.filters-extras-panel__group {
    display: grid;
    gap: 0.85rem;
    padding: 1rem 1rem 1.05rem;
    border-radius: 2px;
    background: rgba(183, 132, 228, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.filters-extras-panel__label {
    display: inline-block;
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: #ffffff;
}

.filters-extras-panel__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.filters-extras-panel__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.filters-extras-panel__range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.filters-extras-panel__range input,
.filters-extras-panel input[type="text"] {
    width: 100%;
    min-height: 52px;
    padding: 0 1rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 2px;
    font: inherit;
    background: rgba(255, 255, 255, 0.96);
    color: #0e2d77;
    box-sizing: border-box;
}

.filters-extras-panel__range input::placeholder,
.filters-extras-panel input[type="text"]::placeholder {
    color: rgba(5, 24, 68, 0.595);
}

.filters-extras-panel__checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1rem;
}

.filters-extras-panel .filters-check {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.7rem;
    color: #ffffff;
    cursor: pointer;
}

.filters-extras-panel .filters-check input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    margin: 0.15rem 0 0;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    background: #ffffff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.filters-extras-panel .filters-check input[type="checkbox"]::after {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2px solid #0e2d77;
    border-bottom: 2px solid #0e2d77;
    transform: rotate(-45deg) scale(0);
    transform-origin: center;
    transition: transform 0.15s ease;
    margin-top: -1px;
}

.filters-extras-panel .filters-check input[type="checkbox"]:checked::after {
    transform: rotate(-45deg) scale(1);
}

.filters-extras-panel .filters-check span {
    color: #ffffff;
    line-height: 1.25;
}

.filters-extras-panel .filters-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.filters-extras-panel .filters-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.filters-extras-panel .filters-chip span {
    min-width: 44px;
    min-height: 38px;
    padding: 0 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.598);
    color: #0e2d77;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.filters-extras-panel .filters-chip:hover span {
    background: #ffffff;
    border-color: rgba(255, 255, 255, 0.45);
    transform: translateY(-2px);
}

.filters-extras-panel .filters-chip input:checked + span {
    background: #f3f7ff;
    color: #0e2d77;
    border-color: #ffffff;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.22),
        0 10px 24px rgba(7, 18, 46, 0.24);
    transform: translateY(-2px);
}


/* painéis dropdown */

.filters-bar__group--panel {
    position: relative;
}

.filters-panel {
    position: relative;
}

.filters-panel[open] {
    z-index: 50;
}

.filters-panel__summary {
    list-style: none;
    width: auto;
    min-width: 145px;
    max-width: 220px;
    min-height: 44px;
    padding: 0 2.2rem 0 0.9rem;
    border: 2px solid #0d245a;
    border-radius: 2px;
    background: #ffffff;
    color: #0d245a;
    font: inherit;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
    box-sizing: border-box;
    overflow: hidden;
    transition:
        border-color 0.1s ease,
        color 0.2s ease,
        transform 0.15s ease,
        background 0.2s ease;
}

.filters-panel__summary [data-summary-label] {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filters-panel__summary:hover {
    transform: translateY(-1px);
}

.filters-panel__summary::-webkit-details-marker {
    display: none;
}

.filters-panel__summary::after {
    content: "";
    position: absolute;
    right: 1rem;
    top: 50%;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-65%) rotate(45deg);
    transition: transform var(--transition-fast);
}

.filters-panel.is-active .filters-panel__summary {
    border-color: #063195;
    color: #063195;
    box-shadow: 0 0 0 1px #063195;
}

.filters-panel[open] .filters-panel__summary {
    border-color: currentColor;
    box-shadow: 0 0 0 1px currentColor, 0 8px 18px rgba(13, 36, 90, 0.08);
}

.filters-panel[open] .filters-panel__summary::after {
    transform: translateY(-35%) rotate(-135deg);
}

.filters-panel__options {
    position: absolute;
    top: calc(100% + 0.1rem);
    left: 0;

    width: max-content;
    min-width: 280px;
    max-width: 480px;

    max-height: 280px;
    overflow-y: auto;

    padding: 0.7rem;
    background: #fff;
    border: 2px solid #063195;
    border-radius: 2px;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
    transform: translateY(4px);
    animation: dropdownFade 0.18s ease;

    display: grid;
    gap: 0.35rem;
}

.filters-panel__search {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -0.15rem -0.15rem 0.35rem;
    padding: 0.15rem;
    background: #ffffff;
}

.filters-panel__search-input {
    width: 100%;
    min-height: 40px;
    padding: 0 0.75rem;
    border: 1px solid rgba(13, 36, 90, 0.18);
    border-radius: 2px;
    background: #ffffff;
    color: #0d245a;
    font: inherit;
    font-size: 0.92rem;
}

.filters-panel__search-input::placeholder {
    color: rgba(13, 36, 90, 0.5);
}

.filters-panel__search-input:focus {
    outline: none;
    border-color: #063195;
    box-shadow: 0 0 0 3px rgba(6, 49, 149, 0.1);
}

.filters-option.is-hidden-by-search,
.filters-option.is-hidden-by-location {
    display: none !important;
}

.filters-panel__manual-price {
    margin-bottom: 0.25rem;
}

.filters-panel__price-input {
    width: 100%;
    min-height: 42px;
    padding: 0 0.8rem;
    border: 1px solid rgba(13, 36, 90, 0.22);
    border-radius: 2px;
    background: #fff;
    color: #0d245a;
    font: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;

    /* UX melhor */
    text-align: left;
}

.filters-panel__price-input:focus {
    outline: none;
    border-color: var(--color-primary-500);
}

.active-filters {
    margin: -0.5rem 0 1.25rem;
    border-color: #063195
}

.active-filters__bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.active-filters__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.active-filters__chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 0.95rem;

    border: 1px solid rgba(13, 36, 90, 0.12);
    border-radius: 2px;

    background: #ffffff;
    color: #063195;

    font-size: 0.93rem;
    font-weight: 600;

    box-shadow: 0 2px 6px rgba(13, 36, 90, 0.06);
    
}

.active-filters__text {
    display: inline-block;
}

.active-filters__remove {
    margin-left: 0.55rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 18px;
    height: 18px;
    border-radius: 50%;

    font-size: 0.95rem;
    font-weight: 700;

    background: rgba(13, 36, 90, 0.08);
    color: #0d245a;
    text-decoration: none;

    transition: all 0.2s ease;
}

.active-filters__remove:hover {
    background: #0d245a;
    color: #ffffff;
    transform: scale(1.1);
}



.active-filters__chip.is-removing {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
    transition: 
        opacity 0.25s ease,
        transform 0.25s ease;
}

.active-filters__clear-all {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    min-height: 38px;

    color: #063195;
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;

    transition:
        opacity 0.2s ease,
        transform 0.15s ease;
}

.active-filters__clear-all:hover {
    opacity: 0.75;
    transform: translateY(-1px);
}


/* Chrome, Safari, Edge */
.filters-panel__price-input::-webkit-outer-spin-button,
.filters-panel__price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
.filters-panel__price-input {
    appearance: textfield;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(4px);
    }
}

.filters-option {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0px;
    cursor: pointer;
    transition:
        background 0.18s ease,
        transform 0.15s ease;
}

.filters-option:hover {
    background: #eef4ff;
    transform: translateX(2px);
}

.filters-option input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--color-primary-700);
    flex-shrink: 0;
}

.filters-option span {
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.2;
}


.listings-results__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.listings-results__count {
    margin: 0;
    color: #0d245a;
    font-size: 1.2rem;
    font-weight: 600;
}

.listings-results__sort {
    flex-shrink: 0;
}

.listings-results__sort .filters-bar__select {
    min-width: 145px;
    min-height: 36px;
    padding: 0 1.25rem 0 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    text-align: right;
    font-size: 0.98rem;
    font-weight: 400;
    color: #0d245a;
}

.listings-results__sort .filters-bar__select:focus {
    box-shadow: none;
}

/* responsivo */

@media (max-width: 1200px) {
    .filters-bar__group--sort {
        margin-left: 0;
        margin-top: 0;
    }

    .filters-extras-panel {
        width: min(430px, calc(100vw - 0.5rem));
        max-width: 100%;
    }
}

@media (max-width: 900px) {
    .filters-bar__form {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.35rem;
    }

    .filters-bar__group,
    .filters-bar__actions--icon,
    .filters-bar__extras {
        width: auto;
        flex: 0 0 auto;
    }

    .filters-bar__group--sort {
        margin-left: auto;
        margin-top: 0;
    }

    .filters-panel__summary,
    .filters-bar__icon-button,
    .filters-bar__select {
        width: auto;
        min-width: 0;
    }

    .filters-panel__summary {
        min-width: 120px;
        padding: 0 1.9rem 0 0.75rem;
        font-size: 0.92rem;
    }

    .filters-bar__icon-button {
        padding: 0 0.75rem;
    }

    .filters-bar__icon-button strong {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .filters-bar {
        position: relative;
        margin: 0 0 1.15rem;
        margin-top: 0rem;
        padding-top: 0rem;
        margin-bottom: 1rem;
    }
    
    .filters-bar__form {
        position: relative;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.55rem;
        align-items: stretch;
    }

    .filters-bar__group,
    .filters-bar__extras {
        width: 100%;
        min-width: 0;
    }

    .filters-bar__group--sort {
        display: none;
    }

    .filters-bar__icon-button,
    .filters-panel__summary {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        border-radius: 2px;
        box-shadow: none;
    }

    .filters-bar__icon-button {
        padding: 0 0.55rem;
        gap: 0.35rem;
        justify-content: center;
    }

    .filters-bar__icon-button strong {
        font-size: 0.84rem;
        font-weight: 700;
        line-height: 1;
    }

    .filters-bar__icon-button span {
        width: 11px;
        height: 2px;
        box-shadow:
            0 -3px 0 #ffffff,
            0 3px 0 #ffffff;
    }

    .filters-panel__summary {
        min-width: 0;
        padding: 0 1.45rem 0 0.65rem;
        font-size: 0.84rem;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .filters-panel__summary::after {
        right: 0.55rem;
        width: 6px;
        height: 6px;
        border-right-width: 1.5px;
        border-bottom-width: 1.5px;
    }

    .filters-bar__group--panel,
    .filters-panel {
        position: static;
    }

    .filters-panel[open] {
        z-index: 60;
    }

    .filters-panel__options {
        position: absolute;
        left: 0;
        right: 0;
        top: var(--mobile-dropdown-top, calc(100% + 0.12rem));
        z-index: 70;

        width: auto;
        min-width: 0;
        max-width: none;
        max-height: 240px;
        overflow-y: auto;

        margin-top: 0;
        padding: 0.6rem;

        background: #ffffff;
        border: 1px solid rgba(13, 36, 90, 0.1);
        border-radius: 2px;
        box-shadow: 0 16px 34px rgba(15, 23, 42, 0.16);
    }

    .filters-panel__search {
        grid-column: 1 / -1;
        margin: 0 0 0.35rem;
        padding: 0;
    }

    .filters-panel__search-input {
        min-height: 36px;
        font-size: 0.84rem;
    }

    /* por defeito: 2 colunas */
    .filters-panel:not(.filters-panel--single) .filters-panel__options {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.3rem 0.45rem;
    }

    /* preços: 1 coluna */
    .filters-panel--single .filters-panel__options {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    /* distrito, concelho e freguesia: 1 coluna */
    .filters-bar__group--district .filters-panel__options,
    .filters-bar__group--municipality .filters-panel__options,
    .filters-bar__group--parish .filters-panel__options {
        grid-template-columns: 1fr;
    }

    .filters-option {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        min-height: 36px;
        padding: 0.45rem 0.5rem;
        border-radius: 2px;
    }

    .filters-option:hover {
        background: #f5f8ff;
    }

    .filters-option input {
        width: 18px;
        height: 18px;
        margin: 0;
        flex-shrink: 0;
        accent-color: #0d245a;
    }

    .filters-option span {
        font-size: 0.82rem;
        line-height: 1.2;
        color: #0d245a;
        word-break: break-word;
    }

    .filters-panel__manual-price {
        margin-bottom: 0.2rem;
    }

    .filters-panel__price-input {
        min-height: 36px;
        padding: 0 0.7rem;
        border-radius: 2px;
        font-size: 0.86rem;
    }

    .filters-extras-panel {
        width: min(420px, 100%);
        max-width: 100%;
        padding: 1rem 1rem 1.5rem;
    }

    .filters-extras-panel__close {
        right: 16px;
    }

    .filters-extras-panel__clear {
        font-size: 0.90rem;
    }

    .filters-extras-panel__checks {
        grid-template-columns: 1fr;
    }

    .listings-results__meta {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
    }

    .listings-results__count {
        margin: 0;
        font-size: 0.98rem;
        line-height: 1.2;
        font-weight: 700;
    }

    .listings-results__sort .filters-bar__select {
        min-width: 122px;
        min-height: 30px;
        padding: 0 0.95rem 0 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        text-align: right;
        font-size: 0.9rem;
        font-weight: 600;
        line-height: 1.2;
        color: #0d245a;
    }

    .listings-results__sort .filters-bar__select:focus {
        box-shadow: none;
    }

    .active-filters__list {
        display: none;
    }

    .active-filters {
        margin: 0 0 0.75rem;
    }

    .active-filters__bar {
        justify-content: flex-end;
    }

    .active-filters__clear-all {
        min-height: auto;
        font-size: 0.86rem;
        font-weight: 700;
    }
}