/* =============================================
   Smart Popup Pro — Frontend CSS v1.4
   ============================================= */

/* ── Hidden state ── */
.spp-popup,
.spp-overlay {
    display: none;
    opacity: 0;
}

/* ── OVERLAY ── */
.spp-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    cursor: pointer;
}

/* ── BASE POPUP ──
   overflow: visible is CRITICAL for outside close button
   The inner scroll wrapper handles scrolling instead */
.spp-popup {
    position: fixed;
    z-index: 99999;
    box-sizing: border-box;
    font-family: inherit;
    overflow: visible !important; /* NEVER clip — needed for outside close btn */
}

/* ── POPUP INNER SCROLL WRAPPER ──
   This handles scrolling so popup itself stays overflow:visible */
.spp-popup-inner {
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    border-radius: inherit;
}

/* ── MODAL (center) ── */
.spp-type-modal {
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    right: auto !important;
    bottom: auto !important;
}

/* ── SLIDE IN POSITIONS ── */
.spp-type-slide_top {
    top: 0; left: 0; right: 0;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
}

.spp-type-slide_bottom {
    bottom: 0; left: 0; right: 0;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 0 !important;
}

.spp-type-slide_left {
    top: 0; left: 0; bottom: 0;
    transform: none !important;
    height: 100vh !important;
    border-radius: 0 !important;
}
.spp-type-slide_left .spp-popup-inner { max-height: 100vh; }

.spp-type-slide_right {
    top: 0; right: 0; bottom: 0;
    left: auto !important;
    transform: none !important;
    height: 100vh !important;
    border-radius: 0 !important;
}
.spp-type-slide_right .spp-popup-inner { max-height: 100vh; }

/* ── STICKY BARS ── */
.spp-type-bar_top {
    top: 0; left: 0; right: 0;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: center;
    border-radius: 0 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.spp-type-bar_bottom {
    bottom: 0; left: 0; right: 0;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: center;
    border-radius: 0 !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
}

/* Bars: inner scroll not needed */
.spp-type-bar_top .spp-popup-inner,
.spp-type-bar_bottom .spp-popup-inner {
    max-height: none;
    overflow: visible;
}

/* ── FULLSCREEN ── */
.spp-type-fullscreen {
    inset: 0 !important;
    transform: none !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100% !important;
    border-radius: 0 !important;
    display: none;
    align-items: center;
    justify-content: center;
}
.spp-type-fullscreen.spp-active { display: flex !important; }
.spp-type-fullscreen .spp-popup-inner {
    max-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════════
   CLOSE BUTTON — FULL REWORK
   ═══════════════════════════════════════════ */
.spp-close-btn {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    /* z-index higher than popup so it shows above everything */
    z-index: 100001;
    padding: 0;
    line-height: 1;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
    /* Prevent theme styles from interfering */
    box-sizing: border-box;
}
.spp-close-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Style variants */
.spp-close-circle  { border-radius: 50%; }
.spp-close-square  { border-radius: 4px; }
.spp-close-plain   { background: transparent !important; border: none !important; box-shadow: none !important; }
.spp-close-outline { background: transparent !important; }

/* ── INSIDE positions (relative to popup-inner) ── */
.spp-close-pos-inside_tr { top: 10px; right: 10px; }
.spp-close-pos-inside_tl { top: 10px; left: 10px; }

/* ── OUTSIDE top-right ──
   Key fix: position relative to .spp-popup (overflow:visible),
   NOT .spp-popup-inner (which has overflow:auto) */
.spp-close-pos-outside_tr {
    /* Position relative to the popup box edge */
    top: -15px;
    right: -15px;
    /* Force above all other elements */
    z-index: 100002;
}

/* Bar close — vertically centered on right */
.spp-type-bar_top .spp-close-btn,
.spp-type-bar_bottom .spp-close-btn {
    top: 50% !important;
    right: 14px !important;
    left: auto !important;
    transform: translateY(-50%) !important;
}

/* Fullscreen close — top right corner */
.spp-type-fullscreen .spp-close-btn {
    top: 20px !important;
    right: 20px !important;
}

/* ── POPUP CONTENT ── */
.spp-popup-content {
    position: relative;
}
.spp-popup-content img { max-width: 100%; height: auto; }
.spp-popup-content p:last-child { margin-bottom: 0; }

/* ── INLINE POPUP ── */
.spp-inline-popup { margin: 20px 0; }

/* ── TRIGGER BUTTON ── */
.spp-trigger-btn { cursor: pointer; }

/* ── ACTIVE STATE ── */
.spp-popup.spp-active,
.spp-overlay.spp-active {
    display: block;
    opacity: 1;
}
.spp-type-fullscreen.spp-active { display: flex !important; }

/* ── ANIMATE.CSS ── */
.spp-popup.animate__animated { --animate-duration: 0.4s; }

/* ── RESPONSIVE ── */
@media (max-width: 767px) {
    .spp-type-modal {
        width: 92vw !important;
        max-width: 92vw !important;
    }
    .spp-type-slide_left,
    .spp-type-slide_right { width: 85vw !important; }
}

/* ── BODY LOCK ── */
body.spp-body-lock { overflow: hidden; }

/* ── EMAIL FORM ── */
.spp-email-form-wrap { margin-top: 16px; }
.spp-email-form-wrap input[type="email"],
.spp-email-form-wrap input[type="text"] { box-sizing: border-box; transition: border-color 0.2s; }
.spp-email-form-wrap input:focus { outline: none; border-color: #fb8124 !important; }
.spp-subscribe-btn:hover { background: #e0721e !important; }
.spp-subscribe-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.spp-form-message { border-radius: 4px; font-size: 13px; }
