/**
 * Estilos del botón flotante en el frontend
 * Renovatio WhatsApp Floating Button
 */

/* Botón flotante principal */
.wfb-button {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #25D366;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    z-index: 9999;
    overflow: hidden;
}

/* Estados del botón */
.wfb-button:hover {
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.6);
    text-decoration: none;
}

.wfb-button:active {
    transform: scale(0.95);
}

.wfb-button:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

/* Icono dentro del botón */
.wfb-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.wfb-icon svg {
    width: 70%;
    height: 70%;
    display: block;
}

.wfb-icon-custom {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Animación de entrada - Fade */
@keyframes wfb-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animación de entrada - Slide */
@keyframes wfb-slide-in-bottom {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes wfb-slide-in-top {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes wfb-slide-in-left {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes wfb-slide-in-right {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animación de entrada - Bounce */
@keyframes wfb-bounce-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.15);
    }
    70% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Animación de pulso */
@keyframes wfb-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* Efecto de onda al hacer clic */
@keyframes wfb-ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.wfb-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
}

.wfb-button:active::before {
    animation: wfb-ripple 0.6s ease-out;
}

/* Efecto hover - Scale */
.wfb-button.hover-scale:hover {
    transform: scale(1.1);
}

/* Efecto hover - Rotate */
.wfb-button.hover-rotate:hover {
    transform: rotate(15deg);
}

/* Efecto hover - Shadow */
.wfb-button.hover-shadow:hover {
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.5);
}

/* Tooltip */
.wfb-button::after {
    content: attr(title);
    position: absolute;
    background: #1d2327;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 10000;
}

/* Posición del tooltip según la ubicación del botón */
.wfb-button[data-position*="bottom"]::after {
    bottom: 100%;
    margin-bottom: 12px;
}

.wfb-button[data-position*="top"]::after {
    top: 100%;
    margin-top: 12px;
}

.wfb-button[data-position*="right"]::after {
    right: 0;
}

.wfb-button[data-position*="left"]::after {
    left: 0;
}

.wfb-button:hover::after {
    opacity: 1;
}

/* Flecha del tooltip */
.wfb-button::before {
    content: '';
    position: absolute;
    border: 6px solid transparent;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10001;
}

.wfb-button[data-position*="bottom"]::before {
    bottom: 100%;
    margin-bottom: 6px;
   /* border-top-color: #1d2327;*/
}

.wfb-button[data-position*="top"]::before {
    top: 100%;
    margin-top: 6px;
   /* border-bottom-color: #1d2327;*/
}

.wfb-button[data-position*="right"]::before {
    right: 20px;
}

.wfb-button[data-position*="left"]::before {
    left: 20px;
}

.wfb-button:hover::before {
    opacity: 1;
}

/* Animación de latido (heartbeat) */
@keyframes wfb-heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(1.1);
    }
    20%, 40% {
        transform: scale(1);
    }
}

.wfb-button.animate-heartbeat {
    animation: wfb-heartbeat 1.5s ease-in-out infinite;
}

/* Animación de rebote suave */
@keyframes wfb-bounce-soft {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.wfb-button.animate-bounce-soft {
    animation: wfb-bounce-soft 2s ease-in-out infinite;
}

/* Animación de giro */
@keyframes wfb-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.wfb-button.animate-spin {
    animation: wfb-spin 3s linear infinite;
}

/* Ring de notificación */
@keyframes wfb-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.wfb-button-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border: 2px solid #25D366;
    border-radius: 50%;
    animation: wfb-ring 1.5s ease-out infinite;
}

/* Badge de notificación */
.wfb-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.4);
    animation: wfb-badge-pulse 2s ease-in-out infinite;
}

@keyframes wfb-badge-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .wfb-button {
        /* En móviles, puede ajustarse el tamaño si es necesario */
    }

    .wfb-button::after {
        /* Ocultar tooltips en móviles para mejor UX */
        display: none;
    }
}

/* Accesibilidad - Modo de alto contraste */
@media (prefers-contrast: high) {
    .wfb-button {
        border: 2px solid #000;
    }
}

/* Accesibilidad - Movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .wfb-button,
    .wfb-button::before,
    .wfb-button::after,
    .wfb-icon,
    .wfb-badge {
        animation: none !important;
        transition: none !important;
    }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    .wfb-button {
        box-shadow: 0 4px 16px rgba(37, 211, 102, 0.6);
    }

    .wfb-button:hover {
        box-shadow: 0 6px 24px rgba(37, 211, 102, 0.8);
    }
}

/* Print - Ocultar el botón al imprimir */
@media print {
    .wfb-button {
        display: none !important;
    }
}

/* Soporte para navegadores antiguos */
.no-js .wfb-button {
    display: flex;
}

/* Estilos de carga */
.wfb-button.loading {
    pointer-events: none;
    opacity: 0.6;
}

.wfb-button.loading .wfb-icon {
    animation: wfb-spin 1s linear infinite;
}

/* Estado deshabilitado */
.wfb-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Texto alternativo para el icono */
.wfb-button .wfb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
