/* Frame Builder Plus — frontend plus icon overlay
 * The button is injected by frontend.js on any <img> whose src matches a
 * tagged image URL. It is a small, circular, pressable plus icon that sits
 * at the top-right of the image and links to the custom-framing flow.
 */

/* v1.3.49: CRITICAL FIX — fbp-wrap was shrinking full-width Elementor images.
 * The old display:inline-block + width:auto caused the <span> wrapper to be
 * only as wide as the image's intrinsic size, breaking Elementor's full-width
 * layout. Now we use display:contents (makes the wrapper invisible to layout)
 * + position:relative is set INLINE by the JS on the IMG's PARENT instead.
 * This way the image keeps its original layout 100% — no shrink, no reflow. */
.fbp-wrap {
        position: static;
        display: contents;
}

.fbp-wrap > img,
.fbp-wrap > picture {
        /* Intentionally empty — preserve original styles. */
}

/* v1.3.53: The plus button is now a COMPLETELY PLAIN transparent wrapper.
 * The uploaded SVG asset (circle-plus-button-responsive.svg) is the entire
 * button visual — white circle, dark border, drop shadow, dark plus glyph.
 * There is NO background, NO border, NO box-shadow, NO hover effect, NO
 * transition on the button element itself. The SVG <img> fills the button
 * 1:1 and draws everything. Width/height come from --fbp-plus-size so the
 * admin's size setting (and the per-image Position Icon size) controls it.
 * All declarations use !important to override any cached older CSS. */
.fbp-plus-btn {
        position: absolute !important;
        z-index: 9999 !important;
        top: 10px;
        right: 10px;
        width: var(--fbp-plus-size, 34px) !important;
        height: var(--fbp-plus-size, 34px) !important;
        min-width: 16px !important;
        min-height: 16px !important;
        border-radius: 0 !important;
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        cursor: pointer !important;
        border: none !important;
        background: transparent !important;
        color: transparent !important;
        box-shadow: none !important;
        transition: none !important;
        text-decoration: none !important;
        line-height: 0 !important;
        font-size: 0 !important;
        -webkit-tap-highlight-color: transparent !important;
        font-family: "Poppins", inherit !important;
        overflow: visible !important;
        box-sizing: border-box !important;
        outline: none !important;
}

/* Custom-position class — when admin sets icon_x/icon_y.
 * The JS sets inline left/top/transform; this just ensures right:auto. */
.fbp-plus-btn.fbp-plus-btn-custom {
        right: auto;
        transform: translate(-50%, -50%);
}

/* v1.3.53: NO hover/active/focus effects at all. The SVG is the visual —
 * user requested "koi border na ho na hi hover ho ye simple sa ho jesa svg"
 * (no border, no hover, just simple like the SVG). Removed all scale/background
 * changes on hover/focus/active. */
.fbp-plus-btn:hover,
.fbp-plus-btn:focus-visible,
.fbp-plus-btn:active,
.fbp-plus-btn.fbp-plus-btn-custom:hover,
.fbp-plus-btn.fbp-plus-btn-custom:focus-visible,
.fbp-plus-btn.fbp-plus-btn-custom:active {
        transform: translate(-50%, -50%) !important;
        background: transparent !important;
        color: transparent !important;
        box-shadow: none !important;
        border: none !important;
        outline: none !important;
}
/* Non-custom position: no transform on hover either. */
.fbp-plus-btn:not(.fbp-plus-btn-custom):hover,
.fbp-plus-btn:not(.fbp-plus-btn-custom):focus-visible,
.fbp-plus-btn:not(.fbp-plus-btn-custom):active {
        transform: none !important;
}

/* SVG plus glyph — fills the button completely so the uploaded SVG IS the
 * entire button visual. v1.3.53: 100% fill, no offset, no centering tricks. */
.fbp-plus-btn .fbp-plus-glyph {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        pointer-events: none !important;
        transform: none !important;
}

.fbp-plus-btn .fbp-plus-glyph svg,
.fbp-plus-btn .fbp-plus-glyph img {
        width: 100% !important;
        height: 100% !important;
        display: block !important;
        pointer-events: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
}

