/**
 * 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;
    overflow: hidden;
    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;
}

/* Title bar: inline PHP controls the actual padding/margins. Keep the bar edge-to-edge. */
.spb-popup-title {
    position: relative !important;
    box-sizing: border-box !important;
    width: calc(100% + 60px) !important;
    margin-top: -30px !important;
    margin-right: -30px !important;
    margin-bottom: 15px !important;
    margin-left: -30px !important;
    border-radius: 0 !important;
}

.spb-popup-close {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 999 !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    line-height: 36px !important;
    text-align: center !important;
}

.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;
    }
}


/* =========================================================
   SMART POPUP BUILDER - DISTINCT POPUP TEMPLATES
   ========================================================= */

/* DEFAULT: clean professional card */
.spb-popup-box.spb-template-default {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 18px 55px rgba(0,0,0,.22);
    border: 1px solid #e5e5e5;
}
.spb-popup-box.spb-template-default .spb-popup-title { font-size: 27px; font-weight: 600; line-height: 1.3; }
.spb-popup-box.spb-template-default .spb-popup-content { line-height: 1.6; }

/* MODERN: glassy/soft card, large typography, pill CTA */
.spb-popup-box.spb-template-modern {
    background: linear-gradient(145deg,#ffffff 0%,#f5f8ff 100%);
    border-radius: 24px;
    border: 1px solid rgba(80,100,150,.14);
    box-shadow: 0 30px 90px rgba(40,60,100,.24);
    padding: 34px;
}
.spb-popup-box.spb-template-modern .spb-popup-title {
    font-size: 32px; font-weight: 750; letter-spacing: -.6px; line-height: 1.15;
}
.spb-popup-box.spb-template-modern .spb-popup-content { font-size: 16px; line-height: 1.8; color: #4a5568; }
.spb-popup-box.spb-template-modern .spb-popup-button { border-radius: 999px; padding: 13px 28px; font-weight: 700; box-shadow: 0 8px 22px rgba(34,113,177,.20); }
.spb-popup-box.spb-template-modern .spb-popup-close { border-radius: 10px; }

/* OFFER: promotional card with strong CTA and accent edge */
.spb-popup-box.spb-template-offer {
    background: #fffdf8;
    border-radius: 6px;
    border: 0;
    border-left: 7px solid #f59e0b;
    box-shadow: 0 25px 65px rgba(120,75,0,.20);
    padding: 32px;
}
.spb-popup-box.spb-template-offer .spb-popup-title {
    font-size: 34px; font-weight: 800; line-height: 1.08; letter-spacing: -.7px;
}
.spb-popup-box.spb-template-offer .spb-popup-content { font-size: 16px; line-height: 1.7; }
.spb-popup-box.spb-template-offer .spb-popup-button {
    border-radius: 5px; padding: 13px 30px; font-weight: 800;
    box-shadow: 0 10px 24px rgba(245,158,11,.25);
    transform: translateY(0); transition: transform .2s ease, box-shadow .2s ease;
}
.spb-popup-box.spb-template-offer .spb-popup-button:hover { transform: translateY(-2px); }

/* DARK: premium dark panel */
.spb-popup-box.spb-template-dark {
    background: #101217;
    color: #f4f4f5;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.12);
    box-shadow: 0 35px 100px rgba(0,0,0,.58);
    padding: 34px;
}
.spb-popup-box.spb-template-dark .spb-popup-title { color: #fff; font-size: 30px; font-weight: 750; line-height: 1.2; }
.spb-popup-box.spb-template-dark .spb-popup-content { color: #c9cbd1; line-height: 1.8; }
.spb-popup-box.spb-template-dark .spb-popup-content a,
.spb-popup-box.spb-template-dark .spb-custom-html a { color: #8ab4ff; }
.spb-popup-box.spb-template-dark .spb-popup-button { border-radius: 10px; padding: 13px 26px; font-weight: 700; }
.spb-popup-box.spb-template-dark .spb-popup-close { background: rgba(255,255,255,.12); color: #fff; }

/* IMAGE FOCUS: image becomes the hero/header of the popup */
.spb-popup-box.spb-template-image-focus {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
    box-shadow: 0 30px 85px rgba(0,0,0,.28);
}
.spb-popup-box.spb-template-image-focus .spb-popup-image {
    margin: 0;
    width: 100%;
    overflow: hidden;
}
.spb-popup-box.spb-template-image-focus .spb-popup-image img {
    display: block; width: 100%; max-width: none; max-height: 330px; object-fit: cover;
}
.spb-popup-box.spb-template-image-focus .spb-popup-title,
.spb-popup-box.spb-template-image-focus .spb-popup-content,
.spb-popup-box.spb-template-image-focus .spb-popup-button-wrap {
    margin-left: 34px; margin-right: 34px;
}
.spb-popup-box.spb-template-image-focus .spb-popup-title { font-size: 30px; font-weight: 750; line-height: 1.2; margin-top: 28px; }
.spb-popup-box.spb-template-image-focus .spb-popup-content { line-height: 1.7; }
.spb-popup-box.spb-template-image-focus .spb-popup-button { border-radius: 8px; padding: 12px 25px; font-weight: 700; }

@media (max-width:767px) {
    .spb-popup-box.spb-template-modern,
    .spb-popup-box.spb-template-offer,
    .spb-popup-box.spb-template-dark { padding: 24px; }
    .spb-popup-box.spb-template-modern .spb-popup-title,
    .spb-popup-box.spb-template-offer .spb-popup-title,
    .spb-popup-box.spb-template-dark .spb-popup-title,
    .spb-popup-box.spb-template-image-focus .spb-popup-title { font-size: 24px; }
    .spb-popup-box.spb-template-image-focus .spb-popup-title,
    .spb-popup-box.spb-template-image-focus .spb-popup-content,
    .spb-popup-box.spb-template-image-focus .spb-popup-button-wrap { margin-left: 20px; margin-right: 20px; }
}
