/**
 * PhynixOne - Dynamic Back to Top Component with SVG Scroll Progress & Emerald Status Ring
 */
.phx-back-to-top {
    position: fixed;
    right: 28px;
    bottom: 28px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #10b981; /* Vibrant Emerald Green outer ring */
    color: #1e293b;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25), 0 8px 24px -4px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.85);
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.2s ease,
                border-color 0.2s ease,
                box-shadow 0.25s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

[data-theme="dark"] .phx-back-to-top {
    background: #ffffff;
    border-color: #10b981;
    color: #1e293b;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.35), 0 8px 24px -4px rgba(0, 0, 0, 0.4);
}

.phx-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.phx-back-to-top:hover {
    transform: translateY(-4px) scale(1.08);
    background: #ffffff;
    border-color: #059669;
    color: #0052ff;
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.4), 0 12px 28px -4px rgba(0, 82, 255, 0.3);
}

.phx-back-to-top:active {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.25);
}

.phx-back-to-top:focus-visible {
    outline: 2px solid #0052ff;
    outline-offset: 3px;
}

/* SVG Progress Ring */
.phx-back-to-top-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.phx-back-to-top-track {
    stroke: #e2e8f0;
}

[data-theme="dark"] .phx-back-to-top-track {
    stroke: #e2e8f0;
}

.phx-back-to-top-fill {
    stroke: #0052ff; /* Vivid Electric Blue scroll progress arc */
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear;
}

.phx-back-to-top-icon {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.phx-back-to-top-icon svg {
    stroke: #1e293b;
    transition: stroke 0.2s ease, transform 0.2s ease;
}

.phx-back-to-top:hover .phx-back-to-top-icon svg {
    transform: translateY(-2px);
    stroke: #0052ff;
}
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.phx-back-to-top:hover .phx-back-to-top-icon {
    transform: translateY(-2px);
}

/* Stacking: Float Back-To-Top cleanly above WhatsApp Floating Button without collision */
body:has(.floating-whatsapp) .phx-back-to-top,
body.has-floating-wa .phx-back-to-top,
.phx-back-to-top.has-floating-wa {
    bottom: 92px;
    right: 30px;
}

/* Mobile responsive adjustments */
@media (max-width: 900px) {
    .phx-back-to-top {
        right: 18px;
        bottom: 84px; /* Floats safely above .mobile-bottom-nav */
        width: 44px;
        height: 44px;
    }

    body:has(.floating-whatsapp) .phx-back-to-top,
    body.has-floating-wa .phx-back-to-top,
    .phx-back-to-top.has-floating-wa {
        bottom: 144px;
        right: 21px; /* Floats cleanly stacked above mobile floating WhatsApp (at bottom 84px) */
    }
}
