.catalogue-container {
    width: 100%;
    padding: 2.5rem 0;
}

.filter-bar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: #fff;
    border-radius: 5rem;
    box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.10);
    margin-bottom: 3.125rem;
    width: 100%;
    padding: 0;
}

.filters-left-side {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    flex-grow: 1;
}

.filters-right-side {
    display: flex;
    align-items: stretch;
    padding: 1rem;
}

.custom-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

.custom-dropdown:not(:last-of-type)::after {
    content: "";
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background-color: #D6CFC6;
    transition: opacity 0.2s ease;
    z-index: 1;
}

.custom-dropdown.active::after,
.custom-dropdown:hover::after {
    opacity: 0;
}

.custom-dropdown:has(+ .custom-dropdown.active)::after,
.custom-dropdown:has(+ .custom-dropdown:hover)::after {
    opacity: 0;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    padding: 1.875rem 1.875rem;
    background: transparent;
    border-radius: 4rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.125rem;
    font-weight: 500;
    border: 1px solid transparent;
    user-select: none;
    height: 100%;
}

.dropdown-trigger span {
    margin-left: 0.438rem;
    margin-right: 1.563rem;
}


@media screen and (min-width: 1119px) and (max-width: 1727px) {
    .dropdown-trigger,
    .detail-item, 
    .price-tag {
        font-size: 0.938rem;
    }
    .house-title-link {
        font-size: 1.563rem;
    }
    .card-divider {
        margin-bottom: 1.25rem;
        margin-top: 1.25rem;
    }
}



.dropdown-trigger:hover {
    background: #F9F5F0 !important;
    box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.07) !important;
}

.dropdown-trigger:active {
    background: #F9F5F0 !important;
}

.filter-bar:has(.custom-dropdown.active) {
    background: #F9F5F0 !important;
}

.custom-dropdown.active .dropdown-trigger {
    background: #fff;
    border-color: #eee;
    box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.07);
}

.dropdown-icon-box {
    width: 1.25rem;
    height: 1.25rem;
    background: #D6CFC6;
    border-radius: 0.25rem;
}

/* Trigger boxes now hold a real SVG icon, so drop the placeholder square
   background and let the icon fill the box. */
.dropdown-trigger .dropdown-icon-box {
    background: none;
    border-radius: 0;
}

.dropdown-trigger .dropdown-icon-box svg {
    display: block;
    width: 100%;
    height: 100%;
}

.dropdown-menu .dropdown-icon-box {
    width: 2.188rem;
    height: 2.188rem;
}

@media (max-width: 1119px) {
    .dropdown-icon-box {
        display: none;
    }
}

.arrow-icon {
    width: 1.063rem;
    transition: transform 0.3s ease;
}

.custom-dropdown.active .arrow-icon {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    box-sizing: border-box;
    width: 100%;
    top: calc(100% + 0.625rem);
    left: 0;
    background: #fff;
    border-radius: 2.5rem;
    border: 1px solid #eee;
    box-shadow: 0 1rem 2.5rem rgba(0,0,0,0.1);
    padding: 0.75rem;
    display: none;
    z-index: 20 !important;
    opacity: 0;
    transform: translateY(0.625rem);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (max-width: 1440px) {
    .dropdown-menu {
        border-radius: 0.625rem;
        padding: 0.625rem;
    }
}

.custom-dropdown.active .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.625rem 0.5rem;
    border-radius: 2.5rem;
    cursor: pointer;
    transition: background 0.2s ease;
    text-decoration: none;
    color: #333;
    font-size: 0.938rem;
}

@media (min-width: 1728px) {
    .dropdown-item {
        font-size: 1.125rem;
    }
}

.dropdown-item:hover { background: #f9f6f2; }
.dropdown-item.selected { background: #eee; font-weight: 600; }

.clear-link {
    padding: 1rem 1.5rem;
    font-size: 1rem;
    color: #333;
    text-decoration: none;
    background: #F9F5F0;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.12);
    border-radius: 4rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.clear-link:hover {
    background: #fff;
    border-color: #eee;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.clear-icon {
    -webkit-text-stroke: 1px;
    display: flex;
}

.house-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(28%, 1fr));
    gap: 1.875rem;
}

.house-card {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.image-container-relative {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
    z-index: 5;
}

.house-image-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.75rem;
    overflow: hidden;
}

.house-image-wrapper img {
    width: 100%;
    height: 100% !important;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.house-card:hover .house-image-wrapper img { transform: scale(1.05); }

.card-labels {
    position: absolute;
    bottom: -1.5rem;
    right: 0.75rem;
    display: flex;
    gap: 0.69rem;
    z-index: 99;
}

.card-label {
    background: #F9F5F0;
    padding: 0.4rem 1.1rem;
    border-radius: 2rem;
    font-size: 0.938rem;
    font-weight: 400;
    color: #000;
    border: 1px solid #eee;
    box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
}

.card-label:hover {
    background: #DEDED6;
}

.house-card h3 {
    font-size: 1.875rem !important;
    line-height: 1.2 !important;
    font-weight: 500 !important;
    margin: 0;
}

.card-divider {
    height: 1px;
    background-color: #00000033;
    width: 100%;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 1119px) {
    .card-divider {
        margin-bottom: 1.125rem;
        margin-top: 0.875rem;
    }
}

.house-details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.125rem;
    color: #000;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.house-title-link {
    color: inherit;
    text-decoration: none;
}

@media (max-width: 1119px) {
    .house-details-row {
        font-size: 1rem;
    }
}

.details-left {
    display: flex;
    gap: 1.25rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 1119px) {
    .detail-item {
        gap: 0.375rem;
    }
}

.detail-item span {
    width: 1.25rem;
    height: 1.25rem;
}

.price-tag {
    font-weight: 500;
}

.mobile-filter-trigger {
    display: none;
    width: 100%;
    background: #fff;
    border: 1px solid #eee;
    padding: 1rem;
    border-radius: 5rem;
    font-size: 1.25rem;
    font-weight: 500;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-bottom: 2rem;
    box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.10);
}

