.ad-popup-modal.modal {
    overflow-y: auto;
}

.ad-popup-modal .modal-dialog {
    width: calc(100% - 32px);
    max-width: 420px;
    min-height: 0;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    margin-left: auto;
    margin-right: auto;
}

.ad-popup-modal .modal-dialog::before {
    display: none;
    content: none;
}

.ad-popup-modal .modal-content {
    position: relative;
    width: 100%;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    background-color: #ffffff;
}

.ad-popup-scroll {
    overflow: auto;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.ad-popup-close {
    position: absolute;
    top: 8px;
    z-index: 2;
    inset-inline-end: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: #ffffff;
    color: #121212;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.ad-popup-card:not(.has-image) .ad-popup-body {
    padding-top: 56px;
}

.ad-popup-close:focus {
    outline: 2px solid var(--primary-color, #000000);
    outline-offset: 2px;
}

.ad-popup-media {
    position: relative;
    z-index: 0;
    background-color: #f3f3f3;
}

.ad-popup-image {
    display: block;
    width: 100%;
    height: 52vh;
    height: min(52vh, 460px);
    object-fit: cover;
}

.ad-popup-body {
    position: relative;
    z-index: 1;
    padding: 20px 20px 24px;
    background-color: #ffffff;
    text-align: start;
}

.ad-popup-title {
    margin: 0 0 8px;
    color: #121212 !important;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.4;
}

.ad-popup-description {
    margin: 0;
    color: #444444;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.ad-popup-action {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 0;
    background-color: var(--btn-color, var(--primary-color, #000000));
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
}

.ad-popup-action:hover,
.ad-popup-action:focus,
.ad-popup-action:active {
    color: var(--second-color, #ffffff);
    text-decoration: none;
    opacity: 0.92;
}

.ad-popup-action:focus {
    outline: 2px solid var(--primary-color, #000000);
    outline-offset: 2px;
}

@media (max-width: 575px) {
    .ad-popup-title {
        font-size: 20px;
    }

    .ad-popup-body {
        padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .ad-popup-modal.fade .modal-dialog {
        transition: none;
    }
}
