/**
 * Codesm Popup - Frontend Styles
 */

/* Prevent body scroll when popup is open */
body.csp-popup-open {
    overflow: hidden;
}

/* Popup Overlay */
.csp-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: cspFadeIn 0.3s ease;
}

@keyframes cspFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Popup Container */
.csp-popup-container {
    position: relative;
    background: #ffffff;
    border-radius: 8px;
    max-width: 600px;
    max-height: 90vh;
    width: 100%;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: cspSlideIn 0.3s ease;
}

@keyframes cspSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.csp-popup-container .csp-popup-close {
    position: absolute !IMPORTANT;
    top: 10px;
    right: 10px;
    width: 36px !important;
    height: 36px !important;
    background: rgba(0, 0, 0, 0.1) !important;
    border: none !important;
    border-radius: 50%;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    border: none !important;
    outline: none !important;
    padding: 0 !important;
    background-image: unset !important;
    min-width: auto !important;
}

.csp-popup-close:hover {
    background: none !important;
    transform: scale(1) !important;
}

.csp-popup-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Custom Close Button Icon */
.csp-popup-close--custom {
    background: transparent;
    padding: 0;
    width: auto;
    height: auto;
}

.csp-popup-close--custom img {
    display: block;
    max-width: 36px;
    max-height: 36px;
    width: auto;
    height: auto;
}

.csp-popup-close--custom:hover {
    background: transparent;
    transform: scale(1.1);
}

/* Popup Content */
.csp-popup-content>*:first-child {
    margin-top: 0;
}

.csp-popup-content>*:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .csp-popup-overlay {
        padding: 15px;
    }

    .csp-popup-container {
        max-width: 100%;
        max-height: 95vh;
    }

    .csp-popup-content {
        padding: 20px;
    }

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

/* Gutenberg block compatibility */
.csp-popup-content .wp-block-button__link {
    cursor: pointer;
}

.csp-popup-content .wp-block-image {
    margin: 0;
}

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

/* WPBakery Page Builder Support */
.csp-popup-container--wpb {
    background: transparent;
    box-shadow: none;
    overflow: visible;
}

.csp-popup-container--wpb .csp-popup-content {
    padding: 0;
}

.csp-popup-container--wpb .csp-popup-content>.vc_row:first-child,
.csp-popup-container--wpb .csp-popup-content>.wpb_row:first-child {
    margin-top: 0;
}

.csp-popup-container--wpb .csp-popup-content>.vc_row:last-child,
.csp-popup-container--wpb .csp-popup-content>.wpb_row:last-child {
    margin-bottom: 0;
}

/* Ensure WPBakery rows have proper border-radius in popup */
.csp-popup-container--wpb .vc_row,
.csp-popup-container--wpb .wpb_row {
    border-radius: 8px;
    overflow: hidden;
}

/* WPBakery section/row backgrounds should show */
.csp-popup-container--wpb .vc_row[data-vc-full-width],
.csp-popup-container--wpb .vc_section {
    background-size: cover;
    background-position: center;
}

/* Make sure WPBakery images display properly */
.csp-popup-container--wpb .wpb_single_image img,
.csp-popup-container--wpb .vc_single_image-img {
    max-width: 100%;
    height: auto;
}