/* Floating Buttons */
.btn-flotante {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#plane-btn {
    bottom: 100px;
}

/* Bubbles Animation Styles */
.burbuja {
    position: fixed;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    z-index: 999;
    background-color: black;
}

.burbuja.izq {
    left: 20px;
    bottom: 20px;
}

.burbuja.der {
    right: 20px;
    bottom: 20px;
}

/* Animación */
:root {
    --target-left: 90%;
    --target-top: 30%;
}

@keyframes moverIzq {
    0% {
        left: 20px;
        bottom: 20px;
        opacity: 1;
        transform: translate(0, 0);
    }
    100% {
        left: var(--target-left);
        bottom: calc(100% - var(--target-top));
        opacity: 1;
        transform: translate(-50%, 50%);
    }
}

@keyframes moverDer {
    0% {
        right: 20px;
        bottom: 20px;
        opacity: 1;
        transform: translate(0, 0);
    }
    100% {
        right: calc(100% - var(--target-left));
        bottom: calc(100% - var(--target-top));
        opacity: 1;
        transform: translate(50%, 50%);
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInConexion {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fusionar {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.4);
    }
}

/* Contenedor principal de la fusión */
.fusion-container {
    position: fixed;
    left: var(--target-left);
    top: var(--target-top);
    transform: translate(-50%, -50%);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    width: 20%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Estilos para la burbuja fusionada */
.burbuja-fusionada {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #333;
    border: 2px solid #fff;
    z-index: 2;
}

.burbuja-fusionada::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background-image: url('../images/webp/victor.webp');
    background-size: cover;
    background-position: center;
    border-radius: 50% 0 0 50%;
}

.burbuja-fusionada::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 50%;
    height: 100%;
    background-image: url('../images/webp/daniel.webp');
    background-size: cover;
    background-position: center;
    border-radius: 0 50% 50% 0;
}

/* Fase 1: Fade In */
.burbuja.fade-in {
    animation: fadeIn 0.5s ease-out forwards !important;
    opacity: 1 !important;
}

/* Fase 2: Movimiento */
.burbuja.mover {
    opacity: 1 !important;
}

.burbuja.izq.mover {
    animation: moverIzq 2s forwards;
}

.burbuja.der.mover {
    animation: moverDer 2s forwards;
}

/* Fase 3: Fusión */
.burbuja.fusion {
    opacity: 0 !important;
}

/* Mostrar contenedor de fusión */
.mostrar-fusionada .fusion-container {
    opacity: 1 !important;
    transition: all 0.5s ease;
}

/* Ocultar burbujas cuando no están en animación */
.ocultar-burbujas .burbuja {
    opacity: 0 !important;
}

/* Estilos para el contenedor de conexión */
.conexion-container {
    position: relative;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    margin-top: -10px;
    display: flex;
    justify-content: center;
}

.conexion-texto {
    background: linear-gradient(135deg, #E30F18, var(--accent-color));
    color: white;
    padding: 6px 12px;
    border-radius: 25px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(227, 15, 24, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: opacity 0.6s ease;
}

/* Animación de despliegue */
.mostrar-conexion .conexion-container {
    opacity: 1 !important;
    animation: fadeInConexion 0.8s ease-out forwards;
    z-index: 2;
}

/* Plane Animation Styles */
#plane-container {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
}

#flight-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Contenedor principal del resultado del avión */
.plane-result-container {
    position: fixed;
    left: 90%;
    top: 30%;
    transform: translate(-50%, -50%);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    width: 20%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Estilos para la imagen única del resultado */
.plane-result-image {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #333;
    border: 2px solid #fff;
    z-index: 2;
    background-image: url('../images/webp/diego.webp');
    background-size: cover;
    background-position: center;
}

/* Estilos para el contenedor de texto del resultado */
.plane-result-text-container {
    position: relative;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    margin-top: -10px;
    display: flex;
    justify-content: center;
}

.plane-result-texto {
    background: linear-gradient(135deg, #E30F18, var(--accent-color));
    color: white;
    padding: 6px 12px;
    border-radius: 25px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(227, 15, 24, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: opacity 0.6s ease;
    text-align: center;
    max-width: 200px;
    text-wrap: wrap;
}

/* Animaciones para el resultado del avión */
@keyframes fadeInPlaneResult {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInPlaneText {
    0% {
        opacity: 0;
        transform: scale(0.7);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mostrar contenedor de resultado del avión */
.mostrar-plane-result .plane-result-container {
    opacity: 1 !important;
    transition: all 0.5s ease;
}

/* Mostrar texto del resultado del avión */
.mostrar-plane-text .plane-result-text-container {
    opacity: 1 !important;
    animation: fadeInPlaneText 0.8s ease-out forwards;
    z-index: 2;
}

/* Ocultar resultado del avión */
.ocultar-plane-result .plane-result-container {
    opacity: 0 !important;
}

/* ===== MEDIA QUERIES PARA MÓVILES ===== */
@media (max-width: 768px) {
    /* Ajustes para la animación de conexión (burbujas) */
    :root {
        --target-left: 50%;
        --target-top: 20%;
    }

    .burbuja {
        width: 60px;
        height: 60px;
    }

    .fusion-container {
        left: 50%;
        top: 20%;
        width: 80%;
        max-width: 280px;
    }

    .burbuja-fusionada {
        width: 90px;
        height: 90px;
    }

    .conexion-texto {
        font-size: 10px;
        padding: 8px 14px;
        white-space: normal;
        max-width: 180px;
        text-align: center;
        line-height: 1.3;
    }

    /* Ajustes para la animación del avión */
    .plane-result-container {
        left: 50%;
        top: 20%;
        width: 80%;
        max-width: 280px;
    }

    .plane-result-image {
        width: 90px;
        height: 90px;
    }

    .plane-result-texto {
        font-size: 10px;
        padding: 8px 14px;
        max-width: 180px;
        white-space: normal;
        line-height: 1.3;
    }

    /* Ajustar botones flotantes en móviles */
    .btn-flotante {
        width: 50px;
        height: 50px;
        font-size: 20px;
        bottom: 15px;
        right: 15px;
    }

    #plane-btn {
        bottom: 80px;
    }
}

/* Para pantallas muy pequeñas (< 480px) */
@media (max-width: 480px) {
    .fusion-container,
    .plane-result-container {
        width: 90%;
        max-width: 240px;
    }

    .burbuja-fusionada,
    .plane-result-image {
        width: 80px;
        height: 80px;
    }

    .conexion-texto,
    .plane-result-texto {
        font-size: 9px;
        padding: 6px 10px;
        max-width: 150px;
    }

    .burbuja {
        width: 50px;
        height: 50px;
    }

    .btn-flotante {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

