.flats-table {
    position: relative;
    width: 100%;
    overflow: hidden;
    .flats-table-header {
        background-color: var(--paletteColor2);
        .flats-table-row {
            border: 0;
        }
        .flats-table-cell {
            padding: 30px 16px;
            font-size: 18px;
            line-height: 1;
            font-weight: 700;
            flex-direction: column;
            text-align: center;
            color: #fff;
            @media (max-width: 1499px) {
                padding: 30px 6px;
                font-size: 16px;
            }
        }
        .filterable {
            select {
                text-align: center;
                padding: 0;
                appearance: none;
                border: 1px solid rgba(255, 255, 255, 0.2);
                background-color: rgba(255, 255, 255, 0);
                color: #ffffff;
                font-size: 18px;
                font-weight: 700;
                padding: 10px 8px;
                transition: ease 0.4s all;
                cursor: pointer;
                @media (max-width: 1499px) and (min-width: 768px) {
                    font-size: 16px;
                }
                &.active {
                    background-color: var(--paletteColor1);
                    border-color: var(--paletteColor1);
                }
                &:hover {
                    border-color: var(--paletteColor1);
                }
                option {
                    background-color: #fff;
                    color: var(--txt);
                }
            }
        }
        .sortable {
            position: relative;
            &:not(.filterable) {
                cursor: pointer;
                &:hover {
                    .sort-icon {
                        color: var(--paletteColor1);
                        &:after {
                            opacity: 1;
                        }
                    }
                }
            }
            .sort-icon {
                cursor: pointer;
                user-select: none;
                position: relative;
                transition: ease 0.3s all;
                flex-direction: column;
                position: absolute;
                width: 100%;
                bottom: 0;
                color: #ffffff;
                text-align: center;
                &:hover {
                    color: var(--paletteColor1);
                }
                &::after {
                    transition: ease 0.3s all;
                    content: '▲▼';
                    opacity: 0.5;
                    font-size: 14px;
                }
            }

            &.asc .sort-icon::after {
                content: '▲';
                opacity: 1;
            }

            &.desc .sort-icon::after {
                content: '▼';
                opacity: 1;
            }
        }

        &.is-sticky {
            position: fixed;
            z-index: 1000;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
    }

    .flats-table-body {
        > div:last-of-type {
            .flats-table-row {
                @media (min-width: 767px) {
                    border: 0;
                }
            }
        }
        > .active {
            .flats-table-row {
                background: var(--paletteColor5);
            }
        }
        .flats-table-row {
            position: relative;
            border-bottom: 1px solid var(--hr-color);
            transition: ease 0.3s all;
            &:hover, &.active {
                background: var(--paletteColor5)
            }
            .page-link {
                position: absolute;
                width: 100%;
                height: 100%;
                left: 0;
                top: 0;
            }
        }
    }
    .flat-container {
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        transition: ease 0.3s all;
        @media (max-width: 991px) {
            margin-left: 0;
            margin-right: 0;
        }
        &:hover {
            background-color: rgba(0, 0, 0, 0.05);
        }
    }

    .flats-table-row {
        display: flex;
        border-bottom: 1px solid  var(--hr-color);
    }


    .flats-table-cell {
        flex: 1;
        padding: 12px 16px;
        display: flex;
        align-items: center;
        min-width: 0;
        justify-content: center;
        @media (max-width: 1499px) {
            padding: 12px 6px;
        }
        @media (max-width: 700px) and (min-width: 460px) {
            flex-direction: column;
            text-align: center;
        }
        @media (max-width: 360px) {
            flex-direction: column;
            text-align: center;
        }
        &.has-revisions {
            z-index: 2;
            position: relative;
        }
        &[data-label="Status"] {
            display: flex;
            align-items: center;
        }
        &[data-field="more"], &[data-field="card"], &[data-field="contact"], &[data-field="vr"], &[data-field="page"] {
            z-index: 1;
        }
        .button {
            @media (max-width: 700px) and (min-width: 460px) {
                margin: 0 auto;
            }
            @media (max-width: 460px) {
                margin: 0 auto;
            }
            svg {
                width: 20px;
                height: 20px;
            }
        }
        &[data-field="card"], &[data-field="contact"] {
            @media (max-width: 1499px) and (min-width: 992px) {
                max-width: 80px;
                .button {
                    font-size: 0;
                    column-gap: 0;
                }
            }
        }
        &[data-field="page"], &[data-field="rooms"], &[data-field="floor"] {
            @media (max-width: 1499px) and (min-width: 768px) {
                max-width: 100px;
            }
        }
        &[data-field="includes"]{
            flex-direction: column;
        }
        [data-popup="price-history"] {
            display: flex;
            flex-direction: row-reverse;
            column-gap: 3px;
            .label {
                svg {
                    transition: ease 0.3s all;
                    width: 17px;
                    height: 17px;
                    fill: #53575E;
                    opacity: 0.7;
                }
            }
        }
        .price {
            display: flex;
            flex-direction: column;
            text-align: center;
            small {
                font-size: 14px;
                line-height: 1;
            }
        }
    }

    .flats-table-pagination {
        margin-top: 30px;
        justify-content: center;
        .button {
            padding: 10px;
            min-width: 42px;
        }
    }

    .flats-table-empty {
        padding-top: 20px;
        padding-bottom: 20px;
        text-align: center;
    }

    &.dim-sold-flats .flats-table-body .flats-table-row.sold {
        opacity: 0.5;
        background-color: #f0f0f0;
        
        .flats-table-cell {
            color: #888;
        }

        .contact-button {
            background-color: #ccc;
            cursor: not-allowed;
            &:hover {
                background-color: #ccc;
            }
        }
    }

    &.color-accent .flats-table-body .flats-table-row {
        position: relative;
        
        &::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
        }

        &.available::before,&.forrent::before,&.forsale::before { background-color: #28a745; }
        &.sold::before { background-color: #dc3545; }
        &.reservation::before { background-color: #ef6c00; }
        &.soon::before { background-color: #17a2b8; }
        &.rented::before { background-color: #6c757d; }
    }

    &.group-by-status .status-group {
        @media (min-width: 768px) {
            grid-column: -1/1;
            display: grid;
            grid-template-columns: 1fr 1fr;
        }
        @media (max-width: 460px) {
            grid-template-columns: 100%;
        }
        
        .status-header {
            font-weight: bold;
            padding: 10px;
            background-color: var(--paletteColor1);
            border-bottom: 1px solid var(--paletteColor1);
            border-top: 1px solid var(--paletteColor1);
            display: flex;
            align-items: center;
            color: #fff;
            @media (max-width: 991px) {
                grid-column: -1/1;
            }
            .status-dot {
                width: 12px;
                height: 12px;
                border-radius: 50%;
                margin-right: 10px;

                &.available,&.forrent,&.forsale { background-color: #28a745; }
                &.reservation { background-color: #ef6c00; }
                &.sold { background-color: #dc3545; }
                &.soon { background-color: #17a2b8; }
                &.rented { background-color: #6c757d; }
            }
        }
    }

    .status-dot {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin-right: 6px;

        &.available,&.forrent,&.forsale { background-color: #28a745; }
        &.reservation { background-color: #ef6c00; }
        &.sold { background-color: #dc3545; }
        &.soon { background-color: #17a2b8; }
        &.rented { background-color: #6c757d; }
    }

    .flat-excerpt {
        padding: 15px;
        background-color: #f9f9f9;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
        margin-top: -1px;
        font-size: 0.9em;
        line-height: 1.5;
    }

    .row-link {
        display: contents;
        color: inherit;
        text-decoration: none;

        &:hover {
            text-decoration: none;
        }
    }

    .no-link-override {
        position: relative;
        z-index: 1;
    }

    @media (max-width: 991px) {
        .flats-table-body {
            display: grid;
            grid-template-columns: 1fr 1fr;
        }
        .flats-table-row {
            flex-direction: column;
            border-bottom: 1px solid #e0e0e0;
            padding: 10px 0;
        }

        .flats-table-cell {
            justify-content: space-between;
            border-bottom: none;
            padding: 5px 16px;
            .button {
                min-width: 120px;
            }
            &:before {
                content: attr(data-label);
                font-weight: bold;
                width: 120px;
                min-width: 120px;
                display: inline-block;
                flex: 1;
            }
        }

        .flats-table-header {
            .flats-table-row {
                display: grid;
                grid-template-columns: 1fr 1fr;
            }
            .flats-table-cell {
                padding: 10px;
                &:not(.filterable) {
                    display: none;
                }
                &:after, &:before {
                    display: none;
                }
                .sort-icon {
                    display: none;
                }
                select {
                    font-weight: 400;
                    font-size: 16px;
                    width: 100%;
                    padding: 10px;
                }
            }
        }
    }
    @media (max-width: 460px) {
        .flats-table-body {
            grid-template-columns: 100%;
        }
    }
}