/* NOTE: v1.3.108 had aggressive "html body" overrides here that accidentally
 * affected theme <img>/<a> elements and broke site layouts. REMOVED in v1.3.110.
 * The shadow fix in the SVG itself (circle-plus-button-responsive.svg) is
 * sufficient — no global CSS overrides needed. */

/* v1.3.111: SCOPED fix — kills the soft square box-shadow that themes apply to
 * every <img> tag (e.g. "box-shadow: 0 0 10px rgba(0,0,0,0.15)" on .entry-content img).
 * Pixel analysis of the live site confirmed: the "box" behind the plus icon is a
 * SOFT-EDGED SQUARE — a CSS box-shadow on the <img>, NOT a circular SVG shadow.
 *
 * This rule is HIGHLY SCOPED: it only targets the .fbp-plus-glyph img (our icon's
 * inner img element), so it cannot leak into the theme. No "html body" prefix
 * (that was the v1.3.108 mistake). Specificity comes from the long class chain,
 * which beats typical theme rules like ".entry-content img" without affecting
 * anything else on the page. */
.fbp-plus-btn .fbp-plus-glyph img,
.fbp-plus-glyph img,
a.fbp-plus-btn .fbp-plus-glyph img,
span.fbp-plus-btn .fbp-plus-glyph img,
.fbp-plus-btn .fbp-plus-glyph picture img {
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
        filter: none !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        outline: none !important;
}

/* v1.3.112: SCOPED button + wrapper override. VLM pixel analysis of the live
 * site showed a LIGHTER GRAYISH RECTANGLE on the image where the icon sits.
 * This is a theme applying background to <a> or wrapper elements (e.g.
 * ".entry-content a { background: #f5f5f5 !important }" with higher specificity
 * than our single .fbp-plus-btn class).
 *
 * Fix: double the class (.fbp-plus-btn.fbp-plus-btn) to raise specificity to
 * 0,0,2,0 — beats typical theme "!important" rules. Also clear any background
 * on the plugin's own wrapper spans (.fbp-wrap, .fbp-img-abs-wrap) which are
 * 100% safe to target (they're created by our JS, not the theme).
 * NO "html body" prefix — stays scoped, cannot leak. */
.fbp-plus-btn.fbp-plus-btn,
a.fbp-plus-btn.fbp-plus-btn,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn-custom,
.fbp-wrap.fbp-wrap,
.fbp-img-abs-wrap.fbp-img-abs-wrap {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
        padding: 0 !important;
        border: none !important;
        outline: none !important;
}

/* v1.3.115: NUCLEAR OVERRIDE — defeats orphan/legacy inline CSS.
 * User's site has OLD inline <style> CSS (from a previous plugin version,
 * orphan snippet, or cache) that sets:
 *   .fbp-plus-btn { min-width:28px; min-height:28px; border-radius:50%;
 *   background:rgba(15,15,15,0.55); backdrop-filter:blur(8px); overflow:hidden; ... }
 * This forces the 16px icon into a 28x28 dark frosted box on the tagged image.
 *
 * Fix: Use triple-class selector + !important on EVERY property the legacy CSS sets.
 * Triple-class (0,0,3,0) beats single-class (0,0,1,0) by specificity.
 * !important overrides any non-!important legacy values.
 * Together they cannot be beaten by orphan CSS regardless of load order.
 * SAFE: only matches .fbp-plus-btn elements (plugin's own button). */
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn-custom,
a.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn,
a.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn-custom {
        min-width: var(--fbp-plus-size, 34px) !important;
        min-height: var(--fbp-plus-size, 34px) !important;
        width: var(--fbp-plus-size, 34px) !important;
        height: var(--fbp-plus-size, 34px) !important;
        border-radius: 0 !important;
        border: none !important;
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        color: transparent !important;
        overflow: visible !important;
        transition: none !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
        outline: none !important;
        padding: 0 !important;
        margin: 0 !important;
}

