/*-----------------------------------*\
 * #ROBOT COMPONENT - REDESIGN
\*-----------------------------------*/

.robot-container {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    will-change: transform;
}

.robot-container>* {
    pointer-events: auto;
}

/* --- NAVBAR BUDDY BUTTON --- */
.buddy-control-btn {
    background: var(--bg-secondary);
    color: var(--color-primary);
    border: 1px solid var(--sizzling-sunrise);
    border-radius: 20px;
    padding: 6px 15px;
    font-family: var(--ff-poppins);
    font-size: 11px;
    font-weight: var(--fw-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 10px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.buddy-control-btn ion-icon {
    font-size: 16px;
    --ionicon-stroke-width: 40px;
}

.buddy-control-btn:hover {
    background: var(--sizzling-sunrise);
    color: #000;
    box-shadow: 0 0 15px rgba(255, 177, 43, 0.4);
}

.buddy-control-btn.tour-active {
    background: var(--sizzling-sunrise);
    color: #000;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 177, 43, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 177, 43, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 177, 43, 0);
    }
}

@media (max-width: 450px) {
    .buddy-control-btn {
        font-size: 10px;
        padding: 4px 10px;
        margin-right: 5px;
    }
}

/* --- ROBOT VISUALS --- */

.robot-wrapper {
    position: relative;
    width: 120px;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.robot {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
    cursor: pointer;
    animation: float-idle 3s ease-in-out infinite;
    transform-style: preserve-3d;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.robot:active {
    transform: scale(0.95);
}

/* Head - 3D Sphere Look */
.head {
    width: 70px;
    height: 55px;
    background: radial-gradient(circle at 35% 35%, var(--bg-secondary), #0d1b2a);
    /* 3D Lighting */
    border: none;
    /* Keep border for definition, or remove for pure 3D? Keeping for style consistency */
    border-radius: 40% 40% 45% 45%;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    overflow: hidden;
    box-shadow:
        inset -5px -5px 15px rgba(0, 0, 0, 0.5),
        /* Deep shadow */
        inset 5px 5px 10px rgba(255, 255, 255, 0.1),
        /* Rim light */
        0 10px 20px rgba(0, 0, 0, 0.3);
    /* Drop shadow */
}

/* Eyes */
/* Face/Screen - Inset Depth */
.face {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    top: 2px;
    background: #d2d2d2;
    /* Flat dark gray/black */
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
    border: none;
}

.eye {
    width: 18px;
    height: 22px;
    background: #000;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    animation: blink 4s infinite random;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.pupil {
    width: 8px;
    height: 8px;
    background: var(--sizzling-sunrise);
    /* Keep brand color */
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: none;
    /* Remove glow */
    transition: transform 0.1s ease-out;
    /* Smooth but fast for tracking */
    will-change: transform;
}

/* Eye Interaction */
.robot:hover .pupil {
    transform: scale(1.3);
    background: #fff;
    box-shadow: none;
}

/* Mouth - Smily by default */
.mouth {
    position: absolute;
    bottom: 8px;
    width: 16px;
    height: 8px;
    border-bottom: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 0 0 10px 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.robot:hover .mouth {
    width: 24px;
    height: 12px;
    border-bottom: 4px solid var(--sizzling-sunrise);
}

/* --- MOODS --- */

/* Happy Mood */
.mood-happy .mouth {
    width: 26px;
    height: 14px;
    border-bottom: 4px solid var(--sizzling-sunrise);
    border-radius: 0 0 15px 15px;
}

.mood-happy .eye {
    height: 18px;
}

/* Talking Mood */
.mood-talking .mouth {
    animation: talk-mouth 0.5s infinite alternate;
}

@keyframes talk-mouth {
    0% {
        width: 12px;
        height: 4px;
        border-radius: 10px;
    }

    100% {
        width: 18px;
        height: 10px;
        border-radius: 2px 2px 10px 10px;
    }
}

/* Surprised Mood (Avoidance) */
.mood-surprised .mouth {
    width: 12px;
    height: 12px;
    border: 3px solid var(--sizzling-sunrise);
    border-radius: 50%;
}

.mood-surprised .eye {
    transform: scale(1.2);
}

/* Angry Mood (Scolding) */
.mood-angry .eye.left {
    transform: rotate(15deg);
}

.mood-angry .eye.right {
    transform: rotate(-15deg);
}

.mood-angry .mouth {
    width: 20px;
    height: 2px;
    background: var(--sizzling-sunrise);
    border: none;
    border-radius: 0;
    bottom: 12px;
}

.robot-wrapper {
    position: relative;
    width: 120px;
    height: 160px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Smoother overall */
}

/* Antenna */
.antenna {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    transition: transform 0.2s ease;
}

.robot:hover .antenna {
    transform: translateX(-50%) rotate(15deg);
}

/* Antenna - Minimal */
.antenna-stick {
    width: 3px;
    height: 25px;
    background: #333;
    margin: 0 auto;
}

.antenna-ball {
    width: 12px;
    height: 12px;
    background: var(--sizzling-sunrise);
    border-radius: 50%;
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 2px solid #333;
    box-shadow: none;
    animation: pulse-flat 2s infinite;
}

/* Torso - Minimal White */
.torso {
    width: 50px;
    height: 40px;
    background: radial-gradient(circle at 35% 35%, #2d80da, #0d1b2a);
    border: none;
    border-radius: 10px 10px 25px 25px;
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.05);
}

.neck {
    position: absolute;
    top: -8px;
    width: 20px;
    height: 10px;
    background: #ddd;
    z-index: -1;
    border-radius: 5px;
    border: 2px solid #333;
}

/* Chest Screen */
.chest-screen {
    width: 30px;
    height: 20px;
    background: #222;
    border-radius: 8px;
    border: 1px solid #555;
    position: relative;
    overflow: hidden;
}

.heartbeat-path {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--sizzling-sunrise);
    box-shadow: none;
    transform: translateY(-50%);
    animation: heartbeat-slide 1.5s linear infinite;
}

/* Arms - Minimal */
.arm {
    position: absolute;
    top: 5px;
    width: 14px;
    height: 40px;
    z-index: 4;
}

.arm.left {
    left: -14px;
    transform-origin: top right;
    transform: rotate(10deg);
    animation: arm-sway-left 2s ease-in-out infinite alternate;
}

.arm.right {
    right: -14px;
    transform-origin: top left;
    transform: rotate(-10deg);
    animation: arm-sway-right 2s ease-in-out infinite alternate;
}

.shoulder {
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 35% 35%, #2d80da, #0d1b2a);
    border: none;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    box-shadow: none;
}

.limb {
    width: 16px;
    height: 28px;
    background: radial-gradient(circle at 35% 35%, #2d80da, #0d1b2a);
    border: none;
    position: absolute;
    top: 0px;
    left: 0px;
    border-radius: 10px;
    box-shadow: none;
}

.hand {
    width: 14px;
    height: 14px;
    background: radial-gradient(circle at 35% 35%, var(--sizzling-sunrise), #ffffff);
    border-radius: 50%;
    position: absolute;
    bottom: -4px;
    left: 1px;
}

/* Hand Finger for Pointing */
.hand::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 6px;
    height: 8px;
    background: #333;
    border-radius: 3px;
    transition: transform 0.2s ease;
}

/* Propulsion (No more wheels) */
.propulsion {
    position: absolute;
    bottom: 50px;
    /* Relative to bottom container, visually under torso */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.flame {
    width: 24px;
    height: 48px;
    background: linear-gradient(to bottom, #ff9072, #ffd95b);
    border-radius: 50% 50% 20% 20%;
    filter: blur(2px);
    animation: flame-flicker 0.1s infinite alternate;
    transform-origin: top center;
    position: relative;
    top: -3px;
}

.flame-core {
    width: 8px;
    height: 15px;
    background: #fff;
    border-radius: 50%;
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    filter: blur(1px);
    opacity: 0.8;
}

/* Shadow */
.robot-shadow {
    position: absolute;
    bottom: 20px;
    width: 80px;
    height: 10px;
    background: rgba(0, 0, 0, 0.185);
    border-radius: 50%;
    filter: blur(4px);
    animation: shadow-scale 3s ease-in-out infinite;
    transform: translateX(-20px);
}

/* --- ANIMATIONS --- */

@keyframes float-idle {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes shadow-scale {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.4;
    }

    50% {
        transform: scale(0.8);
        opacity: 0.2;
    }
}

@keyframes blink {

    0%,
    96%,
    100% {
        height: 22px;
    }

    98% {
        height: 2px;
    }
}

@keyframes pulse-flat {

    0%,
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    50% {
        opacity: 0.7;
        transform: translateX(-50%) scale(0.9);
    }
}

@keyframes heartbeat-slide {
    0% {
        width: 0;
        left: 0;
        opacity: 0;
    }

    20% {
        width: 30%;
        opacity: 1;
    }

    80% {
        width: 30%;
        left: 70%;
        opacity: 1;
    }

    100% {
        width: 0;
        left: 100%;
        opacity: 0;
    }
}

@keyframes flame-flicker {
    0% {
        transform: scaleY(1) scaleX(1);
        opacity: 0.9;
    }

    100% {
        transform: scaleY(1.2) scaleX(0.9);
        opacity: 1;
    }
}

@keyframes arm-sway-left {
    0% {
        transform: rotate(10deg);
    }

    100% {
        transform: rotate(20deg);
    }
}

@keyframes arm-sway-right {
    0% {
        transform: rotate(-10deg);
    }

    100% {
        transform: rotate(-20deg);
    }
}

/* --- INTERACTIVE STATES (Controlled by JS) --- */

/* Pointing Down */
/* --- Redesigned Pointing Gesture - Shake & Wait --- */

.robot-container.pointing-down .robot {
    transform: translateY(5px) rotate(5deg);
    transition: transform 0.5s ease;
}

.robot-container.pointing-down .arm.right {
    transform-origin: top center;
    /* Animate: Shake for 1.5s, wait for 1.5s */
    animation: point-shake-wait 3s ease-in-out infinite;
    transform: rotate(160deg);
    /* Base position */
}

.robot-container.pointing-down .arm.right .hand::after {
    transform: translateX(-50%) scale(1);
    /* Reveal finger */
}

.robot-container.pointing-down .arm.left {
    transform: rotate(-15deg);
    /* Relaxed counter-balance */
    animation: none;
}

@keyframes point-down-piston {
    0% {
        transform: rotate(160deg) translateY(0);
    }

    100% {
        transform: rotate(160deg) translateY(8px);
    }

    /* Pushing motion */
}


/* --- SPEECH BUBBLE (Imported Previous Styles) --- */
.speech-bubble {
    position: absolute;
    bottom: 140px;
    /* Adjusted for new height */
    width: 220px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--color-primary);
    padding: 15px 20px;
    font-family: var(--ff-poppins);
    font-size: var(--fs-6);
    font-weight: var(--fw-400);
    text-align: left;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    opacity: 0;
    transform: scale(0);
    transform-origin: bottom center;
    transition: opacity 0.3s ease;
    pointer-events: auto;
    z-index: 1001;
}

.speech-bubble.active {
    animation: bubblePop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes bubblePop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.speech-bubble.anchor-right {
    left: 90px;
    border-radius: 20px 20px 20px 0;
    transform-origin: bottom left;
}

.speech-bubble.anchor-left {
    right: 90px;
    border-radius: 20px 20px 0 20px;
    transform-origin: bottom right;
}

/* --- JOY SPIN & WAVE --- */
.is-spinning .robot {
    animation: joy-spin 1s cubic-bezier(0.45, 0.05, 0.55, 0.95);
}

.is-spinning .arm.left {
    animation: joy-wave-left 0.5s ease-in-out infinite alternate !important;
}

.is-spinning .arm.right {
    animation: joy-wave-right 0.5s ease-in-out infinite alternate !important;
}

@keyframes joy-spin {
    0% {
        transform: rotateY(0);
    }

    100% {
        transform: rotateY(720deg);
    }

    /* Two full 3D spins */
}

@keyframes joy-wave-left {
    0% {
        transform: rotate(20deg);
    }

    100% {
        transform: rotate(150deg);
    }

    /* Waving high */
}

@keyframes joy-wave-right {
    0% {
        transform: rotate(-20deg);
    }

    100% {
        transform: rotate(-150deg);
    }

    /* Waving high */
}

/* --- STORY SECTION --- */
.robot-story-section {
    min-height: 80vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

/* --- GIANT ROBOT STATE --- */
.robot-container.is-giant .robot-wrapper {
    transform: scale(2.8);
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.robot-container.is-giant .speech-bubble {
    width: 400px;
    font-size: var(--fs-4);
    bottom: 270px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    text-align: center;
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.robot-btn {
    display: none;
    background: var(--sizzling-sunrise);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--ff-poppins);
    font-size: var(--fs-6);
    font-weight: var(--fw-600);
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
    pointer-events: auto;
    margin-top: 10px;
}

.robot-btn:hover {
    transform: scale(1.05);
    background: #fff;
}

.robot-btn.active {
    display: inline-block;
}

.robot-container.is-giant .speech-bubble::after {
    display: none;
    /* Hide tail for centered giant bubble */
}