.sap-popup-open {
    overflow: hidden;
}

.sap-popup-root {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.sap-popup-root.is-open {
    opacity: 1;
    pointer-events: auto;
}

.sap-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .68);
    backdrop-filter: blur(3px);
}

.sap-popup-card {
    --sap-max-width: 560px;
    --sap-bg: #fff;
    --sap-text: #1f2937;
    --sap-button: #2563eb;
    --sap-button-text: #fff;
    --sap-radius: 16px;
    --sap-background-width: 520px;
    --sap-background-height: 420px;
    --sap-image-overlay: .38;
    --sap-background-fit: contain;
    --sap-background-position-y: 0px;
    position: relative;
    z-index: 2;
    width: min(100%, var(--sap-max-width));
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: var(--sap-bg);
    color: var(--sap-text);
    border-radius: var(--sap-radius);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
    transform: translateY(18px) scale(.97);
    transition: transform .22s ease;
}

.sap-popup-root.is-open .sap-popup-card {
    transform: translateY(0) scale(1);
}

.sap-popup-image {
    display: block;
    width: 100%;
    max-height: 320px;
    object-fit: cover;
    border-radius: var(--sap-radius) var(--sap-radius) 0 0;
}

.sap-popup-content {
    position: relative;
    z-index: 2;
    padding: 30px;
}

.sap-popup-card.sap-image-mode-background {
    min-height: var(--sap-background-height);
    overflow: hidden;
    background: var(--sap-bg);
}

.sap-popup-background-image,
.sap-popup-background-overlay {
    position: absolute;
    inset: 0;
}

.sap-popup-background-image {
    z-index: 0;
    background-size: min(100%, var(--sap-background-width)) auto;
    background-repeat: no-repeat;
    background-position: center calc(50% + var(--sap-background-position-y));
}

.sap-popup-card.sap-fit-cover .sap-popup-background-image {
    background-size: cover;
}

.sap-popup-background-overlay {
    z-index: 1;
    background: rgba(15, 23, 42, var(--sap-image-overlay));
}

.sap-popup-content-background {
    min-height: var(--sap-background-height);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.sap-popup-title {
    margin: 0 44px 12px 0;
    color: inherit;
    font-size: clamp(1.6rem, 4vw, 2.25rem);
    line-height: 1.15;
}

.sap-popup-message,
.sap-popup-message p {
    color: inherit;
    font-size: 1rem;
    line-height: 1.65;
}

.sap-popup-message p:first-child {
    margin-top: 0;
}

.sap-popup-message p:last-child {
    margin-bottom: 0;
}

.sap-popup-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-height: 46px;
    margin-top: 22px;
    padding: 10px 22px;
    border-radius: 999px;
    background: var(--sap-button);
    color: var(--sap-button-text) !important;
    text-decoration: none !important;
    font-weight: 700;
    line-height: 1.2;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    transition: transform .15s ease, filter .15s ease;
}

.sap-popup-button:hover,
.sap-popup-button:focus {
    color: var(--sap-button-text) !important;
    filter: brightness(.94);
    transform: translateY(-1px);
}

.sap-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 3;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #111827;
    cursor: pointer;
    font-size: 29px;
    line-height: 34px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .14);
}

.sap-popup-position-bottom-right,
.sap-popup-position-bottom-left {
    align-items: flex-end;
}

.sap-popup-position-bottom-right {
    justify-content: flex-end;
}

.sap-popup-position-bottom-left {
    justify-content: flex-start;
}

.sap-popup-position-bottom-right .sap-popup-card,
.sap-popup-position-bottom-left .sap-popup-card {
    max-width: min(var(--sap-max-width), 420px);
}

@media (max-width: 600px) {
    .sap-popup-root {
        padding: 12px;
        align-items: flex-end;
    }

    .sap-popup-card {
        max-height: calc(100vh - 24px);
    }

    .sap-popup-content {
        padding: 24px 22px;
    }

    .sap-popup-content-background {
        min-height: min(var(--sap-background-height), 70vh);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sap-popup-root,
    .sap-popup-card,
    .sap-popup-button {
        transition: none;
    }
}