/* Also kill hover/active states that the legacy CSS adds (white bg + box-shadow on hover). */
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn:hover,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn:focus-visible,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn:active,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn-custom:hover,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn-custom:focus-visible,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn-custom:active {
        background: transparent !important;
        background-color: transparent !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
        border: none !important;
        outline: none !important;
        transform: translate(-50%, -50%) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
}

/* Kill backdrop-filter on glyph/img too (legacy CSS may apply to children). */
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn .fbp-plus-glyph,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn .fbp-plus-glyph img,
.fbp-plus-btn.fbp-plus-btn.fbp-plus-btn .fbp-plus-glyph svg {
        background: transparent !important;
        background-color: transparent !important;
        background-image: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        box-shadow: none !important;
        -webkit-box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
}

.fbp-plus-btn .fbp-plus-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        border: 0;
}

/* v1.3.49: Removed a > .fbp-wrap rule — no longer wrapping images in spans.
 * The plus button is now appended directly to the image's parent element. */

/* v1.3.61: Wrapper span for absolutely-positioned tagged images (Elementor
 * HTML-widget frame overlays). The JS (wrapAbsoluteImage) copies the image's
 * inline left/top/width/height to this span, then moves the image inside.
 * This span IS the positioning context for the plus button — it has the same
 * size as the image, so the button's top-right / custom x/y% lands on the image.
 * overflow:visible so a button positioned near the image edge (or a custom
 * position slightly outside) isn't clipped. */
.fbp-img-abs-wrap {
        overflow: visible !important;
}
.fbp-img-abs-wrap > img {
        display: block !important;
        width: 100% !important;
        height: 100% !important;
}

/* Responsive: slightly closer to edge on small screens.
 * v1.3.56 FIX: NO !important here — same reason as the base rule. The JS sets
 * inline left/top for custom-positioned buttons; !important would lock mobile
 * buttons at top:6px/right:6px and ignore the admin's custom position. */
@media (max-width: 600px) {
        .fbp-plus-btn {
                top: 6px;
                right: 6px;
        }
}

/* ============ v1.3.60: Image lightbox popup ============
 * Full-screen overlay shown when the plus icon is clicked on a tagged image.
 * The image is centered, zoomable (1x–5x), pannable when zoomed, and closeable.
 * Uses Poppins (enqueued via fc-poppins / fbp-poppins) to match the rest of the
 * plugin's typography. High z-index (above theme modals) so it always shows on
 * top. All rules scoped under .fbp-lightbox so they never leak into the theme. */
.fbp-lightbox {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2147483647 !important; /* max — above everything */
        background: rgba(0, 0, 0, 0.92) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 24px !important;
        box-sizing: border-box !important;
        font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
        -webkit-tap-highlight-color: transparent !important;
}

/* Image wrapper — holds the <img>. overflow:hidden so a zoomed-in panned image
 * doesn't spill over the controls. Centered, max 92vw/82vh so it always fits. */
.fbp-lightbox .fbp-lightbox-img-wrap {
        position: relative !important;
        max-width: 92vw !important;
        max-height: 80vh !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        flex: 0 1 auto !important;
}

.fbp-lightbox .fbp-lightbox-img {
        max-width: 92vw !important;
        max-height: 80vh !important;
        width: auto !important;
        height: auto !important;
        object-fit: contain !important;
        display: block !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -webkit-user-drag: none !important;
        transform-origin: center center !important;
        transition: transform 0.08s ease-out !important;
        background: #fff !important;
        box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6) !important;
}

/* Loading / error text */
.fbp-lightbox .fbp-lightbox-loader {
        position: absolute !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        color: #fff !important;
        font-size: 15px !important;
        font-weight: 400 !important;
        letter-spacing: 0.02em !important;
        pointer-events: none !important;
}

/* Controls bar — zoom out / reset / zoom in / readout / close. Top-right of the
 * viewport so the user can always reach them. Frosted-glass pill. */
.fbp-lightbox .fbp-lightbox-controls {
        position: fixed !important;
        top: 20px !important;
        right: 20px !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        background: rgba(20, 20, 20, 0.75) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        backdrop-filter: blur(10px) !important;
        padding: 6px !important;
        border-radius: 999px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
        z-index: 2 !important;
}

