/* 🌟 Back to Top Button Styles: Styling for a V-shaped scroll-to-top button */

/* 🎨 Base Button Styles */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    border: 2px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
  
/* 👀 Visible State: Show button when scrolled */
.back-to-top.visible {
    opacity: 0.8;
    visibility: visible;
}
  
/* 💧 Dissolve State: Fade out button after scrolling stops */
.back-to-top.dissolve {
    opacity: 0;
    visibility: hidden;
}
  
/* 🖱️ Hover Effect: Full opacity on hover */
.back-to-top:hover {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}
  
/* ↑ Arrow Up: Container for V-shaped arrow */
.arrow-up {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0;
}
  
/* 🖼️ Top Line: Horizontal bar above V-shape */
.arrow-up::before {
    content: '';
    position: absolute;
    top: 4px;
    width: 16px;
    height: 2px;
    background-color: #ffffff;
    transition: all 0.3s ease;
}
  
/* ⮥ V-Shape: Pointing upward to indicate "up" */
.arrow-up::after {
    content: '';
    position: absolute;
    top: 10px;
    width: 9px;
    height: 9px;
    border-right: 2px solid #ffffff;
    border-bottom: 2px solid #ffffff;
    transform: rotate(-135deg);
    transition: all 0.3s ease;
}
  
/* 🖱️ Hover Effect for V-Shape */
.back-to-top:hover .arrow-up::after {
    transform: rotate(-135deg) translateY(-1px);
}
  
/* 🖱️ Hover Effect for Top Line */
.back-to-top:hover .arrow-up::before {
    width: 18px;
}
  
/* 🌑 Dark Mode: Adjust button appearance */
[data-theme="dark"] .back-to-top {
    background: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

[data-theme="dark"] .back-to-top:hover {
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

/* 🎬 Spin and Dissolve Animation: Video-like effect on click */
@keyframes spinDissolve {
    0% {
        transform: translateX(-50%) rotate(0deg) scale(1);
        opacity: 0.9;
    }
    25% {
        transform: translateX(-50%) rotate(180deg) scale(0.75);
        opacity: 0.7;
    }
    50% {
        transform: translateX(-50%) rotate(360deg) scale(0.5);
        opacity: 0.5;
    }
    75% {
        transform: translateX(-50%) rotate(540deg) scale(0.25);
        opacity: 0.25;
    }
    100% {
        transform: translateX(-50%) rotate(720deg) scale(0);
        opacity: 0;
    }
}

/* 🎥 Clicked State: Apply spin and dissolve animation */
.back-to-top.clicked {
    animation: spinDissolve 0.8s ease-out forwards;  /* 🎬 Animation: 0.8s spin and dissolve */
    pointer-events: none;                            /* 🖱️ Pointer-events: Disable clicks during animation */
}