/* ============ Overlay ============ */
.spi-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.spi-overlay.spi-show {
    opacity: 1;
    pointer-events: auto;
}

/* ============ Popup Wrapper ============ */
.spi-popup-wrap {
    position: fixed;
    z-index: 999999;
    display: none;
    pointer-events: none;
}
.spi-popup-wrap.spi-visible { display: block; pointer-events: auto; }

/* موقعیت‌ها */
.spi-pos-center {
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.spi-pos-top { top: 20px; left: 50%; transform: translateX(-50%); }
.spi-pos-bottom { bottom: 20px; left: 50%; transform: translateX(-50%); }
.spi-pos-top-right { top: 20px; right: 20px; }
.spi-pos-top-left { top: 20px; left: 20px; }
.spi-pos-bottom-right { bottom: 20px; right: 20px; }
.spi-pos-bottom-left { bottom: 20px; left: 20px; }

/* ============ Popup Box ============ */
.spi-popup {
    position: relative;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 30px 25px 25px;
    opacity: 0;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.spi-popup-title {
    margin: 0 0 15px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-size: 22px;
    font-weight: bold;
}

.spi-popup-content {
    line-height: 1.9;
    font-size: 15px;
}
.spi-popup-content img { max-width: 100%; height: auto; border-radius: 6px; }
.spi-popup-content iframe { max-width: 100%; }

/* دکمه بستن */
.spi-close {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 34px; height: 34px;
    background: rgba(0,0,0,0.08);
    color: #333;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.spi-close:hover { background: #dc3232; color: #fff; transform: rotate(90deg); }

/* ============ انیمیشن‌ها ============ */
.spi-anim-fade .spi-popup { transform: scale(1); }
.spi-visible.spi-anim-fade .spi-popup { opacity: 1; transform: scale(1); }

.spi-anim-zoom .spi-popup { transform: scale(0.6); }
.spi-visible.spi-anim-zoom .spi-popup { opacity: 1; transform: scale(1); }

.spi-anim-slide-up .spi-popup { transform: translateY(60px); }
.spi-visible.spi-anim-slide-up .spi-popup { opacity: 1; transform: translateY(0); }

.spi-anim-slide-down .spi-popup { transform: translateY(-60px); }
.spi-visible.spi-anim-slide-down .spi-popup { opacity: 1; transform: translateY(0); }

.spi-anim-bounce .spi-popup { transform: scale(0.3); }
.spi-visible.spi-anim-bounce .spi-popup {
    opacity: 1;
    transform: scale(1);
    animation: spi-bounce-in 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes spi-bounce-in {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); opacity: 1; }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

/* ============ ریسپانسیو ============ */
@media (max-width: 600px) {
    .spi-popup {
        padding: 25px 18px 18px;
        max-width: 92vw;
    }
    .spi-popup-title { font-size: 18px; }
    .spi-pos-top-right, .spi-pos-bottom-right { right: 10px; }
    .spi-pos-top-left, .spi-pos-bottom-left { left: 10px; }
}