/* WP Popup Image — frontend styles.
 * Three layouts share the same .wppi-popup wrapper and differ only in
 * positioning rules below: modal (center+overlay), slide (corner),
 * bar (full-width top/bottom).
 */

.wppi-popup {
    box-sizing: border-box;
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #1f2937;
}

.wppi-popup *,
.wppi-popup *::before,
.wppi-popup *::after {
    box-sizing: border-box;
}

.wppi-popup.wppi-visible {
    display: block !important;
}

/* Overlay (modal only) */
.wppi-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    opacity: 0;
    transition: opacity 0.25s ease;
    cursor: pointer;
}

.wppi-popup.wppi-visible .wppi-overlay {
    opacity: 1;
}

/* Box (shared) */
.wppi-box {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    padding: 20px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.wppi-popup.wppi-visible .wppi-box {
    transform: scale(1);
    opacity: 1;
}

/* Defensive reset against themes that style <button> globally
 * (Elementor, page builders, generic `button { ... }` rules). We bump
 * specificity with `.wppi-popup` and use !important on the reset properties
 * so theme rules of equal or higher specificity loaded after this file
 * can't reintroduce borders, backgrounds, shadows, or hover effects.
 *
 * `color` is pinned in this combined rule so the X stays visible on hover
 * even when the theme tries to swap it to white/transparent. */
.wppi-popup .wppi-close,
.wppi-popup .wppi-close:hover,
.wppi-popup .wppi-close:focus,
.wppi-popup .wppi-close:active {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    border-radius: 0 !important;
    color: #1f2937 !important;
    opacity: 1 !important;
    text-decoration: none !important;
    filter: none !important;
}

.wppi-popup .wppi-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}

.wppi-heading {
    margin: 0 32px 12px 0;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    color: #111827;
}

.wppi-image-wrap {
    margin: 0 0 12px;
    text-align: center;
}

.wppi-image-wrap:empty {
    display: none;
}

.wppi-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: inline-block;
}

.wppi-image-link {
    display: inline-block;
    line-height: 0;
    text-decoration: none;
}

.wppi-description {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.5;
    color: #374151;
}

.wppi-cta-wrap {
    margin: 0;
    text-align: center;
}

.wppi-cta {
    display: inline-block;
    padding: 12px 28px;
    background: #2563eb;
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.15s, transform 0.15s;
}

.wppi-cta:hover,
.wppi-cta:focus {
    background: #1d4ed8;
    transform: translateY(-1px);
    color: #fff;
}

/* ---- Layout: modal (centered with overlay) ---- */
.wppi-layout-modal {
    inset: 0;
}

.wppi-layout-modal .wppi-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
}

.wppi-layout-modal.wppi-visible .wppi-box {
    transform: translate(-50%, -50%) scale(1);
}

/* ---- Layout: slide-in (corner) ---- */
.wppi-layout-slide {
    width: auto;
    max-width: 380px;
}

.wppi-layout-slide .wppi-box {
    width: auto;
    max-width: 380px;
    transform: translateY(20px);
}

.wppi-layout-slide.wppi-visible .wppi-box {
    transform: translateY(0);
}

.wppi-slide-bottom-right { bottom: 20px; right: 20px; top: auto; left: auto; }
.wppi-slide-bottom-left  { bottom: 20px; left: 20px;  top: auto; right: auto; }
.wppi-slide-top-right    { top: 20px;    right: 20px; bottom: auto; left: auto; }
.wppi-slide-top-left     { top: 20px;    left: 20px;  bottom: auto; right: auto; }

/* ---- Layout: bar (full-width top/bottom) ---- */
.wppi-layout-bar {
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
}

.wppi-layout-bar.wppi-bar-top    { top: 0;    bottom: auto; }
.wppi-layout-bar.wppi-bar-bottom { bottom: 0; top: auto; }

.wppi-layout-bar .wppi-box {
    width: 100%;
    max-width: 100% !important;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 50px 14px 20px;
}

.wppi-layout-bar .wppi-image-wrap {
    margin: 0;
    flex-shrink: 0;
}

.wppi-layout-bar .wppi-image {
    max-height: 60px;
    width: auto;
    border-radius: 4px;
}

.wppi-layout-bar .wppi-heading {
    margin: 0;
    font-size: 16px;
}

.wppi-layout-bar .wppi-description {
    margin: 0;
    font-size: 14px;
    flex: 1;
}

.wppi-layout-bar .wppi-cta-wrap {
    margin: 0;
    flex-shrink: 0;
}

.wppi-layout-bar .wppi-cta {
    padding: 8px 20px;
    font-size: 14px;
}

.wppi-layout-bar.wppi-bar-top .wppi-box    { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }
.wppi-layout-bar.wppi-bar-bottom .wppi-box { box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15); }

/* Trigger element styling (kept neutral so themes can override) */
.wppi-trigger {
    cursor: pointer;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    .wppi-layout-slide {
        left: 10px !important;
        right: 10px !important;
        max-width: none;
    }
    .wppi-layout-slide .wppi-box {
        max-width: none;
        width: 100%;
    }
    .wppi-layout-bar .wppi-box {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 8px;
        padding: 14px 36px;
    }
    .wppi-layout-bar .wppi-image-wrap {
        text-align: center;
    }
    .wppi-heading {
        font-size: 18px;
    }
}
