/* ============================================ */
/* BACK TO TOP BUTTON - MODERN & ANIMATED */
/* ============================================ */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
    border: 2px solid rgba(139, 92, 246, 0.5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4), 0 0 0 1px rgba(139, 92, 246, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow: visible;
}

.back-to-top::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.back-to-top:hover::before {
    opacity: 1;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.back-to-top:hover {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5), 0 0 0 2px rgba(139, 92, 246, 0.6);
    border-color: rgba(139, 92, 246, 0.8);
}

.back-to-top:active {
    transform: translateY(-2px) scale(1);
}

/* Icon animation */
.back-to-top i {
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.back-to-top:hover i {
    transform: translateY(-2px);
    animation: bounce 0.6s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(-2px);
    }
    50% {
        transform: translateY(-6px);
    }
}

/* Circular progress ring */
.back-to-top-progress {
    position: absolute;
    top: -5px;
    left: -5px;
    width: calc(100% + 10px);
    height: calc(100% + 10px);
    pointer-events: none;
}

.back-to-top-progress svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.back-to-top-progress-bg {
    fill: none;
    stroke: rgba(139, 92, 246, 0.2);
    stroke-width: 4;
}

.back-to-top-progress-bar {
    fill: none;
    stroke: rgba(255, 255, 255, 0.95);
    stroke-width: 4.5;
    stroke-linecap: round;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.3s ease;
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.8));
}

/* Tooltip */
.back-to-top-tooltip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.back-to-top-tooltip::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
    width: 8px;
    height: 8px;
    background: #1f2937;
}

.back-to-top:hover .back-to-top-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(-12px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 50px;
        height: 50px;
        font-size: 1.1rem;
    }
    
    .back-to-top-tooltip {
        display: none;
    }
}

@media (max-width: 480px) {
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 46px;
        height: 46px;
        font-size: 1rem;
    }
}

/* Accessibility */
.back-to-top:focus-visible {
    outline: 3px solid #8b5cf6;
    outline-offset: 3px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .back-to-top,
    .back-to-top::before,
    .back-to-top i,
    .back-to-top-tooltip,
    .back-to-top-progress-bar {
        transition: none !important;
        animation: none !important;
    }
}

/* Alternative minimal style */
.back-to-top.minimal {
    background: rgba(139, 92, 246, 0.9);
    backdrop-filter: blur(10px);
}
