:root {
    --bg-primary: #5a63c6;
    --bg-light: #f6efe8;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --accent: #6cc070;
    --white: #ffffff;
    --radius: 12px;
}

/* LAYOUT */
.container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

.single-flats .container { max-width: inherit; }

/* FILTERS */
.apartments-filters { background: var(--bg-primary); color: var(--white); padding: 32px 0 28px; }
.apartments-title { font-size: 48px; font-weight: 800; margin-bottom: 24px; padding-top: 4vw; }
.filters { display: flex; flex-direction: column; gap: 20px; }
.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}
.filter label { display: block; font-size: 13px; opacity: .85; margin-bottom: 8px; }

/* ROOMS */
.filter-rooms .rooms { display: flex; gap: 8px; flex-wrap: wrap; }
.rooms label { cursor: pointer; }
.rooms input { display: none; }
.rooms span {
    display: inline-flex; align-items: center; justify-content: center;
    height: 40px; min-width: 40px; padding: 0 14px;
    border-radius: 999px; border: 1px solid rgba(255,255,255,0.4);
    font-size: 14px; transition: .2s;
}
.rooms input:checked + span { background: var(--white); color: var(--bg-primary); font-weight: 600; }

/* SUBMIT */
.filters-submit {
    padding: 16px 15px;
    border-radius: 12px;
    background: var(--accent);
    border: none;
    cursor: pointer;
    white-space: normal;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    max-width: 120px;
    text-align: center;
    font-size: 16px;
    color: var(--white);
}

/* BOTTOM ROW */
.sort-position {
    display: flex;
    align-items: center;
}
.sort-position select:open {
    background: #ffffff;
    border-radius: 0;
    border: none;
    padding: 10px 10px;
    max-width: 185px;
    width: 185px;
}
.sort-position select::picker-icon{
    display: none;
}
.sort-position svg{
    margin-left: 10px;
}
.sort-position select:open option{
    background: #ffffff;
}

.filters-bottom {
    display: flex;
    justify-content: space-between;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.filters-bottom select {
    border-radius: 999px;
    border: none;
    max-width: 210px;
}

/* SWITCH */
.switch { display: none; }
/*.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }*/
.switch input { display: none; }
.switch span { width: 40px; height: 16px; background: #9ca3af; border-radius: 999px; position: relative; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; background: #ffffff; border-radius: 50%; top: -2px; left: -2px; transition: .2s; }
.switch input:checked + span { background: var(--bg-primary); }
.switch input:checked + span::after { background: var(--accent); transform: translateX(20px); left: 2px }

/* GRID */
.apartments-grid { padding: 40px 0 64px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 35px; }

/* CARD */
.apartment-plan {
    border-radius: 16px;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1vw;
}
.apartment-plan img { max-width: 100%; max-height: 100%; }

.apartment-meta {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    row-gap: 10px;
    column-gap: 20px;
}
.apartment-meta small { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px;}
.apartment-meta strong { font-size: 15px; font-weight: 700; color: var(--text-dark); }

/* RESPONSIVE */
@media (max-width: 1200px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .grid { grid-template-columns: 1fr; } }

/* SLIDERS */
.slider { margin-top: 20px; }
.slider-values { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; opacity: .9; margin-top: 6px; }
.slider-values b { letter-spacing: .2px; }

/* noUi overrides */
body .noUi-target { background: rgba(255,255,255,0.3); border: none; height: 2px; border-radius: 999px; }
.noUi-connect { background: #ffffff; }
.noUi-horizontal .noUi-handle {
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: var(--bg-primary); border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    top: 50%;
    right: 0;
    transform: translateY(-47%) translateX(50%);
    cursor: pointer;
}
.noUi-handle::before, .noUi-handle::after { display: none; }

/* Pagination */
.riel-pagination { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 22px; }
.riel-pagination .page-numbers{
    width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(31,41,55,.2);
    background: transparent;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
}
.riel-pagination .page-numbers.current{
    background: var(--bg-primary);
    border-color: var(--bg-primary);
    color: var(--white);
}
.riel-pagination .page-numbers.dots{
    border-color: transparent;
    background: transparent;
    width: auto;
    padding: 0 6px;
}

.apartments-filters .filter.noui-slider {
    max-width: 280px;
    width: 100%;
}

.riel-page .container {
    max-width: 1472px;
}

.apartment-card {
    position: relative;
}


a.apartments-link {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.single-flats .page__inner {
    margin-bottom: 3vw;
}

/**
    Gallery on Flat single page
 */
.flat-tabs {
    display:flex;
    gap:20px;
    margin-top:2vw;
}

.tab-btn {
    background:none;
    border:none;
    font-size:16px;
    cursor:pointer;
    padding-bottom:6px;
}

.tab-btn.active {
    border-bottom:2px solid #3aa54b;
    font-weight:600;
}


.tab-content.active {
    display:block;
}

.flat-plan img {
    width:100%;
    height:auto;
}

.flat-tabs-content {
    position: relative;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.card .note {
    font-size: 0.9vw;
    opacity: 0.6;
    margin-bottom: 2vw;
}

@media (max-width: 768px) {

    .price .value, .price .total { margin-top: 1.8vw; }

    .flat-tabs {
        margin-top: 5vw;
    }

    .flat-info .btn {
        padding: 2.2vw;
        font-size: 4vw;
    }

    .card .info .row {
        font-size: 1.1vw;
        padding: 2.4vw 0;
    }

    .card .price {
        margin: 5vw 0 1vw;
    }

    .card .note {
        font-size: 2vw;
        margin-bottom: 8vw;
    }

    .flat-info .price .label {
        font-size: 2.5vw;
    }

    .flat-info .price .value, .flat-info .price .total {
        font-size: 3vw;
    }

    .apartments-filters {
        padding: 32px 2vw 28px;
    }

    .filters-row {
        flex-direction: column;
    }

    .apartments-filters .filter.noui-slider {
        max-width: initial;
    }

}