.mobile-filter-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    z-index: 9999;
    display: none;
    padding: 1rem;
    box-sizing: border-box;
}

.mobile-filter-popup.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.filter-popup-content {
    background: #F9F6F2;
    width: 100%;
    max-width: 450px;
    border-radius: 2rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: visible !important;
    box-shadow: 0 0 3px 1px rgba(0, 0, 0, 0.10);
}

.filter-popup-content .header-left {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.25rem;
}

.popup-header {
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.popup-header-box {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 1.5rem 0;
    border-bottom: 1px solid #00000033;
}

.close-popup {
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-body {
    padding: 2rem 1.5rem;
    overflow-y: auto;
    overflow-x: visible;
    flex-grow: 1;
}

.popup-body .dropdown-icon-box {
    display: none;
}

.popup-body .dropdown-trigger,
.popup-body .dropdown-item {
    font-size: 1rem;
}

.dropdown-menu .dropdown-icon-box {
  display: none !important;
}

.popup-body .custom-dropdown {
    width: 100%;
}

.popup-body .custom-dropdown::after {
    display: none;
}

.popup-body .filters-left-side {
    display: flex;
    flex-direction: column !important;
    gap: 1rem;
}

.popup-body .dropdown-trigger {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 0.75rem;
    padding: 0.313rem !important;
    width: 100%;
}

.popup-body .dropdown-trigger span {
    padding: 0 0.5rem;
}


.popup-body .dropdown-trigger .arrow-icon {
    background-color: #F9F5F0 !important;
    color: rgba(15, 15, 16, 0.5);
    border-radius: 0.438rem;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 2.313rem !important;
    height: 2.313rem !important;
    padding: 0.75rem !important;
}

.popup-body .dropdown-trigger .arrow-icon svg,
.popup-body .dropdown-trigger .arrow-icon img {
    width: 0.813rem !important;
    height: 0.813rem !important;
    display: block;
}

.popup-body .dropdown-trigger svg.arrow-icon path[stroke-width] {
    stroke-width: 2 !important;
}

.popup-body .dropdown-menu {
    position: absolute;
    z-index: 10005 !important;
    width: 100%;
    left: 0;
    top: 100%;
}

.popup-footer {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
    flex-shrink: 0;
    z-index: 100;
}

.popup-footer .clear-btn {
    padding: 1rem 1.25rem;
    justify-content: space-between;
}

.clear-icon-mobile {
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-icon-mobile svg {
    width: 0.938rem;
    height: 0.938rem;
}

.apply-btn {
    flex: 2;
    background: #0F0F10 !important;
    color: #fff !important;
    border: none;
    padding: 1rem;
    border-radius: 5rem;
    font-size: 1rem;
    font-weight: normal;
    cursor: pointer;
}

.clear-btn {
    flex: 1;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    gap: 1rem;
    font-size: 1rem;
    border-radius: 60px;
    background: #F9F5F0;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.12);
}

@media (max-width: 1200px) {
    .house-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 3rem;
    }
}
@media screen and (min-width: 1280px) and (max-width: 1727px) {
    .house-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 1420px) {
    .mobile-filter-trigger { display: flex; }
    .filter-bar { display: none !important; }
    
}
@media (min-width: 1420px) {
    .dropdown-item {
        padding: 0.625rem 1rem 0.625rem 2.688rem;
    }
}

@media (max-width: 767px) {
    .house-grid { grid-template-columns: 1fr !important; }
    .mobile-filter-trigger { margin-bottom: 3.125rem;}
}

/* Töölaual täielikult peidetud */
.fixed-mobile-filter-btn {
  display: none !important;
}

/* Mobiilivaates (alla 1119px) */
@media (max-width: 1119px) {
  .fixed-mobile-filter-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed !important;
    top: 0.625rem;                   
    right: 1.563rem;                 
    width: 3.5rem;                  
    height: 3.5rem;
    border-radius: 50% !important;
    
    background: transparent;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    
    z-index: 99999;   
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, background-color 0.2s ease;

    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateY(-10px) scale(0.9);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;
  }

  .fixed-mobile-filter-btn:active {
    transform: scale(0.92);
  }

  .fixed-mobile-filter-btn.is-visible {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) scale(1);
  }
}

body:has(#filterPopup.active) .fixed-mobile-filter-btn,
body:has(.mobile-filter-popup.active) .fixed-mobile-filter-btn {
  display: none !important;
}