.price-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    padding: 40px 20px 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;

    opacity: 0;
    visibility: hidden;

    transition: .2s;

    z-index: 10000;
}

.price-popup.active {
    opacity: 1;
    visibility: visible;
}

.price-popup-inner {
    width: 568px;
    max-width: 100%;

    min-height: min(568px, calc(100vh - 60px));
    min-height: min(568px, calc(100dvh - 60px));
    max-height: calc(100vh - 60px);
    max-height: calc(100dvh - 60px);

    background: #fff;

    border-radius: 28px;

    overflow: hidden;

    display: flex;
    flex-direction: column;

    position: relative;

    box-shadow: 0px 8px 28px rgba(0,0,0,.28);
}

/* HEADER */

.price-popup-header {
    height: 64px;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    border-bottom: 1px solid var(--color-border);

    flex-shrink: 0;
}

.price-popup-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
}

.price-popup-close {
    width: 32px;
    height: 32px;

    border: none;
    background: transparent;
    border-radius: 50%;
    transition: all .2s linear;

    position: absolute;
    right: 16px;
    top: 50%;

    transform: translateY(-50%);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;
}

.price-popup-close:hover {
    background-color: var(--color-tertiary);
}

.price-popup-close img {
    display: block;
    width: 18px;
    height: 18px;
    object-position: center;
    object-fit: cover;
}

/* BODY */

.price-popup-body {
    flex: 1;

    overflow-y: auto;

    padding: 24px;
}

.price-section-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 24px;

    margin-bottom: 8px;
}

.price-section-subtitle {
    font-size: 14px;
    line-height: 18px;
    color: #737373;

    margin-bottom: 24px;
}

/* TYPE SWITCHER */

.price-types {
    display: flex;
    align-items: center;
    background: transparent;
    border-radius: 20px;
    padding: 5px;
    border: 1px solid var(--color-border);
}

.price-type-option {
    flex: 1;
    min-width: 0;
    border: 2px solid transparent;
    position: relative;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    border-radius: 16px;
    transition: background .2s ease, color .2s ease;
}

.price-type-option:hover::before,
.price-type-option:hover + .price-type-option::before,
.price-type-option.active::before,
.price-type-option.active + .price-type-option::before {
    opacity: 0 !important;
}

.price-types .price-type-option:nth-child(n+2)::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    bottom: 16px;
    width: 1px;
    height: 100%;
    background: var(--color-border);
    opacity: 1;
    transition: opacity .2s ease;
    transform: translateY(-50%);
}

.no-border::before {
    opacity: 0 !important;
}

.price-type-option input {
    display: none;
}

.price-type-option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 102px;
    padding: 12px 0;
    background: transparent;
    border-radius: 16px;
    border: 2px solid transparent;
    font-size: 14px;
    line-height: 13px;
    font-weight: 600;
    color: var(--color-primary);
    transition: background .2s ease, border .2s ease, color .2s ease;
}

.price-type-option input:checked + span {
    background: var(--color-tertiary);
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.price-type-option:hover span {
    background: var(--color-tertiary);
}

.price-slider-wrap {
    position: relative;
    margin-top: 48px;
    margin-bottom: 30px;
    height: 65px;
    --fill-left: 0%;
    --fill-right: 0%;
}

#priceHistogramChart {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 46px;
    z-index: 1;
    pointer-events: none;
}

.price-slider-wrap::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: #F4F4F4;
    border-radius: 999px;
    z-index: 2;
}

.price-slider-wrap::after {
    content: "";
    position: absolute;
    left: var(--fill-left);
    right: var(--fill-right);
    bottom: 0;
    height: 4px;
    background: #E60023;
    border-radius: 999px;
    z-index: 3;
    pointer-events: none;
}

.price-slider-wrap .price-range-input {
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 40px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    pointer-events: none;
}

.price-slider-wrap .price-range-input#priceRangeMin {
    z-index: 5;
}

.price-slider-wrap .price-range-input#priceRangeMax {
    z-index: 5;
}

.price-slider-wrap .price-range-input::-webkit-slider-thumb,
.price-slider-wrap .price-range-input::-moz-range-thumb {
    pointer-events: all;
}

.price-slider-wrap .price-range-input::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: transparent;
}

.price-slider-wrap .price-range-input::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 40px;
    margin-top: -18px;
    border-radius: 50%;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    cursor: pointer;
    pointer-events: all;
    transition: background .2s ease;
}

.price-slider-wrap .price-range-input::-webkit-slider-thumb:hover,
.price-slider-wrap .price-range-input::-webkit-slider-thumb:focus {
    background: var(--color-tertiary);
}

.price-slider-wrap .price-range-input::-moz-range-track {
    width: 100%;
    height: 4px;
    background: transparent;
}

.price-slider-wrap .price-range-input::-moz-range-thumb {
    appearance: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #D8D8D8;
    cursor: pointer;
    pointer-events: all;
    transition: background .2s ease;
}

.price-slider-wrap .price-range-input::-moz-range-thumb:hover,
.price-slider-wrap .price-range-input::-moz-range-thumb:focus {
    background: var(--color-tertiary);
}

/* INPUTS */

.price-values {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 50px;
}

.price-value-item {
    text-align: center;
}

.price-value-label {
    font-size: 12px;
    line-height: 20px;
    color: var(--color-secondary);
    margin-bottom: 4px;
}

.price-value-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 126px;
    min-height: 48px;
    box-sizing: border-box;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 16px;
    background: transparent;
}

.price-value-item:last-child .price-value-box {
    min-width: 166px;
}

.price-value-box input {
    width: auto;
    min-width: 72px;
    max-width: none;
    display: inline-block;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 400;
    text-align: center;
    color: var(--color-primary);
}

