/* Fire Back to Top Button */
.back-to-top {
    position: fixed !important;
    bottom: 30px !important;
    left: 40px !important;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ff4444 0%, #ff6b35 50%, #ff9500 100%);
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 25px rgba(255, 68, 68, 0.4), 0 0 0 0 rgba(255, 107, 53, 0.4);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 99999 !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px) scale(0.8);
    overflow: hidden;
}

/* Fire glow effect */
.back-to-top::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 200, 0, 0.3) 0%, transparent 70%);
    animation: fireGlow 2s ease-in-out infinite alternate;
    border-radius: 50%;
}

@keyframes fireGlow {
    0% { transform: scale(0.8) rotate(0deg); opacity: 0.6; }
    100% { transform: scale(1.2) rotate(180deg); opacity: 1; }
}

/* Progress ring */
.back-to-top::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        #ffff00 var(--progress, 0deg),
        #ff9500 var(--progress, 0deg),
        #ff4444 calc(var(--progress, 0deg) + 20deg),
        transparent calc(var(--progress, 0deg) + 40deg)
    );
    animation: progressPulse 2s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

.back-to-top:hover {
    transform: translateY(-8px) scale(1.1);
    box-shadow: 0 12px 35px rgba(255, 68, 68, 0.6), 0 0 30px rgba(255, 200, 0, 0.4), 0 0 0 8px rgba(255, 107, 53, 0.1);
    background: linear-gradient(135deg, #ff2222 0%, #ff5722 50%, #ff8f00 100%);
    animation: heatWave 2s ease-in-out infinite;
}

.back-to-top:active {
    transform: translateY(-4px) scale(1.05);
}

.fire-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, #ffff00 0%, #ff9500 50%, transparent 100%);
    border-radius: 50%;
    animation: fireParticle 1.5s ease-out infinite;
    pointer-events: none;
}

@keyframes fireParticle {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-40px) scale(0); opacity: 0; }
}

.back-to-top-icon {
    width: 28px;
    height: 28px;
    fill: white;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.back-to-top:hover .back-to-top-icon {
    transform: translateY(-4px);
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

@keyframes firePulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 15px rgba(255, 200, 0, 0.3); }
    100% { box-shadow: 0 0 0 30px rgba(255, 68, 68, 0); }
}

.back-to-top.fire-pulse { animation: firePulse 2s ease-out; }

@keyframes flameRise {
    0% { transform: translateY(20px) scale(0.8); opacity: 0; }
    50% { transform: translateY(-5px) scale(1.1); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.back-to-top.flame-entrance { animation: flameRise 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes heatWave {
    0%, 100% { filter: hue-rotate(0deg) saturate(1); }
    25% { filter: hue-rotate(10deg) saturate(1.2); }
    50% { filter: hue-rotate(-5deg) saturate(0.8); }
    75% { filter: hue-rotate(15deg) saturate(1.1); }
}
