/* Enhanced Back to Top Button Styles */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-cyan));
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    will-change: transform, opacity;
}

/* Progress Ring */
.back-to-top::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top-color: var(--primary-emerald);
    border-right-color: var(--primary-emerald);
    transition: all 0.3s ease;
    transform: rotate(-90deg);
    opacity: 0.7;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.back-to-top:hover {
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.8);
    background: linear-gradient(135deg, var(--primary-cyan), var(--primary-emerald));
    animation: gentlePulse 2s ease-in-out infinite;
}

.back-to-top:hover::after {
    border-top-color: white;
    border-right-color: white;
    opacity: 1;
    transform: rotate(-90deg) scale(1.1);
}

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

.back-to-top:focus {
    outline: 3px solid var(--primary-cyan);
    outline-offset: 2px;
}

/* Tooltip */
.back-to-top::before {
    content: 'Back to Top';
    position: absolute;
    bottom: 75px;
    right: 50%;
    transform: translateX(50%);
    background: rgba(15, 15, 35, 0.95);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-family: 'Space Grotesk', sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.back-to-top:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(50%) translateY(-5px);
}

/* Icon Animation */
.back-to-top i {
    transition: transform 0.3s ease;
}

.back-to-top:hover i {
    transform: translateY(-2px);
    animation: arrowBounce 1s ease-in-out infinite;
}

/* Animations */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.3);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-10px) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes gentlePulse {
    0%, 100% {
        box-shadow: 0 12px 40px rgba(139, 92, 246, 0.8);
    }
    50% {
        box-shadow: 0 12px 40px rgba(139, 92, 246, 1), 0 0 30px rgba(6, 182, 212, 0.5);
    }
}

@keyframes arrowBounce {
    0%, 100% {
        transform: translateY(-2px);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .back-to-top {
        width: 54px;
        height: 54px;
        bottom: 20px;
        right: 20px;
        font-size: 20px;
    }

    .back-to-top::before {
        font-size: 11px;
        padding: 6px 10px;
        bottom: 65px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.3s ease;
        animation: none;
    }

    .back-to-top.visible {
        animation: none;
    }

    .back-to-top:hover {
        animation: none;
        transform: translateY(-3px) scale(1.05);
    }

    .back-to-top:hover i {
        animation: none;
        transform: none;
    }
}


/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}