.fbp-lightbox .fbp-lightbox-btn {
        font-family: inherit !important;
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        border-radius: 50% !important;
        border: none !important;
        background: rgba(255, 255, 255, 0.12) !important;
        color: #fff !important;
        font-size: 20px !important;
        font-weight: 500 !important;
        line-height: 1 !important;
        padding: 0 !important;
        margin: 0 !important;
        cursor: pointer !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: background 0.15s ease, transform 0.1s ease !important;
        box-sizing: border-box !important;
}
.fbp-lightbox .fbp-lightbox-btn:hover { background: rgba(255, 255, 255, 0.28) !important; }
.fbp-lightbox .fbp-lightbox-btn:active { transform: scale(0.92) !important; }
.fbp-lightbox .fbp-lightbox-btn:focus-visible { outline: 2px solid #fff !important; outline-offset: 2px !important; }

/* Close button — slightly larger + red-ish hover so it stands out. */
.fbp-lightbox .fbp-lightbox-close {
        font-size: 26px !important;
        background: rgba(220, 50, 50, 0.85) !important;
}
.fbp-lightbox .fbp-lightbox-close:hover { background: rgba(240, 70, 70, 1) !important; }

/* Zoom readout (e.g. "150%"). */
.fbp-lightbox .fbp-lightbox-zoom-readout {
        color: #fff !important;
        font-size: 13px !important;
        font-weight: 500 !important;
        font-variant-numeric: tabular-nums !important;
        min-width: 44px !important;
        text-align: center !important;
        padding: 0 6px !important;
        user-select: none !important;
}

/* Footer — "Customize this frame" link + usage hint. Bottom-center. */
.fbp-lightbox .fbp-lightbox-footer {
        position: fixed !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px !important;
        z-index: 2 !important;
        max-width: calc(100vw - 40px) !important;
}

.fbp-lightbox .fbp-lightbox-customize {
        font-family: inherit !important;
        display: inline-block !important;
        background: #fff !important;
        color: #111 !important;
        text-decoration: none !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        padding: 11px 22px !important;
        border-radius: 999px !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
        transition: transform 0.12s ease, box-shadow 0.12s ease !important;
        white-space: nowrap !important;
}
.fbp-lightbox .fbp-lightbox-customize:hover {
        transform: translateY(-1px) !important;
        box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45) !important;
}

.fbp-lightbox .fbp-lightbox-hint {
        color: rgba(255, 255, 255, 0.55) !important;
        font-size: 12px !important;
        font-weight: 400 !important;
        letter-spacing: 0.01em !important;
        user-select: none !important;
}

/* Mobile tweaks — smaller controls, smaller hint, image takes more space. */
@media (max-width: 600px) {
        .fbp-lightbox { padding: 12px !important; }
        .fbp-lightbox .fbp-lightbox-controls {
                top: 12px !important;
                right: 12px !important;
                gap: 4px !important;
        }
        .fbp-lightbox .fbp-lightbox-btn {
                width: 36px !important;
                height: 36px !important;
                min-width: 36px !important;
                min-height: 36px !important;
                font-size: 18px !important;
        }
        .fbp-lightbox .fbp-lightbox-close { font-size: 22px !important; }
        .fbp-lightbox .fbp-lightbox-zoom-readout { font-size: 12px !important; min-width: 36px !important; }
        .fbp-lightbox .fbp-lightbox-img-wrap,
        .fbp-lightbox .fbp-lightbox-img {
                max-width: 96vw !important;
                max-height: 72vh !important;
        }
        .fbp-lightbox .fbp-lightbox-footer { bottom: 12px !important; }
        .fbp-lightbox .fbp-lightbox-customize { font-size: 14px !important; padding: 9px 18px !important; }
        .fbp-lightbox .fbp-lightbox-hint { font-size: 10px !important; }
}

/* Respect reduced motion. */
@media (prefers-reduced-motion: reduce) {
        .fbp-lightbox .fbp-lightbox-img,
        .fbp-lightbox .fbp-lightbox-btn,
        .fbp-lightbox .fbp-lightbox-customize { transition: none !important; }
}

