/* ========================================
   SCROLL & BACK TO TOP BUTTON
   ======================================== */

/* ===== BACK TO TOP BUTTON ===== */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-text-primary);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.8);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

/* Visible State */
#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Hover State */
#back-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.5);
}

/* Active / Click State */
#back-to-top:active {
    transform: scale(0.92);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

/* Focus State (Accessibility) */
#back-to-top:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 4px;
}

/* Icon inside button */
#back-to-top i {
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.3s ease;
}

/* Icon animation on hover */
#back-to-top:hover i {
    transform: translateY(-2px);
}

/* ===== SCROLL PROGRESS BAR ===== */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    z-index: 9999;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.3);
}

/* ===== SMOOTH SCROLLING ===== */
html {
    scroll-behavior: smooth;
}

/* Disable smooth scroll for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    #back-to-top {
        transition: none;
    }
    #back-to-top:hover {
        transform: none;
    }
}

/* ======================================== */
/* RESPONSIVE BACK TO TOP BUTTON            */
/* ======================================== */

/* Tablet */
@media (max-width: 992px) {
    #back-to-top {
        bottom: 25px;
        right: 25px;
        width: 46px;
        height: 46px;
        font-size: 1.1rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 1rem;
        box-shadow: 0 3px 15px rgba(37, 99, 235, 0.25);
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    #back-to-top {
        bottom: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        box-shadow: 0 2px 12px rgba(37, 99, 235, 0.2);
    }
    
    #back-to-top i {
        font-size: 0.9rem;
    }
}

/* ======================================== */
/* ANIMATIONS FOR BACK TO TOP BUTTON        */
/* ======================================== */

/* Pulse Animation (Optional - adds subtle attention) */
@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

/* Apply pulse when button is visible (optional - uncomment to use) */
/*
#back-to-top.visible {
    animation: pulse-ring 2s ease-out infinite;
}
*/

/* Bounce Animation for icon (optional) */
@keyframes bounce-up {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* Apply bounce on hover (optional) */
#back-to-top:hover i {
    animation: bounce-up 0.6s ease infinite;
}


/* ========================================
   BACK TO TOP BUTTON - GLOW VERSION
   ======================================== */

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-bg-card);
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    background: var(--color-primary);
    color: var(--color-text-primary);
    border-color: var(--color-primary);
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(37, 99, 235, 0.4), inset 0 0 20px rgba(37, 99, 235, 0.1);
}

#back-to-top:active {
    transform: scale(0.92);
}