/**
 * Smart Popup Builder - Frontend Styles
 */

/* Overlay */
.spb-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    display: none;
    background: rgba(0, 0, 0, 0.55);
}

.spb-popup-overlay.spb-is-visible {
    display: flex;
}

/* Wrapper */
.spb-popup-wrap {
    position: relative;
    width: 100%;
    min-height: 100%;
    display: flex;
    justify-content: center;
    padding: 30px 20px;
    box-sizing: border-box;
}

/* Positions */
.spb-position-center .spb-popup-wrap {
    align-items: center;
}

.spb-position-top .spb-popup-wrap {
    align-items: flex-start;
}

.spb-position-bottom .spb-popup-wrap {
    align-items: flex-end;
}

/* Popup Box */
.spb-popup-box {
    position: relative;
    width: 500px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 30px;
    background: #ffffff;
    color: #222222;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    overflow-wrap: break-word;
}

/* Close Button */
.spb-popup-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 10;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    font-size: 24px;
    line-height: 34px;
    text-align: center;
    cursor: pointer;
}

.spb-popup-close:hover {
    background: rgba(0, 0, 0, 0.14);
}

/* Standard Content */
.spb-popup-image {
    margin-bottom: 20px;
}

.spb-popup-image img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.spb-popup-title {
    margin: 0 0 15px;
}

.spb-popup-content {
    margin-bottom: 20px;
}

.spb-popup-content p:last-child {
    margin-bottom: 0;
}

.spb-popup-button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    background: #2271b1;
    color: #ffffff;
    text-decoration: none;
}

.spb-popup-button:hover,
.spb-popup-button:focus {
    color: #ffffff;
    text-decoration: none;
    opacity: 0.9;
}

/* Custom HTML */
.spb-custom-html img {
    max-width: 100%;
    height: auto;
}

/*
 * Animations
 *
 * Keyframes are used instead of transitions because the popup overlay
 * changes from display:none to display:flex when opened. This guarantees
 * the entrance animation runs even when the popup is shown immediately
 * on page load.
 */

.spb-animation-fade.spb-is-visible .spb-popup-box {
    animation: spbFadeIn 0.35s ease both;
}

.spb-animation-zoom.spb-is-visible .spb-popup-box {
    animation: spbZoomIn 0.35s ease both;
}

.spb-animation-slide.spb-is-visible .spb-popup-box {
    animation: spbSlideUp 0.40s ease both;
}

.spb-animation-none.spb-is-visible .spb-popup-box {
    animation: none;
    opacity: 1;
    transform: none;
}

@keyframes spbFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spbZoomIn {
    from {
        opacity: 0;
        transform: scale(0.82);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spbSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .spb-animation-fade.spb-is-visible .spb-popup-box,
    .spb-animation-zoom.spb-is-visible .spb-popup-box,
    .spb-animation-slide.spb-is-visible .spb-popup-box {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Responsive */
@media (max-width: 767px) {
    .spb-popup-wrap {
        padding: 20px 15px;
    }

    .spb-popup-box {
        width: 100% !important;
        padding: 25px 20px;
    }
}
