/* =========================================================
   Elementor Template Popup Widget Styles
   ========================================================= */

/* Prevent body scroll when popup is active */
body.template-popup-no-scroll {
    overflow: hidden !important;
    touch-action: none;
}

/* Trigger Button & Wrapper */
.template-popup-trigger-wrapper {
    display: inline-block;
    box-sizing: border-box;
}

.template-popup-trigger-wrapper.align-left {
    display: flex;
    justify-content: flex-start;
}

.template-popup-trigger-wrapper.align-center {
    display: flex;
    justify-content: center;
}

.template-popup-trigger-wrapper.align-right {
    display: flex;
    justify-content: flex-end;
}

.template-popup-trigger-wrapper.align-justify {
    display: flex;
}

.template-popup-trigger-wrapper.align-justify .template-popup-trigger-btn {
    width: 100%;
}

.template-popup-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: #1f2244;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    padding: 16px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 14px rgba(31, 34, 68, 0.15);
}

.template-popup-trigger-btn:hover {
    background-color: #2b305e;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(31, 34, 68, 0.25);
}

.template-popup-trigger-btn:active {
    transform: translateY(0);
}

.template-popup-trigger-btn .trigger-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.template-popup-trigger-btn .trigger-icon i,
.template-popup-trigger-btn .trigger-icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    font-size: inherit;
}

/* Icon-Only Trigger */
.template-popup-trigger-icon-only {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #1f2244;
    color: #ffffff;
    cursor: pointer;
    border: none;
    transition: all 0.25s ease;
}

.template-popup-trigger-icon-only:hover {
    background-color: #2b305e;
    transform: scale(1.08);
}

/* Image Trigger */
.template-popup-trigger-image {
    display: inline-block;
    cursor: pointer;
    line-height: 0;
}

.template-popup-trigger-image img {
    max-width: 100%;
    height: auto;
    border-radius: inherit;
    transition: transform 0.3s ease;
}

.template-popup-trigger-image:hover img {
    transform: scale(1.03);
}

/* =========================================================
   Modal Window Structure
   ========================================================= */
.template-popup-modal-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.template-popup-modal-wrap.is-open {
    display: flex !important;
}

.template-popup-modal-wrap.is-closing {
    display: flex !important;
}

/* Backdrop Overlay */
.template-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    z-index: 1;
}

