/* Global Back to Top. A single button, rendered only when enabled. */
.nx-btt{box-sizing:border-box;position:fixed;inset:auto;bottom:var(--nx-btt-bottom,28px);right:var(--nx-btt-side,28px);z-index:var(--nx-btt-z,9998);display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:var(--nx-btt-size,50px);min-width:var(--nx-btt-size,50px);padding:var(--nx-btt-padding-top,10px) var(--nx-btt-padding-right,15px) var(--nx-btt-padding-bottom,10px) var(--nx-btt-padding-left,15px);cursor:pointer;font:600 13px/1.2 system-ui,-apple-system,"Segoe UI",sans-serif;white-space:nowrap;border:var(--nx-btt-border-width,0px) solid var(--nx-btt-border,#343e76);color:var(--nx-btt-fg,#fff);background:var(--nx-btt-bg,#343e76);border-radius:var(--nx-btt-radius,14px);opacity:0;visibility:hidden;pointer-events:none;transform:translateY(10px);isolation:isolate;transition:opacity .18s ease,visibility .18s ease,transform var(--nx-btt-hover-duration,240ms) var(--nx-btt-easing,ease),background-color var(--nx-btt-hover-duration,240ms) var(--nx-btt-easing,ease),color var(--nx-btt-hover-duration,240ms) var(--nx-btt-easing,ease),border-color var(--nx-btt-hover-duration,240ms) var(--nx-btt-easing,ease),box-shadow var(--nx-btt-hover-duration,240ms) var(--nx-btt-easing,ease)}
.nx-btt--circle,.nx-btt--pill{border-radius:9999px}.nx-btt--square{border-radius:0}
.nx-btt[data-shadow="1"]{box-shadow:0 8px 26px rgba(18,25,56,var(--nx-btt-shadow-strength,.22))}
.nx-btt[data-active="1"]{opacity:1;visibility:visible;pointer-events:auto;transform:translateY(0)}
.nx-btt:hover{background:var(--nx-btt-hover-bg,#4454bf);color:var(--nx-btt-hover-fg,#fff);border-color:var(--nx-btt-hover-border,var(--nx-btt-border))}
.nx-btt:focus-visible{outline:3px solid #2684ff;outline-offset:4px}
.nx-btt--fade{transform:none!important}.nx-btt--none{transition:none!important;transform:none!important}
.nx-btt__inner{display:inline-flex;align-items:center;justify-content:center;gap:7px;position:relative;z-index:2}
.nx-btt__icon{display:inline-flex;align-items:center;justify-content:center;transition:transform var(--nx-btt-hover-duration,240ms) var(--nx-btt-easing,ease)}
.nx-btt__icon:empty{display:none}.nx-btt__icon svg{display:block;width:22px;height:22px;flex-shrink:0}.nx-btt__media-icon{display:block;width:24px;height:24px;max-width:100%;object-fit:contain}
.nx-btt__label{font:inherit}.nx-btt__progress{position:absolute;inset:1px;width:calc(100% - 2px);height:calc(100% - 2px);pointer-events:none;overflow:visible;opacity:.75;transform:rotate(-90deg)}
.nx-btt[data-preset="blue-gradient"],.nx-btt[data-preset="violet-pop"],.nx-btt[data-preset="red-light"]{background:linear-gradient(145deg,var(--nx-btt-bg),var(--nx-btt-hover-bg))}
.nx-btt[data-hover="lift"][data-active="1"]:hover{transform:translateY(-4px)}
.nx-btt[data-hover="scale"][data-active="1"]:hover{transform:scale(var(--nx-btt-hover-scale,1.08))}
.nx-btt[data-hover="slide"]:hover .nx-btt__icon{transform:translateY(-4px)}
.nx-btt[data-hover="rotate"]:hover .nx-btt__icon{transform:rotate(360deg)}
.nx-btt[data-hover="glow"]:hover{box-shadow:0 8px 32px color-mix(in srgb,var(--nx-btt-hover-bg) 45%,transparent)}
.nx-btt[data-hover="shadow"]:hover{box-shadow:0 14px 34px rgba(20,25,55,.33)}
.nx-btt[data-hover="pulse"][data-active="1"]:hover{animation:nx-btt-pulse .8s ease-in-out infinite alternate}
@keyframes nx-btt-pulse{to{transform:scale(1.065)}}
@media (min-width:1025px){
.nx-btt{top:auto;bottom:var(--nx-btt-bottom,28px);left:auto;right:var(--nx-btt-side,28px);translate:none;}
.nx-btt[data-position-desktop^="top-"]{top:var(--nx-btt-top,28px);bottom:auto}
.nx-btt[data-position-desktop^="middle-"]{top:50%;bottom:auto;translate:0 -50%}
.nx-btt[data-position-desktop^="bottom-"]{top:auto;bottom:var(--nx-btt-bottom,28px)}
.nx-btt[data-position-desktop$="-left"]{left:var(--nx-btt-side,28px);right:auto}
.nx-btt[data-position-desktop$="-right"]{left:auto;right:var(--nx-btt-side,28px)}
.nx-btt[data-position-desktop$="-center"]{left:calc(50% + var(--nx-btt-center,0px));right:auto;translate:-50% 0}
}
@media (min-width:768px) and (max-width:1024px){
.nx-btt{top:auto;bottom:var(--nx-btt-bottom,28px);left:auto;right:var(--nx-btt-side,28px);translate:none;}
.nx-btt[data-position-tablet^="top-"]{top:var(--nx-btt-top,28px);bottom:auto}
.nx-btt[data-position-tablet^="middle-"]{top:50%;bottom:auto;translate:0 -50%}
.nx-btt[data-position-tablet^="bottom-"]{top:auto;bottom:var(--nx-btt-bottom,28px)}
.nx-btt[data-position-tablet$="-left"]{left:var(--nx-btt-side,28px);right:auto}
.nx-btt[data-position-tablet$="-right"]{left:auto;right:var(--nx-btt-side,28px)}
.nx-btt[data-position-tablet$="-center"]{left:calc(50% + var(--nx-btt-center,0px));right:auto;translate:-50% 0}
}
@media (max-width:767px){
.nx-btt{top:auto;bottom:var(--nx-btt-bottom-mobile,20px);left:auto;right:var(--nx-btt-side-mobile,16px);translate:none;}
.nx-btt[data-position-mobile^="top-"]{top:var(--nx-btt-top-mobile,20px);bottom:auto}
.nx-btt[data-position-mobile^="middle-"]{top:50%;bottom:auto;translate:0 -50%}
.nx-btt[data-position-mobile^="bottom-"]{top:auto;bottom:var(--nx-btt-bottom-mobile,20px)}
.nx-btt[data-position-mobile$="-left"]{left:var(--nx-btt-side-mobile,16px);right:auto}
.nx-btt[data-position-mobile$="-right"]{left:auto;right:var(--nx-btt-side-mobile,16px)}
.nx-btt[data-position-mobile$="-center"]{left:calc(50% + var(--nx-btt-center-mobile,0px));right:auto;translate:-50% 0}
.nx-btt{min-width:var(--nx-btt-size-mobile,44px);min-height:var(--nx-btt-size-mobile,44px)}
}
@media(min-width:1025px){.nx-btt[data-desktop="0"]{display:none!important}}
@media(min-width:768px) and (max-width:1024px){.nx-btt[data-tablet="0"]{display:none!important}}
@media(max-width:767px){.nx-btt[data-mobile="0"]{display:none!important}}
@media(prefers-reduced-motion:reduce){.nx-btt,.nx-btt__icon{transition:none!important;animation:none!important;transform:none!important}}
/* The text-only design hides (but does not erase) the owner's chosen icon. */
.nx-btt[data-preset="text-link"]{min-width:0;min-height:0;border-width:0;background:transparent;box-shadow:none!important}
.nx-btt[data-preset="text-link"] .nx-btt__icon{display:none}
.nx-btt[data-preset="text-link"]:hover{background:transparent}

/* Global control must be attached to <body>, not a transformed Elementor/footer wrapper.
   Preserve all existing design, animations, and device ON/OFF media rules above. */
body > #nexivyn-global-back-to-top.nx-btt {
    position: fixed !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    box-sizing: border-box;
    z-index: var(--nx-btt-z, 9998) !important;
}

/* Native hidden is the safe default until the enqueued JS initializes.
   After init, data-active switches opacity/visibility without display:none
   so the original fade/slide presets still transition normally. */
body > #nexivyn-global-back-to-top.nx-btt[hidden] {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
body > #nexivyn-global-back-to-top.nx-btt[data-active="0"] {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}
body > #nexivyn-global-back-to-top.nx-btt[data-active="1"] {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Reassert each saved desktop/tablet/mobile position against theme or Elementor
   button rules. The eight positions and every offset still come from the
   owner's controls; there is no hard-coded fixed corner override. */
@media (min-width: 1025px) {
    body > #nexivyn-global-back-to-top.nx-btt { inset: auto !important; bottom: var(--nx-btt-bottom, 28px) !important; right: var(--nx-btt-side, 28px) !important; translate: none; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-desktop^="top-"] { top: var(--nx-btt-top, 28px) !important; bottom: auto !important; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-desktop^="middle-"] { top: 50% !important; bottom: auto !important; translate: 0 -50%; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-desktop$="-left"] { left: var(--nx-btt-side, 28px) !important; right: auto !important; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-desktop$="-center"] { left: calc(50% + var(--nx-btt-center, 0px)) !important; right: auto !important; translate: -50% 0; }
}
@media (min-width: 768px) and (max-width: 1024px) {
    body > #nexivyn-global-back-to-top.nx-btt { inset: auto !important; bottom: var(--nx-btt-bottom, 28px) !important; right: var(--nx-btt-side, 28px) !important; translate: none; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-tablet^="top-"] { top: var(--nx-btt-top, 28px) !important; bottom: auto !important; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-tablet^="middle-"] { top: 50% !important; bottom: auto !important; translate: 0 -50%; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-tablet$="-left"] { left: var(--nx-btt-side, 28px) !important; right: auto !important; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-tablet$="-center"] { left: calc(50% + var(--nx-btt-center, 0px)) !important; right: auto !important; translate: -50% 0; }
}
@media (max-width: 767px) {
    body > #nexivyn-global-back-to-top.nx-btt { inset: auto !important; bottom: var(--nx-btt-bottom-mobile, 20px) !important; right: max(var(--nx-btt-side-mobile, 16px), env(safe-area-inset-right, 0px)) !important; translate: none; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-mobile^="top-"] { top: var(--nx-btt-top-mobile, 20px) !important; bottom: auto !important; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-mobile^="middle-"] { top: 50% !important; bottom: auto !important; translate: 0 -50%; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-mobile$="-left"] { left: max(var(--nx-btt-side-mobile, 16px), env(safe-area-inset-left, 0px)) !important; right: auto !important; }
    body > #nexivyn-global-back-to-top.nx-btt[data-position-mobile$="-center"] { left: calc(50% + var(--nx-btt-center-mobile, 0px)) !important; right: auto !important; translate: -50% 0; }
}

/* Mobile viewport resilience: activate only on pages where the rendered
   document is actually wider than its viewport.  Keeping this at the root
   prevents sideways page scrolling (and the exposed blank strip beside a
   full-width footer) without changing any Elementor widget/preset sizing or
   disabling nested carousels/tables with their own overflow:auto.  The
   enqueued script adds this class only when overflow is measured. */
@media (max-width: 767px) {
    html.nx-btt-mobile-horizontal-overflow {
        overflow-x: clip !important;
    }
    html.nx-btt-mobile-horizontal-overflow > body {
        overflow-x: clip !important;
    }
}

/* v0.0.6 Try 13 — published global-button appearance is authoritative.
   WordPress themes and Elementor may apply generic button background, color,
   border or padding rules with !important. Scope these declarations to the
   ONE global extension ID; existing Elementor Back to Top widgets are left
   untouched. Every value is still the validated saved custom property. */
body > #nexivyn-global-back-to-top.nx-btt:not([data-preset="text-link"]) {
    background: var(--nx-btt-bg, #343e76) !important;
    color: var(--nx-btt-fg, #fff) !important;
    border: var(--nx-btt-border-width, 0px) solid var(--nx-btt-border, #343e76) !important;
    border-radius: var(--nx-btt-radius, 14px) !important;
    min-width: var(--nx-btt-size, 50px) !important;
    min-height: var(--nx-btt-size, 50px) !important;
    padding: var(--nx-btt-padding-top, 10px) var(--nx-btt-padding-right, 15px) var(--nx-btt-padding-bottom, 10px) var(--nx-btt-padding-left, 15px) !important;
}
body > #nexivyn-global-back-to-top.nx-btt--circle:not([data-preset="text-link"]),
body > #nexivyn-global-back-to-top.nx-btt--pill:not([data-preset="text-link"]) {
    border-radius: 9999px !important;
}
body > #nexivyn-global-back-to-top.nx-btt--square:not([data-preset="text-link"]) {
    border-radius: 0 !important;
}
body > #nexivyn-global-back-to-top.nx-btt:not([data-preset="text-link"]):hover {
    background: var(--nx-btt-hover-bg, #4454bf) !important;
    color: var(--nx-btt-hover-fg, #fff) !important;
    border-color: var(--nx-btt-hover-border, var(--nx-btt-border)) !important;
}
body > #nexivyn-global-back-to-top.nx-btt[data-preset="blue-gradient"],
body > #nexivyn-global-back-to-top.nx-btt[data-preset="violet-pop"],
body > #nexivyn-global-back-to-top.nx-btt[data-preset="red-light"] {
    background: linear-gradient(145deg, var(--nx-btt-bg), var(--nx-btt-hover-bg)) !important;
}
body > #nexivyn-global-back-to-top.nx-btt[data-preset="blue-gradient"]:hover,
body > #nexivyn-global-back-to-top.nx-btt[data-preset="violet-pop"]:hover,
body > #nexivyn-global-back-to-top.nx-btt[data-preset="red-light"]:hover {
    background: linear-gradient(145deg, var(--nx-btt-hover-bg), var(--nx-btt-bg)) !important;
}
body > #nexivyn-global-back-to-top.nx-btt[data-preset="text-link"] {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    color: var(--nx-btt-fg, #4b5563) !important;
}
@media (max-width: 767px) {
    body > #nexivyn-global-back-to-top.nx-btt:not([data-preset="text-link"]) {
        min-width: var(--nx-btt-size-mobile, 44px) !important;
        min-height: var(--nx-btt-size-mobile, 44px) !important;
    }
}
