/* ==========================================================================
   Floating image + text badge
   Configurable via CMS -> Settings -> Floating Widget.
   The same .floating-badge__inner / __img / __text structure is reused by the
   admin live-preview, so keep positioning relative to __inner (not the page).
   ========================================================================== */

.floating-badge {
    position: fixed;
    z-index: 1050;
    --fb-opacity: 1;
    --fb-x: 24px;
    --fb-y: 24px;
    --fb-inset: 8px;
}

.floating-badge--bottom-right { bottom: var(--fb-y); right: var(--fb-x); }
.floating-badge--bottom-left  { bottom: var(--fb-y); left: var(--fb-x); }
.floating-badge--top-right    { top: var(--fb-y);    right: var(--fb-x); }
.floating-badge--top-left     { top: var(--fb-y);    left: var(--fb-x); }

/* The image container == the "boundary" the text is positioned against. */
.floating-badge__inner {
    position: relative;
    display: inline-block;
    opacity: var(--fb-opacity, 1);
    transition: opacity .2s ease;
}

.floating-badge__img {
    display: block;
    height: auto;
    max-width: 90vw;
    border-radius: 6px;
}

/* Text block, absolutely placed inside the image boundary. */
.floating-badge__text {
    position: absolute;
    max-width: 100%;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1.25;
    box-sizing: border-box;
    word-break: break-word;
    pointer-events: none;
}

.floating-badge__text:empty { display: none; }

/* --- Corner anchoring (which corner of the image the text hugs) ------------ */
.floating-badge__text--top-left     { top: var(--fb-inset);    left: var(--fb-inset); }
.floating-badge__text--top-right    { top: var(--fb-inset);    right: var(--fb-inset); }
.floating-badge__text--bottom-left  { bottom: var(--fb-inset); left: var(--fb-inset); }
.floating-badge__text--bottom-right { bottom: var(--fb-inset); right: var(--fb-inset); }

/* --- Placement: inside vs. just outside the image boundary ----------------- */
.floating-badge__text--inside  { --fb-inset: 8px; }
.floating-badge__text--outside { --fb-inset: 0px; }

.floating-badge__text--outside.floating-badge__text--top-left,
.floating-badge__text--outside.floating-badge__text--top-right {
    transform: translateY(-100%);
}
.floating-badge__text--outside.floating-badge__text--bottom-left,
.floating-badge__text--outside.floating-badge__text--bottom-right {
    transform: translateY(100%);
}

/* --- Dismiss button -------------------------------------------------------- */
.floating-badge__close {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 20px;
    font-size: 16px;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, .6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
}
.floating-badge__close:hover { background: rgba(0, 0, 0, .85); }

/* --- Admin preview stage --------------------------------------------------- */
.fb-stage {
    position: relative;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border: 1px dashed #ced4da;
    border-radius: 8px;
    background:
        linear-gradient(45deg, #f1f3f5 25%, transparent 25%, transparent 75%, #f1f3f5 75%),
        linear-gradient(45deg, #f1f3f5 25%, #fff 25%, #fff 75%, #f1f3f5 75%);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    overflow: hidden;
}
.fb-stage .floating-badge__img { max-width: 60%; }
