/**
 * Estilos Frontend - Botón Flotante Agendar Hora
 */

:root {
    --bfah-bg-start: #2563eb;
    --bfah-bg-end: #1d4ed8;
    --bfah-text-color: #ffffff;
    --bfah-glow-color: rgba(37, 99, 235, 0.45);
    --bfah-bottom-offset: 24px;
    --bfah-border-radius: 50px;
}

/* Contenedor Principal Flotante Centrado */
.bfah-button-container {
    position: fixed;
    bottom: calc(var(--bfah-bottom-offset, 24px) + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    text-decoration: none;
    box-sizing: border-box;
    pointer-events: auto;
}

.bfah-button-container * {
    box-sizing: border-box;
}

/* Anillo de Pulso Luminoso (Pulse Glow) */
.bfah-glow-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--bfah-border-radius, 50px);
    pointer-events: none;
    z-index: -1;
    opacity: 0;
}

/* El Botón */
.bfah-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 26px;
    background: linear-gradient(135deg, var(--bfah-bg-start, #2563eb) 0%, var(--bfah-bg-end, #1d4ed8) 100%);
    color: var(--bfah-text-color, #ffffff) !important;
    font-size: 15.5px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.2px;
    text-decoration: none !important;
    border-radius: var(--bfah-border-radius, 50px);
    box-shadow: 
        0 10px 25px -4px rgba(0, 0, 0, 0.25),
        0 6px 12px -2px rgba(0, 0, 0, 0.15),
        0 0 20px 0 var(--bfah-glow-color, rgba(37, 99, 235, 0.35));
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Icono dentro del botón */
.bfah-icon-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.bfah-icon {
    width: 20px;
    height: 20px;
    display: block;
}

/* Texto del botón */
.bfah-label {
    display: inline-block;
    color: inherit;
    font-weight: 600;
}

/* Efecto de destello / reflejo brillante que pasa por encima */
.bfah-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -120%;
    width: 60%;
    height: 100%;
    background: linear-gradient(
        90deg, 
        rgba(255, 255, 255, 0) 0%, 
        rgba(255, 255, 255, 0.28) 50%, 
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
    animation: bfah-shine 4.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    pointer-events: none;
}

/* Ripple click effect */
.bfah-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: bfah-ripple-anim 0.6s linear;
    pointer-events: none;
}

/* ==========================================================================
   ANIMACIONES
   ========================================================================== */

/* 1. Flotante + Pulso Radiante (Recomendado) */
.bfah-anim-float_pulse .bfah-button {
    animation: bfah-floating 3s ease-in-out infinite;
}
.bfah-anim-float_pulse .bfah-glow-ring {
    animation: bfah-pulse-wave 2.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* 2. Solo Flotante */
.bfah-anim-float .bfah-button {
    animation: bfah-floating 3s ease-in-out infinite;
}

/* 3. Solo Pulso */
.bfah-anim-pulse .bfah-glow-ring {
    animation: bfah-pulse-wave 2.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

/* 4. Rebote Continuo */
.bfah-anim-bounce .bfah-button {
    animation: bfah-bouncing 2s ease-in-out infinite;
}

/* 5. Estático */
.bfah-anim-static .bfah-button {
    animation: none;
}
.bfah-anim-static .bfah-glow-ring {
    display: none;
}

/* Keyframes: Levitación Flotante */
@keyframes bfah-floating {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-7px);
        box-shadow: 
            0 16px 30px -4px rgba(0, 0, 0, 0.28),
            0 8px 16px -2px rgba(0, 0, 0, 0.18),
            0 0 28px 0 var(--bfah-glow-color, rgba(37, 99, 235, 0.45));
    }
}

/* Keyframes: Rebote Sutil */
@keyframes bfah-bouncing {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-9px);
    }
    60% {
        transform: translateY(-4px);
    }
}

/* Keyframes: Pulso Radiante en Onda */
@keyframes bfah-pulse-wave {
    0% {
        transform: scale(0.92);
        opacity: 0.85;
        box-shadow: 0 0 0 0 var(--bfah-glow-color, rgba(37, 99, 235, 0.6));
    }
    65% {
        transform: scale(1.15);
        opacity: 0;
        box-shadow: 0 0 0 20px rgba(37, 99, 235, 0);
    }
    100% {
        transform: scale(1.18);
        opacity: 0;
        box-shadow: 0 0 0 24px rgba(37, 99, 235, 0);
    }
}

/* Keyframes: Destello Brillante */
@keyframes bfah-shine {
    0%, 65% {
        left: -120%;
    }
    100% {
        left: 200%;
    }
}

/* Keyframes: Click Ripple */
@keyframes bfah-ripple-anim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ==========================================================================
   ESTADOS HOVER & ACTIVE
   ========================================================================== */
.bfah-button:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 
        0 18px 32px -4px rgba(0, 0, 0, 0.32),
        0 10px 18px -2px rgba(0, 0, 0, 0.2),
        0 0 30px 4px var(--bfah-glow-color, rgba(37, 99, 235, 0.5));
    filter: brightness(1.06);
}

.bfah-button:hover .bfah-icon-wrap {
    transform: rotate(-10deg) scale(1.12);
}

.bfah-button:active {
    transform: translateY(1px) scale(0.97);
    box-shadow: 
        0 6px 14px -2px rgba(0, 0, 0, 0.25),
        0 0 15px 0 var(--bfah-glow-color, rgba(37, 99, 235, 0.3));
    filter: brightness(0.96);
}

/* Pausar animación al interactuar con hover */
.bfah-button-container:hover .bfah-button {
    animation-play-state: paused;
}

/* ==========================================================================
   REGLAS DE VISIBILIDAD
   ========================================================================== */

/* Solo Móviles: Ocultar en escritorio (>= 768px) */
@media (min-width: 768px) {
    .bfah-vis-mobile_only {
        display: none !important;
    }
}

/* Solo Escritorio: Ocultar en móviles (< 768px) */
@media (max-width: 767.98px) {
    .bfah-vis-desktop_only {
        display: none !important;
    }
}

/* ==========================================================================
   RESPONSIVE MÓVIL
   ========================================================================== */
@media (max-width: 480px) {
    .bfah-button {
        padding: 12px 22px;
        font-size: 14.5px;
        gap: 8px;
    }
    
    .bfah-icon {
        width: 18px;
        height: 18px;
    }
}