.template-popup-modal-wrap.is-open .template-popup-overlay {
    animation: popupBackdropFadeIn var(--popup-anim-duration, 350ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.template-popup-modal-wrap.is-closing .template-popup-overlay {
    animation: popupBackdropFadeOut 250ms ease forwards;
}

/* Container & Centering */
.template-popup-container {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 24px;
    box-sizing: border-box;
    pointer-events: none; /* Let overlay catch clicks outside box */
}

/* Popup Box */
.template-popup-box {
    position: relative;
    background-color: #ffffff;
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    border-radius: 20px;
    padding: 36px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    pointer-events: auto; /* Re-enable clicks inside */
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.3), 0 0 1px rgba(0, 0, 0, 0.1);
    --popup-anim-duration: 350ms;
}

/* Sleek Scrollbar for Modal Box */
.template-popup-box::-webkit-scrollbar {
    width: 8px;
}
.template-popup-box::-webkit-scrollbar-track {
    background: transparent;
}
.template-popup-box::-webkit-scrollbar-thumb {
    background: #303AB2;
    border-radius: 10px;
}
.template-popup-box::-webkit-scrollbar-thumb:hover {
    background: #242C8D;
}

/* =========================================================
   Entrance & Exit Animations (Keyframes)
   ========================================================= */

/* Zoom Animation (Default) */
.template-popup-modal-wrap.popup-anim-zoom.is-open .template-popup-box {
    animation: popupZoomIn var(--popup-anim-duration, 350ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Fade Animation */
.template-popup-modal-wrap.popup-anim-fade.is-open .template-popup-box {
    animation: popupFadeIn var(--popup-anim-duration, 300ms) ease forwards;
}

/* Slide Down */
.template-popup-modal-wrap.popup-anim-slide-down.is-open .template-popup-box {
    animation: popupSlideDown var(--popup-anim-duration, 380ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide Up */
.template-popup-modal-wrap.popup-anim-slide-up.is-open .template-popup-box {
    animation: popupSlideUp var(--popup-anim-duration, 380ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide Left */
.template-popup-modal-wrap.popup-anim-slide-left.is-open .template-popup-box {
    animation: popupSlideLeft var(--popup-anim-duration, 380ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Slide Right */
.template-popup-modal-wrap.popup-anim-slide-right.is-open .template-popup-box {
    animation: popupSlideRight var(--popup-anim-duration, 380ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Zoom Out (Scale Down) */
.template-popup-modal-wrap.popup-anim-zoom-out.is-open .template-popup-box {
    animation: popupZoomOutIn var(--popup-anim-duration, 380ms) cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Exit Animation on Close */
.template-popup-modal-wrap.is-closing .template-popup-box {
    animation: popupBoxExit 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards !important;
}

/* Animation Keyframes */
@keyframes popupBackdropFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes popupBackdropFadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes popupZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.82) translate3d(0, 0, 0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translate3d(0, 0, 0);
    }
}

@keyframes popupFadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes popupSlideDown {
    0% {
        opacity: 0;
        transform: translate3d(0, -60px, 0) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes popupSlideUp {
    0% {
        opacity: 0;
        transform: translate3d(0, 60px, 0) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes popupSlideLeft {
    0% {
        opacity: 0;
        transform: translate3d(60px, 0, 0) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes popupSlideRight {
    0% {
        opacity: 0;
        transform: translate3d(-60px, 0, 0) scale(0.96);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes popupZoomOutIn {
    0% {
        opacity: 0;
        transform: scale(1.15) translate3d(0, 0, 0);
    }
    100% {
        opacity: 1;
        transform: scale(1) translate3d(0, 0, 0);
    }
}

@keyframes popupBoxExit {
    0% {
        opacity: 1;
        transform: scale(1) translate3d(0, 0, 0);
    }
    100% {
        opacity: 0;
        transform: scale(0.88) translate3d(0, 0, 0);
    }
}

/* =========================================================
   Close Button
   ========================================================= */
.template-popup-close-btn {
    position: sticky;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #f3f4f6;
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: #1f2244;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    padding: 0 !important;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.template-popup-close-btn i,
.template-popup-close-btn svg {
    width: 14px;
    height: 14px;
    font-size: 14px;
    fill: currentColor;
    color: currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: inherit;
}

.template-popup-close-btn svg path {
    stroke: currentColor;
}

/* Hover Animations */
.popup-close-anim-scale .template-popup-close-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.popup-close-anim-rotate .template-popup-close-btn:hover {
    transform: rotate(90deg);
}

.popup-close-anim-none .template-popup-close-btn:hover {
    transform: none;
}

/* Position Variants */
.popup-close-pos-inside_left .template-popup-close-btn {
    left: 18px;
    right: auto;
}

.popup-close-pos-outside_right .template-popup-close-btn {
    top: -48px;
    right: 0;
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}
.popup-close-pos-outside_right .template-popup-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.popup-close-pos-outside_left .template-popup-close-btn {
    top: -48px;
    left: 0;
    right: auto;
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}
.popup-close-pos-outside_left .template-popup-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

/* Content Container */
.template-popup-content {
    width: 100%;
    box-sizing: border-box;
}

/* Empty / Fallback notice in Editor */
.template-popup-empty-notice {
    padding: 24px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* Live Editor Preview Mode */
.elementor-editor-active .template-popup-modal-wrap.editor-preview-active {
    position: relative;
    width: 100%;
    height: auto;
    z-index: 100;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin-top: 20px;
}

.elementor-editor-active .template-popup-modal-wrap.editor-preview-active .template-popup-overlay {
    display: none;
}

.elementor-editor-active .template-popup-modal-wrap.editor-preview-active .template-popup-container {
    padding: 0;
    height: auto;
}

.elementor-editor-active .template-popup-modal-wrap.editor-preview-active .template-popup-box {
    transform: none !important;
    opacity: 1 !important;
    max-height: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .template-popup-container {
        padding: 16px;
    }
    
    .template-popup-box {
        padding: 28px 20px 24px;
        border-radius: 16px;
    }
    
    .template-popup-close-btn {
        top: 14px;
        right: 14px;
        width: 32px;
        height: 32px;
    }
}
