/* ==========================================================================
   Back to Top Button
   ========================================================================== */

/**
 * Floating button that appears when user scrolls down the page.
 * Provides quick navigation back to the top of the page.
 */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background: var(--accent, #3498db);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease, background-color 0.2s ease;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 1.25rem;
    line-height: 1;
    text-decoration: none;
}

/* Visible state - triggered by JavaScript */
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Hover state */
.back-to-top:hover {
    background: var(--accent-hover, #2980b9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

/* Active/pressed state */
.back-to-top:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Focus state for keyboard accessibility */
.back-to-top:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb, 52, 152, 219), 0.4), 0 2px 8px rgba(0, 0, 0, 0.15);
}

.back-to-top:focus-visible {
    outline: 2px solid var(--accent, #3498db);
    outline-offset: 2px;
}

/* Icon styling */
.back-to-top i,
.back-to-top svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

/* Smaller button on mobile devices */
@media (max-width: 576px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .back-to-top i,
    .back-to-top svg {
        width: 18px;
        height: 18px;
    }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.1s ease, visibility 0.1s ease;
    }
    
    .back-to-top:hover,
    .back-to-top.show {
        transform: none;
    }
}

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