/* ESTILOS DEL CANGREJO TOUR BUDDY */

#buddy-nest {
    position: fixed; /* fixed = siempre visible aunque el contenedor haga scroll */
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Transiciones suaves para left, top y transform (escala) */
    transition: opacity 0.5s, left 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275), top 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
    /* Posición inicial — se sobreescribe por JS en cuanto el primer slide es visible */
    left: 85%;
    top: 15%;
    transform: translate(-50%, -50%);
}

#buddy-nest.awake {
    opacity: 1;
    pointer-events: all;
}

/* Estado Mareado (Gravedad) */
#buddy-nest.dizzy {
    animation: dizzyFall 0.8s ease-in-out forwards;
}

@keyframes dizzyFall {
    0% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(-50px) rotate(180deg); }
    100% { transform: translateY(20px) rotate(360deg); }
}

#buddy-click-area {
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#buddy-svg {
    width: 150px;
    height: auto;
    filter: drop-shadow(0 8px 15px rgba(216, 67, 21, 0.2));
    animation: pixarFloat 4s ease-in-out infinite;
    transition: filter 0.3s ease, transform 0.3s;
}

#buddy-click-area:hover #buddy-svg {
    filter: drop-shadow(0 12px 25px rgba(216, 67, 21, 0.4));
}

/* ANIMACIONES PIXAR */
@keyframes pixarFloat {
    0%, 100% { transform: translateY(0) rotate(0deg) scale(1, 1); }
    25% { transform: translateY(-15px) rotate(2deg) scale(0.98, 1.05); }
    50% { transform: translateY(-5px) rotate(-1deg) scale(1.02, 0.95); }
    75% { transform: translateY(-18px) rotate(3deg) scale(0.97, 1.03); }
}

/* Partes animadas */
#left-claw { transform-origin: 45px 65px; transition: transform 0.2s; }
#right-claw { transform-origin: 105px 65px; transition: transform 0.2s; }
#left-eye-stalk, #right-eye-stalk { transform-origin: bottom; transition: transform 0.2s; }

/* Animación de Mordisco */
.biting #left-claw { animation: biteLeft 0.3s infinite; }
.biting #right-claw { animation: biteRight 0.3s infinite; }

@keyframes biteLeft {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(-20deg); }
}
@keyframes biteRight {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(20deg); }
}

/* BOCADILLO DE DIÁLOGO */
#speech-bubble {
    background: white;
    border-radius: 20px;
    padding: 12px 20px;
    font-size: 15px;
    line-height: 1.4;
    color: #bf360c;
    font-weight: 600;
    margin-bottom: -10px;
    position: relative;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    transition: opacity 0.3s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 11;
    pointer-events: none;
    max-width: 200px;
    word-wrap: break-word;
}

#buddy-nest.awake #speech-bubble {
    opacity: 1;
    transform: scale(1) translateY(0);
}

#speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px; left: 50%;
    transform: translateX(-50%);
    border: 12px solid transparent;
    border-top-color: white;
    border-bottom: none;
}

/* MENÚ DE ACCIONES */
#actions-menu {
    position: absolute;
    bottom: 110%;
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 5;
}

#actions-menu.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    border-radius: 50px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.action-card:hover { transform: translateX(-10px); box-shadow: 0 8px 25px rgba(0,0,0,0.2); }
.btn-whatsapp { background: linear-gradient(135deg, #25D366 0%, #128C7E 100%); }
.btn-book { background: linear-gradient(135deg, #ff5722 0%, #d84315 100%); }

.buddy-icon { width: 22px; height: 22px; fill: white; }

#tap-hint {
    font-size: 12px;
    color: #e65100;
    margin-top: 5px;
    opacity: 0.8;
    animation: pulseHint 2s infinite;
}
@keyframes pulseHint { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

@keyframes shakeBuddy {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.shake-animation {
    animation: shakeBuddy 0.5s linear 1 !important;
}

/* Binoculares (Ocultos por defecto) */
#buddy-binoculars {
    opacity: 0;
    transition: opacity 0.3s;
}
.spying #buddy-binoculars {
    opacity: 1;
}

/* PAGINACIÓN LATERAL */
.chm-pagination {
    position: fixed;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 1000;
}
.chm-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.chm-dot.active {
    background: #ff5722;
    transform: scale(1.6);
    box-shadow: 0 0 10px rgba(255, 87, 34, 0.6);
}

/* INDICADOR DE SCROLL (HINT) */
.chm-scroll-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    opacity: 0.8;
    animation: bounceHint 2s infinite;
    pointer-events: none;
    transition: opacity 0.5s;
}
.chm-scroll-text {
    font-size: 11px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}
.chm-scroll-arrow {
    width: 24px;
    height: 24px;
    transition: transform 0.3s;
}
.chm-hint-up .chm-scroll-arrow {
    transform: rotate(180deg);
}
@keyframes bounceHint {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* ANIMACIÓN DE SALTO (cambio de slide) */
.buddy-jumping {
    animation: buddyJump 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes buddyJump {
    0%   { transform: translate(-50%, -50%) scale(1)    rotate(0deg);   opacity: 1; }
    25%  { transform: translate(-50%, -50%) scale(1.3)  rotate(-15deg); opacity: 1; }
    50%  { transform: translate(-50%, -50%) scale(0.6)  rotate(20deg);  opacity: 0; }
    51%  { transform: translate(-50%, -50%) scale(0.6)  rotate(-20deg); opacity: 0; }
    75%  { transform: translate(-50%, -50%) scale(1.25) rotate(10deg);  opacity: 1; }
    88%  { transform: translate(-50%, -50%) scale(0.92) rotate(-4deg);  opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1)    rotate(0deg);   opacity: 1; }
}

@media (max-width: 768px) {
    .chm-pagination { right: 10px; }
}
