/* Ad Manager Pro - Frontend Styles */

/* Popup Overlay */
.pb-wrapper-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, var(--overlay-opacity, 0.7));
    z-index: 999999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pb-wrapper-overlay.active {
    display: flex;
    opacity: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Popup Container */
.pb-content-box {
    position: relative;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 16px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: 90%;
    width: auto;
    max-height: 90vh;
    min-width: 300px;
    /* Prevent collapsing */
    overflow: visible;
    z-index: 1001;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 480px) {
    .pb-content-box {
        min-width: auto;
        width: 90%;
        max-width: 340px;
        overflow: visible;
        /* Allow close button to hang outside */
    }

    .pb-box-close {
        width: 30px;
        height: 30px;
        top: -10px;
        right: -10px;
        font-size: 16px;
    }
}

.pb-wrapper-overlay.active .pb-content-box {
    transform: scale(1);
    opacity: 1;
}

/* Position Variants */
.pb-box-center {
    margin: auto;
}

.pb-box-tr {
    position: absolute;
    top: 20px;
    right: 20px;
}

.pb-box-tl {
    position: absolute;
    top: 20px;
    left: 20px;
}

.pb-box-br {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.pb-box-bl {
    position: absolute;
    bottom: 20px;
    left: 20px;
}

/* Close Button */
/* Close Button */
/* Close Button */
.pb-box-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    background: var(--close-btn-color, #333);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    font-family: Arial, sans-serif;
    /* Consistent font for X */
    font-size: 20px;
    font-weight: bold;
    line-height: 0;
    /* Reset line height */
    padding: 0 0 2px 0;
    /* Optical visual adjustment */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1002;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.pb-box-close:hover {
    transform: scale(1.1);
    background: #000;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}


/* Popup Content */
.pb-box-param {
    padding: 0;
    /* Remove padding to let image fill edge to edge if needed */
    text-align: center;
}

.pb-box-param .pb-view-item {
    display: block;
    margin: 0 auto;
}

.pb-box-param .pb-view-graphic {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

.pb-box-param .pb-view-anchor {
    display: block;
}

/* Popup Footer CTA */
.pb-box-footer {
    padding: 15px 20px 20px;
    text-align: center;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.pb-box-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow:
        0 8px 20px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.pb-box-action:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 28px rgba(102, 126, 234, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: white;
}

/* Animation Variants */
/* Fade */
/* Fade animation handled by base class opacity transition */

/* Slide Up */
[data-animation="slide-up"] .pb-content-box {
    transform: translateY(100px) scale(0.9);
}

[data-animation="slide-up"].active .pb-content-box {
    transform: translateY(0) scale(1);
}

/* Slide Down */
[data-animation="slide-down"] .pb-content-box {
    transform: translateY(-100px) scale(0.9);
}

[data-animation="slide-down"].active .pb-content-box {
    transform: translateY(0) scale(1);
}

/* Zoom */
[data-animation="zoom"] .pb-content-box {
    transform: scale(0.3);
}

[data-animation="zoom"].active .pb-content-box {
    transform: scale(1);
}

/* Bounce */
[data-animation="bounce"] .pb-content-box {
    animation: none;
}

[data-animation="bounce"].active .pb-content-box {
    animation: ampBounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes ampBounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.95);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Inline Ad Banner Styles */
.pb-view-item {
    display: inline-block;
    max-width: 100%;
    line-height: 0;
}

.pb-view-item .pb-view-graphic {
    max-width: 100%;
    height: auto;
}

.pb-view-item .pb-view-anchor {
    display: block;
    transition: opacity 0.2s ease;
}

.pb-view-item .pb-view-anchor:hover {
    opacity: 0.9;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .pb-content-box {
        border-radius: 12px;
        margin: 10px;
    }

    .pb-box-close {
        top: -8px;
        right: -8px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .pb-box-action {
        padding: 10px 24px;
        font-size: 13px;
    }

    .pb-box-tr,
    .pb-box-tl,
    .pb-box-br,
    .pb-box-bl {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
    }
}