/* ==========================================================================
   JSP Popups – Frontend Styles
   All popup rendering, positioning, animations
   ========================================================================== */

/* ── Wrapper (fullscreen overlay container) ── */
.jsp-popup-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--jsp-z, 99999);
    display: none; /* hidden by default, JS shows it */
    align-items: center;
    justify-content: center;
}

.jsp-popup-wrapper.jsp-active {
    display: flex;
}

/* ── Overlay ── */
.jsp-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity var(--jsp-anim-dur, 300ms) ease;
}

.jsp-popup-wrapper.jsp-active .jsp-popup-overlay {
    opacity: 1;
}

.jsp-popup-wrapper.jsp-closing .jsp-popup-overlay {
    opacity: 0;
}

/* ── Popup Container ── */
.jsp-popup-container {
    position: relative;
    width: var(--jsp-width, 600px);
    max-width: 95vw;
    max-height: 90vh;
    height: var(--jsp-height, auto);
    background: var(--jsp-bg, #fff);
    border-radius: var(--jsp-radius, 12px);
    padding: var(--jsp-padding, 0px);
    box-shadow: var(--jsp-shadow, 0 25px 60px rgba(0,0,0,0.3));
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 2;
    will-change: transform, opacity;
}

/* Scrollbar styling */
.jsp-popup-container::-webkit-scrollbar {
    width: 6px;
}
.jsp-popup-container::-webkit-scrollbar-track {
    background: transparent;
}
.jsp-popup-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

/* ── Close Button ── */
.jsp-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0,0,0,0.08);
    color: #333;
    font-size: 22px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    backdrop-filter: blur(4px);
}

.jsp-popup-close:hover {
    background: rgba(0,0,0,0.15);
    transform: scale(1.1);
}

.jsp-popup-close:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ── Content area ── */
.jsp-popup-content {
    width: 100%;
}

/* Reset Elementor container margins inside popup */
.jsp-popup-content .elementor-section-wrap,
.jsp-popup-content > .elementor {
    width: 100%;
}

/* ── Positions ── */
.jsp-pos-center {
    align-items: center;
    justify-content: center;
}

.jsp-pos-top-center {
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
}

.jsp-pos-top-left {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 40px 0 0 40px;
}

.jsp-pos-top-right {
    align-items: flex-start;
    justify-content: flex-end;
    padding: 40px 40px 0 0;
}

.jsp-pos-bottom-center {
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 40px;
}

.jsp-pos-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 0 0 40px 40px;
}

.jsp-pos-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 40px 40px 0;
}

.jsp-pos-left-center {
    align-items: center;
    justify-content: flex-start;
    padding-left: 40px;
}

.jsp-pos-right-center {
    align-items: center;
    justify-content: flex-end;
    padding-right: 40px;
}

.jsp-pos-fullscreen .jsp-popup-container {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
}

/* ── Prevent body scroll ── */
body.jsp-no-scroll {
    overflow: hidden !important;
}

/* ── Animations – Entry ── */
@keyframes jspFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes jspSlideInUp {
    from { opacity: 0; transform: translateY(40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes jspSlideInDown {
    from { opacity: 0; transform: translateY(-40px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes jspSlideInLeft {
    from { opacity: 0; transform: translateX(-40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes jspSlideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes jspZoomIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes jspBounceIn {
    0% { opacity: 0; transform: scale(0.3); }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes jspFlipInX {
    from { opacity: 0; transform: perspective(400px) rotateX(90deg); }
    to { opacity: 1; transform: perspective(400px) rotateX(0); }
}

@keyframes jspFlipInY {
    from { opacity: 0; transform: perspective(400px) rotateY(90deg); }
    to { opacity: 1; transform: perspective(400px) rotateY(0); }
}

@keyframes jspRotateIn {
    from { opacity: 0; transform: rotate(-200deg); }
    to { opacity: 1; transform: rotate(0); }
}

/* ── Animations – Exit ── */
@keyframes jspFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes jspSlideOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-40px); }
}

@keyframes jspSlideOutDown {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(40px); }
}

@keyframes jspSlideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-40px); }
}

@keyframes jspSlideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

@keyframes jspZoomOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.8); }
}

@keyframes jspBounceOut {
    0% { transform: scale(1); }
    25% { transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.1); }
    100% { opacity: 0; transform: scale(0.3); }
}

/* ── Animation classes ── */
.jsp-anim-fadeIn .jsp-popup-container { animation: jspFadeIn var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideInUp .jsp-popup-container { animation: jspSlideInUp var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideInDown .jsp-popup-container { animation: jspSlideInDown var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideInLeft .jsp-popup-container { animation: jspSlideInLeft var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideInRight .jsp-popup-container { animation: jspSlideInRight var(--jsp-anim-dur) ease forwards; }
.jsp-anim-zoomIn .jsp-popup-container { animation: jspZoomIn var(--jsp-anim-dur) ease forwards; }
.jsp-anim-bounceIn .jsp-popup-container { animation: jspBounceIn var(--jsp-anim-dur) ease forwards; }
.jsp-anim-flipInX .jsp-popup-container { animation: jspFlipInX var(--jsp-anim-dur) ease forwards; }
.jsp-anim-flipInY .jsp-popup-container { animation: jspFlipInY var(--jsp-anim-dur) ease forwards; }
.jsp-anim-rotateIn .jsp-popup-container { animation: jspRotateIn var(--jsp-anim-dur) ease forwards; }

.jsp-anim-fadeOut .jsp-popup-container { animation: jspFadeOut var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideOutUp .jsp-popup-container { animation: jspSlideOutUp var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideOutDown .jsp-popup-container { animation: jspSlideOutDown var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideOutLeft .jsp-popup-container { animation: jspSlideOutLeft var(--jsp-anim-dur) ease forwards; }
.jsp-anim-slideOutRight .jsp-popup-container { animation: jspSlideOutRight var(--jsp-anim-dur) ease forwards; }
.jsp-anim-zoomOut .jsp-popup-container { animation: jspZoomOut var(--jsp-anim-dur) ease forwards; }
.jsp-anim-bounceOut .jsp-popup-container { animation: jspBounceOut var(--jsp-anim-dur) ease forwards; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .jsp-popup-container {
        max-width: 96vw;
    }

    .jsp-pos-top-left,
    .jsp-pos-top-right,
    .jsp-pos-bottom-left,
    .jsp-pos-bottom-right,
    .jsp-pos-left-center,
    .jsp-pos-right-center {
        padding: 20px;
    }

    .jsp-popup-close {
        top: 6px;
        right: 6px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}
