/**
 * Jetomatic Popups - Frontend Styles
 */

/* Overlay */
.jtp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.jtp-popup-overlay.jtp-active {
    opacity: 1;
    visibility: visible;
}

/* Position variants */
.jtp-popup-overlay.jtp-position-center {
    align-items: center;
    justify-content: center;
}

.jtp-popup-overlay.jtp-position-top {
    align-items: flex-start;
    padding-top: 50px;
}

.jtp-popup-overlay.jtp-position-bottom {
    align-items: flex-end;
    padding-bottom: 50px;
}

.jtp-popup-overlay.jtp-position-bottom-right {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 20px;
}

.jtp-popup-overlay.jtp-position-bottom-left {
    align-items: flex-end;
    justify-content: flex-start;
    padding: 20px;
}

/* Popup Container */
.jtp-popup-container {
    position: relative;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.jtp-popup-overlay.jtp-active .jtp-popup-container {
    transform: scale(1) translateY(0);
}

/* Position-specific container adjustments */
.jtp-position-bottom-right .jtp-popup-container,
.jtp-position-bottom-left .jtp-popup-container {
    width: auto;
    min-width: 300px;
}

/* Close button */
.jtp-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

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

.jtp-popup-close svg {
    width: 20px;
    height: 20px;
    color: #333;
}

/* Content */
.jtp-popup-content {
    line-height: 1.6;
}

.jtp-popup-content img {
    max-width: 100%;
    height: auto;
}

.jtp-popup-content p:first-child {
    margin-top: 0;
}

.jtp-popup-content p:last-child {
    margin-bottom: 0;
}

/* Common button styles for popup content */
.jtp-popup-content .button,
.jtp-popup-content .btn,
.jtp-popup-content a.button,
.jtp-popup-content a.btn {
    display: inline-block;
    padding: 12px 24px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.jtp-popup-content .button:hover,
.jtp-popup-content .btn:hover,
.jtp-popup-content a.button:hover,
.jtp-popup-content a.btn:hover {
    background: #135e96;
    color: #fff;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .jtp-popup-container {
        width: 95%;
        max-height: 85vh;
    }

    .jtp-popup-overlay.jtp-position-top,
    .jtp-popup-overlay.jtp-position-bottom {
        padding: 20px;
    }

    .jtp-position-bottom-right .jtp-popup-container,
    .jtp-position-bottom-left .jtp-popup-container {
        width: 95%;
        min-width: auto;
    }

    .jtp-popup-close {
        width: 32px;
        height: 32px;
    }

    .jtp-popup-close svg {
        width: 18px;
        height: 18px;
    }
}

/* Animation for shake effect (optional, for exit intent) */
@keyframes jtp-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.jtp-popup-container.jtp-shake {
    animation: jtp-shake 0.5s ease;
}

/* Print - hide popups */
@media print {
    .jtp-popup-overlay {
        display: none !important;
    }
}
