/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #ff8c00 0%, #ffd700 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(255, 140, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px) scale(0.5);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 9999;
    overflow: hidden;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scroll-to-top:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 140, 0, 0.6);
}

.scroll-to-top:active {
    transform: translateY(-2px) scale(1.05);
}

/* Arrow Icon */
.scroll-to-top i {
    font-size: 20px;
    color: #000;
    font-weight: 900;
    animation: bounceArrow 2s ease-in-out infinite;
}

@keyframes bounceArrow {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Ripple effect on click */
.scroll-to-top::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;
}

.scroll-to-top:active::before {
    width: 100px;
    height: 100px;
}

/* Pulse animation when first appears */
.scroll-to-top.visible {
    animation: pulseIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes pulseIn {
    0% {
        transform: translateY(100px) scale(0);
    }
    50% {
        transform: translateY(0) scale(1.2);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Progress ring around button */
.scroll-to-top::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #ffd700;
    animation: spin 2s linear infinite;
    opacity: 0;
    transition: opacity 0.3s;
}

.scroll-to-top:hover::after {
    opacity: 1;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 20px;
        left: 20px;
        width: 45px;
        height: 45px;
    }

    .scroll-to-top i {
        font-size: 18px;
    }
}

/* Tooltip */
.scroll-to-top-tooltip {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.scroll-to-top-tooltip::before {
    content: '';
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: rgba(0, 0, 0, 0.9);
}

.scroll-to-top:hover .scroll-to-top-tooltip {
    opacity: 1;
    visibility: visible;
    left: 65px;
}

@media (max-width: 768px) {
    .scroll-to-top-tooltip {
        display: none;
    }
}
