/**
 * Bouton "Retour en haut" / "Retour en arrière"
 * Visible après scroll, permet de revenir en haut ou à la page précédente
 */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-dark, #B71C1C) 0%, var(--primary, #D32F2F) 100%);
    color: var(--white);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: linear-gradient(135deg, var(--primary, #D32F2F) 0%, var(--primary-dark, #B71C1C) 100%);
    box-shadow: 0 6px 20px rgba(183, 28, 28, 0.3);
    transform: translateY(-3px);
}

.back-to-top:active {
    transform: translateY(-1px) scale(0.95);
}

.back-to-top:focus-visible {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
}

/* Icône flèche vers le haut */
.back-to-top::before {
    content: '↑';
    font-size: 1.5rem;
    line-height: 1;
}

/* Sur mobile, bouton plus petit */
@media (max-width: 768px) {
    .back-to-top {
        width: 45px;
        height: 45px;
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 1.2rem;
    }
    
    .back-to-top::before {
        font-size: 1.2rem;
    }
}

/* Respecter prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .back-to-top {
        transition: opacity 0.01ms, visibility 0.01ms, background-color 0.2s;
    }
    
    .back-to-top:hover {
        transform: none;
    }
}





