.popup__bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100svh;
    height: 100dvh;
    background: linear-gradient(180deg, rgba(12, 20, 38, 0.2) 0%, rgba(12, 20, 38, 0.46) 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 100;
    transform: translateZ(0);
}

.popup__bg.active {
    opacity: 1;
    pointer-events: all;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

@media (orientation: landscape) {
    .popup__bg.active {
        overflow-y: auto;
    }
}

.popup {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% - 20px);
    max-width: 688px;
    padding: 24px;
    opacity: 0;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(13, 103, 199, 0.08);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(7, 31, 68, 0.16);
    -webkit-transform: translate(-50%, -50%) scale(0.9);
    transform: translate(-50%, -50%) scale(0.9);
    -webkit-transform: translate3d(-50%, -50%, 0) scale(0.9);
    transform: translate3d(-50%, -50%, 0) scale(0.9);
    transition:
        -webkit-transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1),
        opacity 0.32s linear;
    transition:
        transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1),
        opacity 0.32s linear;
    z-index: 110;
}

.popup.active {
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
    -webkit-transform: translate3d(-50%, -50%, 0) scale(1);
    transform: translate3d(-50%, -50%, 0) scale(1);
    opacity: 1;
}

body.popup-open {
    overflow: hidden;
}

.close-popup {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    font: 300 25px/100% Helvetica, Arial, sans-serif;
    color: var(--main-color);
    cursor: pointer;
    transition: scale 0.3s ease, color 0.3s ease;
}

.popup__top {
    margin-bottom: 18px;
    padding-right: 28px;
}

.popup__title {
    margin: 0 0 10px;
    font-family: var(--semibold);
    font-size: 30px;
    line-height: 1.15;
    color: var(--color-text-strong);
}

.popup__text {
    margin: 0;
    font-size: 16px;
    line-height: 1.45;
    color: var(--color-text-soft);
}

.popup__inputs-top {
    margin-bottom: 18px;
}

.popup__input,
.popup__textarea {
    display: block;
    width: 100%;
    padding: 14px 18px 16px;
    font-size: 16px;
    line-height: 1.2;
    color: var(--color-text-strong);
    background: rgba(13, 103, 199, 0.04);
    border: 1px solid rgba(13, 103, 199, 0.12);
    border-radius: 14px;
    appearance: none;
}

.popup__form input[type="text"],
.popup__form input[type="tel"],
.popup__form input[type="email"],
.popup__form textarea {
    font-size: 16px !important;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.popup__input:not(:last-child) {
    margin-bottom: 12px;
}

.popup__textarea {
    min-height: 120px;
    resize: none;
}

.popup__input:focus,
.popup__textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: var(--shadow-focus);
    background: rgba(13, 103, 199, 0.03);
}

.popup__input::placeholder,
.popup__textarea::placeholder {
    color: var(--color-text-muted);
    font-family: var(--regular);
}

.policy-checkbox-box {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--color-text-soft);
}

.policy-checkbox {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(13, 103, 199, 0.2);
    border-radius: 4px;
    background-color: #fff;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.custom-checkbox::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
    border-right: 2px solid var(--main-color);
    border-bottom: 2px solid var(--main-color);
    transform: rotate(45deg) scale(0);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.policy-checkbox-label:hover .custom-checkbox {
    border-color: rgba(13, 103, 199, 0.4);
}

.policy-checkbox:checked + .custom-checkbox {
    border-color: var(--main-color);
}

.policy-checkbox:checked + .custom-checkbox::after {
    transform: rotate(45deg) scale(1);
    opacity: 1;
}

.popup__policy-text > p {
    margin: 0;
}

.popup__policy-text > p > a {
    color: var(--color-accent-strong);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.3s;
}

.popup__box-btn {
    display: flex;
}

.popup__btn {
    width: 100%;
    min-height: 56px;
    padding: 14px 28px;
}

@media (hover: hover) {
    .close-popup:hover {
        scale: 1.1;
        color: var(--color-accent-strong);
    }

    .popup__policy-text > p > a:hover {
        color: var(--color-accent);
    }
}

@media (max-width: 767px) {
    .popup {
        width: calc(100% - 16px);
        padding: 18px 16px;
        border-radius: 18px;
    }

    .close-popup {
        top: 10px;
        right: 10px;
    }

    .popup__title {
        font-size: 24px;
    }

    .popup__text,
    .popup__btn {
        font-size: 15px;
    }

    .popup__input,
    .popup__textarea {
        font-size: 16px;
    }

    .popup__form input[type="text"],
    .popup__form input[type="tel"],
    .popup__form input[type="email"],
    .popup__form textarea {
        font-size: 16px !important;
    }

    .popup__textarea {
        min-height: 110px;
    }

    .policy-checkbox-box {
        gap: 8px;
        font-size: 13px;
    }
}
