/* ================================================================
   Smart Popup Rules – Frontend CSS
   ================================================================ */

/* ── Overlay ──────────────────────────────────────── */
.spr-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .35s ease;
    padding: 16px;
}
.spr-overlay.spr-active {
    background: rgba(0, 0, 0, .65);
}

/* ── Scroll lock ──────────────────────────────────── */
html.spr-no-scroll,
html.spr-no-scroll body {
    overflow: hidden !important;
}

/* ── Modal — image-only mode (shrink-wrap) ────────── */
.spr-modal,
.spr-modal * {
    box-shadow: none !important;
}
.spr-modal {
    position: relative;
    max-width: 520px;
    opacity: 0;
    transform: translateY(30px) scale(.96);
    transition: opacity .35s ease, transform .35s ease;
    padding: 0 !important;
    margin: 0;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
}
/* Image-only modal: shrink-wrap, transparent */
.spr-modal:not(.spr-modal-content) {
    width: fit-content;
    line-height: 0;
    font-size: 0;
    background-color: transparent !important;
}
/* Content modal: has real background and padding */
.spr-modal.spr-modal-content {
    width: 100%;
    background: #fff !important;
    border-radius: 12px !important;
    padding: 24px 28px !important;
    line-height: 1.6;
    font-size: 15px;
    color: #333;
}
.spr-overlay.spr-active .spr-modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ── Popup image — fills the modal ────────────────── */
.spr-popup-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 0;
    padding: 0;
    border: none;
}

.spr-modal:not(.spr-modal-content) a {
    display: block;
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s ease;
    line-height: 0;
    font-size: 0;
    margin: 0;
    padding: 0;
}
.spr-modal:not(.spr-modal-content) a:hover {
    transform: scale(1.01);
}

/* ── Content area ─────────────────────────────────── */
.spr-popup-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.spr-popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}
.spr-popup-content p:first-child { margin-top: 0; }
.spr-popup-content p:last-child  { margin-bottom: 0; }
.spr-popup-content a {
    color: #2271b1;
    text-decoration: underline;
}
.spr-popup-content h1,
.spr-popup-content h2,
.spr-popup-content h3,
.spr-popup-content h4 {
    margin: 0.5em 0;
    line-height: 1.3;
}

/* ── Close button ─────────────────────────────────── */
.spr-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 34px;
    height: 34px;
    border: 2px solid rgba(255, 255, 255, .8) !important;
    background: rgba(0, 0, 0, .6) !important;
    color: #fff !important;
    font-size: 20px;
    line-height: 1;
    border-radius: 50% !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, transform .2s;
    z-index: 2;
    padding: 0;
    margin: 0;
}
.spr-close:hover {
    background: rgba(0, 0, 0, .85) !important;
    transform: scale(1.1);
}

/* ── Mobile ───────────────────────────────────────── */
@media (max-width: 480px) {
    .spr-modal {
        max-width: 95vw;
    }
    .spr-popup-img {
        border-radius: 8px;
    }
    .spr-modal.spr-modal-content {
        padding: 16px 18px !important;
        border-radius: 8px !important;
        font-size: 14px;
    }
    .spr-close {
        top: -10px;
        right: -10px;
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}
