/* ===== SCROLL TO TOP BUTTON ===== */

#back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 56px;
    height: 56px;
    background: var(--green); /* Uses dynamic theme color */
    color: var(--bg-dark);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    animation: slideInFromBottom 0.4s ease;
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hover Effect - Brightens the current color */
#back-to-top:hover {
    transform: translateY(-4px) scale(1.05);
    filter: brightness(1.3);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

/* Active/Click Effect - Darkens the current color */
#back-to-top:active {
    transform: translateY(-2px) scale(1.02);
    filter: brightness(0.8);
}

/* Circular Progress Indicator */
.progress-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
    pointer-events: none;
}

.progress-ring__circle {
    fill: none;
    stroke: var(--green); /* Uses dynamic theme color */
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s ease;
    opacity: 0.8;
}

/* Hover effect for progress ring */
#back-to-top:hover .progress-ring__circle {
    opacity: 1;
    filter: brightness(1.3);
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablet */
@media (max-width: 968px) {
    #back-to-top {
        bottom: 32px;
        right: 32px;
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    
    .progress-ring {
        width: 60px;
        height: 60px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    #back-to-top {
        bottom: 24px;
        right: 24px;
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .progress-ring {
        width: 58px;
        height: 58px;
        top: -4px;
        left: -4px;
    }
    
    .progress-ring__circle {
        cx: 29;
        cy: 29;
        r: 26;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 46px;
        height: 46px;
        font-size: 16px;
    }
    
    .progress-ring {
        width: 54px;
        height: 54px;
    }
    
    .progress-ring__circle {
        cx: 27;
        cy: 27;
        r: 24;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    #back-to-top,
    .progress-ring__circle {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }
    
    #back-to-top.visible {
        animation: none !important;
    }
}