/* Back to Top Button Styles */

#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999; /* Higher z-index to ensure visibility */
    width: 50px;
    height: 50px;
    text-align: center;
    line-height: 46px; /* Adjusted for border */
    background: #002147; /* Matching your site's primary color */
    color: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(197, 164, 126, 0.3); /* Enhanced shadow */
    outline: none;
    /* Gold border to match your site theme */
    border: 2px solid #c5a47e;
    display: block !important; /* Ensure it's displayed */
}

#back-to-top:hover {
    background: #003977; /* Darker shade for hover effect */
    transform: translateY(0) scale(1.1);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

#back-to-top:active {
    transform: translateY(2px) scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible !important;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#back-to-top i {
    font-size: 20px;
    line-height: 50px;
    animation: bounce 2s infinite;
}

/* Bounce animation */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Media query for mobile devices */
@media (max-width: 767px) {
    #back-to-top {
        width: 44px;
        height: 44px;
        line-height: 40px;
        bottom: 20px; /* Position at the bottom of the screen */
        right: 20px;
        z-index: 1050; /* Even higher z-index on mobile */
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(197, 164, 126, 0.4);
    }
    
    #back-to-top i {
        font-size: 18px;
        line-height: 40px;
    }
    
    /* Adjust position when mobile menu is open */
    body.menu-open #back-to-top {
        opacity: 0;
        visibility: hidden;
    }
}