/* ============= Reference tagged-photo popup ============= */
.fbp-lightbox {
        position: fixed !important;
        inset: 0 !important;
        z-index: 2147483000 !important;
        display: grid !important;
        place-items: center !important;
        padding: 24px !important;
        background: rgba(0, 0, 0, .28) !important;
}
.fbp-lightbox-modal {
        position: relative !important;
        width: min(620px, 92vw) !important;
        max-width: 620px !important;
        aspect-ratio: 295 / 200 !important;
        height: auto !important;
        max-height: calc(100vh - 48px) !important;
        overflow: hidden !important;
        padding: 46px 53px 40px 61px !important;
        background: #fff !important;
        box-shadow: 0 1px 8px rgba(0, 0, 0, .15) !important;
        box-sizing: border-box !important;
}
.fbp-lightbox-modal .fbp-lightbox-img-wrap {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: #fff !important;
}
.fbp-lightbox-modal .fbp-lightbox-img {
        display: block !important;
        width: auto !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: 100% !important;
        object-fit: contain !important;
        object-position: center !important;
        transform-origin: center center !important;
        box-shadow: none !important;
}
.fbp-lightbox-modal .fbp-lightbox-close {
        position: absolute !important;
        top: 14px !important;
        right: 14px !important;
        z-index: 3 !important;
        display: grid !important;
        place-items: center !important;
        width: 22px !important;
        height: 22px !important;
        min-width: 22px !important;
        min-height: 22px !important;
        padding: 0 !important;
        border: 1px solid #999 !important;
        border-radius: 1px !important;
        background: rgba(255, 255, 255, .94) !important;
        color: #555 !important;
        font: 18px/18px Arial, Helvetica, sans-serif !important;
        box-shadow: none !important;
        cursor: pointer !important;
}
.fbp-lightbox-modal .fbp-lightbox-close:hover,
.fbp-lightbox-modal .fbp-lightbox-close:focus-visible {
        background: #eee !important;
        color: #222 !important;
        outline: 1px solid #555 !important;
}
.fbp-lightbox .fbp-lightbox-controls,
.fbp-lightbox .fbp-lightbox-footer { display: none !important; }
.fbp-lightbox-modal .fbp-lightbox-loader {
        position: absolute !important;
        inset: 46px 53px 40px 61px !important;
        z-index: 1 !important;
        display: none !important;
        place-items: center !important;
        background: #fff !important;
        color: #555 !important;
        font: 14px Arial, Helvetica, sans-serif !important;
        pointer-events: none !important;
}
@media (max-width: 900px) and (min-width: 601px) {
        .fbp-lightbox-modal {
                width: min(620px, calc(100vw - 48px)) !important;
                padding: 7.4vw 8.5vw 6.5vw 9.8vw !important;
        }
        .fbp-lightbox-modal .fbp-lightbox-loader {
                inset: 7.4vw 8.5vw 6.5vw 9.8vw !important;
        }
}
@media (max-width: 600px) {
        .fbp-lightbox { padding: 12px !important; }
        .fbp-lightbox-modal {
                width: calc(100vw - 24px) !important;
                max-height: calc(100vh - 24px) !important;
                padding: 24px 18px 20px !important;
        }
        .fbp-lightbox-modal .fbp-lightbox-img-wrap,
        .fbp-lightbox-modal .fbp-lightbox-img {
                max-height: 100% !important;
        }
        .fbp-lightbox-modal .fbp-lightbox-close {
                top: 8px !important;
                right: 8px !important;
                width: 22px !important;
                height: 22px !important;
                min-width: 22px !important;
                min-height: 22px !important;
                font-size: 17px !important;
                line-height: 17px !important;
        }
        .fbp-lightbox-modal .fbp-lightbox-loader {
                inset: 24px 18px 20px !important;
        }
}
@media (max-width: 360px) {
        .fbp-lightbox-modal { padding: 20px 14px 16px !important; }
        .fbp-lightbox-modal .fbp-lightbox-loader { inset: 20px 14px 16px !important; }
}
