/* Floating button for Overleaf Helper - Modern Design */
#overleaf-helper-float-btn {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999999;

    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    color: white;

    width: 48px;
    height: 48px;
    border-radius: 14px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;

    cursor: pointer;
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4),
                0 2px 6px rgba(0, 0, 0, 0.1);

    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    opacity: 1;
    border: none;
    outline: none;
}

#overleaf-helper-float-btn.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) scale(0.8);
}

/* Mini mode when sidepanel is open */
#overleaf-helper-float-btn.mini {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    gap: 0;
    opacity: 0.5;
    box-shadow: 0 1px 4px rgba(22, 163, 74, 0.25);
}

#overleaf-helper-float-btn.mini:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.2);
}

#overleaf-helper-float-btn.mini svg {
    width: 10px;
    height: 10px;
}

#overleaf-helper-float-btn.mini span {
    display: none;
}

#overleaf-helper-float-btn:hover {
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 8px 24px rgba(22, 163, 74, 0.45),
                0 4px 10px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #15803d 0%, #166534 100%);
}

#overleaf-helper-float-btn:active {
    transform: translateY(-50%) scale(0.96);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35),
                0 1px 3px rgba(0, 0, 0, 0.1);
}

#overleaf-helper-float-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

#overleaf-helper-float-btn span {
    font-size: 9px;
    font-weight: 600;
    color: white;
    letter-spacing: 0.3px;
}

/* Subtle glow animation on first appearance */
@keyframes glow-ring {
    0% {
        box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4),
                    0 2px 6px rgba(0, 0, 0, 0.1),
                    0 0 0 0 rgba(22, 163, 74, 0.4);
    }
    50% {
        box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4),
                    0 2px 6px rgba(0, 0, 0, 0.1),
                    0 0 0 8px rgba(22, 163, 74, 0);
    }
    100% {
        box-shadow: 0 4px 14px rgba(22, 163, 74, 0.4),
                    0 2px 6px rgba(0, 0, 0, 0.1),
                    0 0 0 0 rgba(22, 163, 74, 0);
    }
}

#overleaf-helper-float-btn.new {
    animation: glow-ring 2s ease-out 3;
}

/* Disable animation on hover */
#overleaf-helper-float-btn:hover {
    animation: none;
}


/* Mobile responsive */
@media (max-width: 768px) {
    #overleaf-helper-float-btn {
        width: 44px;
        height: 44px;
        right: 12px;
        border-radius: 12px;
    }

    #overleaf-helper-float-btn svg {
        width: 18px;
        height: 18px;
    }

    #overleaf-helper-float-btn span {
        font-size: 8px;
    }

    #overleaf-helper-float-btn::before,
    #overleaf-helper-float-btn::after {
        display: none;
    }
}

/* Hide label on very small screens */
@media (max-width: 480px) {
    #overleaf-helper-float-btn {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    #overleaf-helper-float-btn span {
        display: none;
    }
}
