/**
 * Floating Refresh Button
 * Draggable, movable refresh button for mobile and desktop
 */

.floating-refresh-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: move;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.floating-refresh-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5), 0 3px 6px rgba(0, 0, 0, 0.15);
}

.floating-refresh-btn:active {
    transform: scale(0.95);
}

.floating-refresh-btn.dragging {
    transition: none;
    opacity: 0.9;
    cursor: grabbing;
}

.floating-refresh-btn.refreshing {
    pointer-events: none;
}

.floating-refresh-btn.refreshing i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Ripple effect on click */
.floating-refresh-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.floating-refresh-btn:active::before {
    width: 100%;
    height: 100%;
}

/* Pulse animation when idle */
@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    50% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6), 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}

.floating-refresh-btn.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .floating-refresh-btn {
        width: 52px;
        height: 52px;
        bottom: 70px;
        right: 16px;
        font-size: 18px;
    }
}

/* Ensure button stays within viewport bounds */
.floating-refresh-btn.constrained {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .floating-refresh-btn {
        background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5), 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .floating-refresh-btn:hover {
        box-shadow: 0 6px 16px rgba(37, 99, 235, 0.6), 0 3px 6px rgba(0, 0, 0, 0.25);
    }
}