/* Botón flotante de navegación hacia atrás */
.back-button-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.back-button-float.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-button-float button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.back-button-float button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f7931e, #ff6b35);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 50%;
}

.back-button-float button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
}

.back-button-float button:hover::before {
    opacity: 1;
}

.back-button-float button:active {
    transform: translateY(0);
    box-shadow: 0 3px 15px rgba(255, 107, 53, 0.3);
}

.back-button-float button i {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1;
    transition: all 0.3s ease;
    opacity: 1;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
    text-align: center !important;
    vertical-align: middle !important;
    font-style: normal !important;
}

.back-button-float button .button-text {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1;
    font-size: 9px !important;
    font-weight: 800 !important;
    opacity: 0;
    transition: all 0.3s ease;
    color: white !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    white-space: nowrap !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
    text-align: center !important;
    vertical-align: middle !important;
    font-style: normal !important;
}

/* Animación de spin del botón completo */
.back-button-float button.spinning {
    animation: buttonSpin 0.6s ease-in-out;
}

/* Keyframe para el spin del botón */
@keyframes buttonSpin {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

/* Keyframes para la rotación continua */
@keyframes spinContinuous {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(180deg);
    }
    100% {
        transform: rotateY(360deg);
    }
}

.back-button-float button.continuous-spin {
    animation: spinContinuous 2s ease-in-out infinite;
}

.back-button-float button:hover i {
    transform: translateX(-2px);
}

/* Adaptaciones para móvil */
@media (max-width: 768px) {
    .back-button-float {
        bottom: 25px;
        right: 25px;
    }
    
    .back-button-float button {
        width: 60px;
        height: 60px;
        font-size: 22px;
        box-shadow: 0 6px 25px rgba(255, 107, 53, 0.4);
    }
    
    .back-button-float button:hover {
        transform: scale(1.05);
    }
    
    .back-button-float button:active {
        transform: scale(0.95);
    }
}

/* Para dispositivos con pantalla táctil */
@media (hover: none) and (pointer: coarse) {
    .back-button-float button {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
    
    .back-button-float button:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(255, 107, 53, 0.3);
    }
    
    .back-button-float button:active {
        transform: scale(0.95);
        box-shadow: 0 2px 10px rgba(255, 107, 53, 0.5);
    }
}

/* Animación de pulsación para feedback táctil */
@keyframes tapFeedback {
    0% { transform: scale(1); }
    50% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

.back-button-float button.tapped {
    animation: tapFeedback 0.2s ease;
}

/* Para pantallas muy pequeñas */
@media (max-width: 480px) {
    .back-button-float {
        bottom: 20px;
        right: 20px;
    }
    
    .back-button-float button {
        width: 58px;
        height: 58px;
        font-size: 20px;
    }
}

/* Asegurar que no interfiera con otros elementos flotantes */
.back-button-float {
    pointer-events: auto;
}

.back-button-float button {
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Estado de deshabilitado cuando no hay historial */
.back-button-float.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.back-button-float.disabled button {
    cursor: not-allowed;
    background: #9ca3af;
    box-shadow: 0 2px 10px rgba(156, 163, 175, 0.3);
}

/* Mejoras de accesibilidad */
.back-button-float button:focus {
    outline: 3px solid rgba(255, 107, 53, 0.5);
    outline-offset: 2px;
}

/* Animación de entrada inicial */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-button-float.animate-in {
    animation: slideInUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}
