/* Scroll to Top Button - Optimized */
.back-to-top-btn {
    position: fixed;
    z-index: 999999;
    display: none;
    width: 48px;
    height: 48px;
    background: rgba(25, 135, 84, 0.9);
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
    padding: 0;
    margin: 0;
    outline: none;
}

.back-to-top-btn.visible {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transform: translateY(0);
    animation: fadeInUp 0.3s ease;
}

.back-to-top-btn:hover,
.back-to-top-btn:focus {
    opacity: 1;
    transform: translateY(-4px);
    background: rgba(21, 115, 71, 0.95);
    box-shadow: 0 6px 16px rgba(25, 135, 84, 0.4);
    outline: 2px solid rgba(25, 135, 84, 0.3);
}

.back-to-top-btn:active {
    transform: translateY(-2px);
    transition-duration: 0.1s;
}

/* SVG Icon */
.back-to-top-btn svg {
    width: 24px;
    height: 24px;
    color: #fff;
    transition: transform 0.3s ease;
}

.back-to-top-btn:hover svg {
    transform: translateY(-2px);
}

/* Positioning */
body:not(.single-product) .back-to-top-btn {
    bottom: 80px;
    right: 20px;
    left: auto;
}

body.single-product .back-to-top-btn {
    bottom: 100px;
    right: 20px;
}

/* Mobile Positioning */
@media (max-width: 768px) {
    .back-to-top-btn {
        width: 44px;
        height: 44px;
        bottom: 60px !important;
        right: 15px !important;
    }
    
    body.single-product .back-to-top-btn {
        bottom: 130px !important;
    }
    
    .back-to-top-btn svg {
        width: 20px;
        height: 20px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .back-to-top-btn,
    .back-to-top-btn svg {
        transition: none;
    }
}

/* Print Styles */
@media print {
    .back-to-top-btn {
        display: none !important;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .back-to-top-btn {
        background: rgba(52, 211, 153, 0.9);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .back-to-top-btn:hover {
        background: rgba(52, 211, 153, 0.95);
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .back-to-top-btn {
        width: 52px;
        height: 52px;
        bottom: 70px !important;
        right: 20px !important;
    }
    
    .back-to-top-btn:active {
        transform: scale(0.95);
    }
}