/* Scroll to Top Button Styles */
.scroll-to-top {
    position: fixed !important;
    bottom: 30px !important;
    right: 110px !important; /* Increased to 110px to ensure no overlap with 70px chatbot + 20px margin */
    width: 50px !important;
    height: 50px !important;
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 12px rgba(0, 75, 184, 0.3) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 998 !important; /* Lower z-index than chatbot */
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) scale(0.8) !important;
    font-size: 0 !important;
    line-height: 0 !important;
    pointer-events: none !important;
    will-change: transform, opacity, box-shadow !important;
}

.scroll-to-top.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
    pointer-events: auto !important;
    animation: slideInUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

@keyframes slideInUp {
    0% {
        opacity: 0;
        transform: translateY(25px) scale(0.85);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.scroll-to-top:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 8px 20px rgba(0, 75, 184, 0.5) !important;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.scroll-to-top:active {
    transform: translateY(-1px) scale(0.98) !important;
    box-shadow: 0 4px 12px rgba(0, 75, 184, 0.4) !important;
    transition: all 0.08s ease !important;
}

.scroll-to-top svg {
    width: 24px !important;
    height: 24px !important;
    fill: currentColor !important;
    pointer-events: none !important;
}

/* Focus styles for accessibility */
.scroll-to-top:focus {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

/* Animation when scrolling */
.scroll-to-top.scrolling {
    animation: scrollingPulse 0.3s ease-out;
    background: var(--primary-dark);
}

@keyframes scrollingPulse {
    0% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.1);
        box-shadow: 0 12px 28px rgba(0, 75, 184, 0.6);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .scroll-to-top {
        bottom: 15px !important; /* Match chatbot bottom position */
        right: 85px !important; /* Chatbot: 55px width + 15px right + 15px gap = 85px */
        width: 45px !important;
        height: 45px !important;
    }
    
    .scroll-to-top svg {
        width: 20px !important;
        height: 20px !important;
    }
}

@media (max-width: 480px) {
    .scroll-to-top {
        bottom: 15px !important; /* Match chatbot bottom position */
        right: 80px !important; /* Chatbot: 55px width + 10px right + 15px gap = 80px */
        width: 40px !important;
        height: 40px !important;
    }
    
    .scroll-to-top svg {
        width: 18px !important;
        height: 18px !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .scroll-to-top {
        border: 2px solid white;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .scroll-to-top {
        transition: opacity var(--transition-fast);
    }
    
    .scroll-to-top.scrolling {
        animation: none;
    }
}
