/* ============================================
   Back to Top Button - Sleek Minimalistic Design
   ============================================ */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(100px) scale(0.5);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 999;
    overflow: visible;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.back-to-top.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Inner container */
.backtop-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 3;
    transition: transform 0.3s ease;
}

/* Icon styling */
.back-to-top i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Animated ring effect */
.backtop-ring {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg,
            transparent 0deg,
            rgba(220, 38, 38, 0.4) 90deg,
            transparent 180deg,
            rgba(220, 38, 38, 0.4) 270deg,
            transparent 360deg);
    opacity: 0;
    z-index: 1;
    transition: all 0.4s ease;
}

/* Tooltip */
.backtop-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(10px);
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* Tooltip arrow */
.backtop-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.85);
}

/* Hover states */
.back-to-top:hover .backtop-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.back-to-top:hover {
    background: rgba(220, 38, 38, 0.9);
    border-color: rgba(220, 38, 38, 0.3);
    transform: translateY(-3px) scale(1.08);
    box-shadow:
        0 8px 24px rgba(220, 38, 38, 0.25),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.back-to-top:hover .backtop-ring {
    opacity: 1;
    animation: rotate-ring 3s linear infinite;
}

.back-to-top:hover i {
    color: #ffffff;
    transform: translateY(-2px);
}

/* Active/Click state */
.back-to-top:active {
    transform: translateY(-1px) scale(1.05);
    transition: all 0.15s ease;
}

/* Animations */
@keyframes rotate-ring {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile responsive */
@media (max-width: 640px) {
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 20px;
    }

    .back-to-top i {
        font-size: 0.95rem;
    }

    .backtop-tooltip {
        display: none;
    }

    .back-to-top:hover {
        transform: translateY(-2px) scale(1.05);
    }
}