.price-value-item:last-child .price-value-box input {
    min-width: 118px;
}

.price-value-box input:focus {
    outline: none;
}

/* FOOTER */

.price-popup-footer {
    border-top: 1px solid #ECECEC;

    padding: 16px 24px;

    display: flex;
    justify-content: space-between;
    align-items: center;

    background: #fff;

    flex-shrink: 0;

    box-shadow: 0 -2px 16px rgba(0,0,0,.08);
}

.price-clear-btn {
    padding: 13px 12px;
    font-size: 14px;
    line-height: 18px;
    font-weight: 600;
    background: transparent;
    border-radius: 8px;
    transition: all 0.2s linear;

    &:hover {
        background-color: var(--color-tertiary);
    }
}

.price-clear-btn:disabled {
    color: var(--color-border);
    cursor: auto;

    &:hover {
        background-color: transparent;
    }
}

.price-apply-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;

    border: none;
    border-radius: 8px;

    padding: 0 24px;

    background: #000;
    color: #fff;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
    position: relative;
    transition: opacity 0.2s linear;
}

.price-apply-btn:hover {
    opacity: .8;
}

/* LOADER */

.price-apply-btn.loading {
    color: transparent;
    pointer-events: none;
}

.price-apply-btn.loading::after {
    content: "";

    width: 8px;
    aspect-ratio: 1;
    border-radius: 50%;

    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    animation: l5 1s infinite linear alternate;
}

@keyframes l5 {
    0% {
        box-shadow: 20px 0 #fff, -20px 0 #fff3;
        background: #fff;
    }
    33% {
        box-shadow: 20px 0 #fff, -20px 0 #fff3;
        background: #fff3;
    }
    66% {
        box-shadow: 20px 0 #fff3, -20px 0 #fff;
        background: #fff3;
    }
    100% {
        box-shadow: 20px 0 #fff3, -20px 0 #fff;
        background: #fff;
    }
}

@media (max-width: 749px) {
    .price-popup {
        align-items: flex-end;
        padding: 0;
        opacity: 1;
        visibility: hidden;
        transition: visibility 0s linear .28s;
    }

    .price-popup.active {
        visibility: visible;
        transition-delay: 0s;
    }

    .price-popup-inner {
        width: 100%;
        max-height: calc(100vh - 12px);
        max-height: calc(100dvh - 12px);
        min-height: 0;
        border-radius: 28px 28px 0 0;
        transform: translateY(100%);
        transition: transform .28s ease;
    }

    .price-popup.active .price-popup-inner {
        transform: translateY(0);
    }

    .price-popup-header {
        height: 54px;
        padding: 15px 48px;
    }

    .price-popup-close {
        right: 12px;
    }

    .price-popup-body {
        flex: 0 1 auto;
        padding: 20px 16px 18px;
    }

    .price-section-title {
        margin-bottom: 6px;
        font-size: 16px;
        line-height: 20px;
    }

    .price-section-subtitle {
        margin-bottom: 20px;
        font-size: 12px;
        line-height: 16px;
    }

    .price-types {
        border-radius: 16px;
        padding: 3px;
    }

    .price-type-option {
        border-radius: 14px;
    }

    .price-type-option span {
        min-width: 0;
        padding: 10px 0;
        border-radius: 14px;
        font-size: 12px;
        line-height: 16px;
    }

    .price-type-option:nth-child(2) span,
    .price-type-option:nth-child(3) span,
    .price-type-option:nth-child(4) span,
    .price-type-option:nth-child(5) span {
        font-size: 0;
    }

    .price-type-option:nth-child(2) span::after,
    .price-type-option:nth-child(3) span::after,
    .price-type-option:nth-child(4) span::after,
    .price-type-option:nth-child(5) span::after {
        font-size: 12px;
        line-height: 16px;
    }

    .price-type-option:nth-child(2) span::after {
        content: "1";
    }

    .price-type-option:nth-child(3) span::after {
        content: "2";
    }

    .price-type-option:nth-child(4) span::after {
        content: "3";
    }

    .price-type-option:nth-child(5) span::after {
        content: "4+";
    }

    .price-slider-wrap {
        margin-top: 36px;
        margin-bottom: 28px;
        height: 68px;
    }

    #priceHistogramChart {
        height: 48px;
    }

    .price-slider-wrap .price-range-input {
        bottom: -16px;
        height: 32px;
    }

    .price-slider-wrap .price-range-input::-webkit-slider-thumb {
        width: 32px;
        height: 32px;
        margin-top: -14px;
    }

    .price-slider-wrap .price-range-input::-moz-range-thumb {
        width: 32px;
        height: 32px;
    }

    .price-values {
        gap: 12px;
        margin-bottom: 0;
    }

    .price-value-item {
        min-width: 0;
    }

    .price-value-label {
        margin-bottom: 6px;
        font-size: 10px;
        line-height: 14px;
    }

    .price-value-box {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 126px;
        min-height: 48px;
        box-sizing: border-box;
        padding: 13px 18px;
    }

    .price-value-item:last-child .price-value-box {
        min-width: 174px;
    }

    .price-value-box input {
        max-width: none;
        font-size: 16px;
        line-height: 20px;
    }

    .price-value-item:last-child .price-value-box input {
        min-width: 134px;
    }

    .price-popup-footer {
        gap: 12px;
        padding: 16px;
    }

    .price-clear-btn {
        flex: 0 0 auto;
        padding: 13px 0;
    }

    .price-apply-btn {
        flex: 1;
        min-width: 0;
        max-width: 216px;
        padding: 0 24px;
    }
}
