/* ========================================
   BOTÓN FLOTANTE DE COOKIES
   ======================================== */

/* Contenedor del botón flotante */
.cookie-float-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

/* Mostrar botón solo cuando hay consentimiento guardado */
.cookie-float-button.visible {
    opacity: 1;
    visibility: visible;
}

/* El botón en sí */
.cookie-float-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    animation: cookieFloat 3s ease-in-out infinite;
}

.cookie-float-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
}

.cookie-float-btn:active {
    transform: scale(0.95);
}

/* Animación de flotación */
@keyframes cookieFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Pulso del botón cuando aparece */
@keyframes cookiePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    }
}

/* Anillo decorativo pulsante */
.cookie-float-btn::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.3;
    animation: ringPulse 2s ease-out infinite;
    z-index: -1;
}

@keyframes ringPulse {
    0% {
        transform: scale(1);
        opacity: 0.3;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Tooltip al hacer hover */
.cookie-float-tooltip {
    position: absolute;
    left: 75px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* Flecha del tooltip */
.cookie-float-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 6px 0;
    border-color: transparent rgba(15, 23, 42, 0.95) transparent transparent;
}

/* Mostrar tooltip al hover */
.cookie-float-btn:hover + .cookie-float-tooltip {
    opacity: 1;
    visibility: visible;
    left: 70px;
}

/* Badge de notificación (opcional - para mostrar si hay cambios) */
.cookie-float-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #ef4444;
    border-radius: 50%;
    border: 3px solid white;
    display: none; /* Oculto por defecto */
    animation: badgePulse 1.5s ease-in-out infinite;
}

.cookie-float-badge.show {
    display: block;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Responsive - Mover a la derecha en móvil */
@media (max-width: 768px) {
    .cookie-float-button {
        left: auto;
        right: 20px;
    }

    .cookie-float-tooltip {
        left: auto;
        right: 75px;
    }

    .cookie-float-tooltip::before {
        left: auto;
        right: -6px;
        border-width: 6px 0 6px 6px;
        border-color: transparent transparent transparent rgba(15, 23, 42, 0.95);
    }

    .cookie-float-btn:hover + .cookie-float-tooltip {
        right: 70px;
        left: auto;
    }

    /* Botón más pequeño en móvil */
    .cookie-float-btn {
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }
}

/* Ajustes para evitar que tape contenido importante */
@media (max-width: 480px) {
    .cookie-float-button {
        bottom: 80px; /* Más alto para no tapar botones de footer */
    }
}

/* Accesibilidad - Focus visible */
.cookie-float-btn:focus {
    outline: 3px solid rgba(99, 102, 241, 0.5);
    outline-offset: 4px;
}

/* Ocultar tooltip en dispositivos táctiles cuando no hay hover real */
@media (hover: none) {
    .cookie-float-tooltip {
        display: none;
    }
}

/* Variante alternativa: Botón cuadrado con esquinas redondeadas */
.cookie-float-btn.square {
    border-radius: 16px;
    width: 56px;
    height: 56px;
}

.cookie-float-btn.square::before {
    border-radius: 20px;
}

/* Variante alternativa: Botón con texto */
.cookie-float-btn.with-text {
    width: auto;
    padding: 0 1.25rem;
    border-radius: 2rem;
    font-size: 1rem;
    gap: 0.5rem;
}

.cookie-float-btn-text {
    font-weight: 600;
    color: white;
    display: none;
}

.cookie-float-btn.with-text .cookie-float-btn-text {
    display: inline;
}

/* Animación de entrada cuando aparece el botón */
@keyframes slideInLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.cookie-float-button.visible {
    animation: slideInLeft 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .cookie-float-tooltip {
        background: rgba(248, 250, 252, 0.95);
        color: #0f172a;
    }

    .cookie-float-tooltip::before {
        border-color: transparent rgba(248, 250, 252, 0.95) transparent transparent;
    }

    @media (max-width: 768px) {
        .cookie-float-tooltip::before {
            border-color: transparent transparent transparent rgba(248, 250, 252, 0.95);
        }
    }
}

/* Efecto de "mordida" en la galleta (opcional - creativo) */
.cookie-float-btn.bitten::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50% 0 50% 50%;
    transform: rotate(-45deg);
}

/* Animación de "crujido" al hacer click */
@keyframes cookieCrunch {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(0.9) rotate(-5deg); }
    50% { transform: scale(1.05) rotate(5deg); }
    75% { transform: scale(0.95) rotate(-3deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.cookie-float-btn.crunching {
    animation: cookieCrunch 0.5s ease;
}
