/* 
==============================================
   ADIPOLI - FUNCTIONAL CORE ADVANCED ANIMATIONS
   Enhanced bubble interactions & visual effects
==============================================
*/

/* ===================================
   ORBITAL FLOATING ANIMATIONS
=================================== */

/* Each bubble gets its own unique orbital path */
@keyframes orbitFloat1 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(15px, -20px) scale(1.05);
    }
    50% {
        transform: translate(25px, -10px) scale(1);
    }
    75% {
        transform: translate(10px, 15px) scale(0.95);
    }
}

@keyframes orbitFloat2 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-20px, 15px) scale(0.95);
    }
    50% {
        transform: translate(-15px, -20px) scale(1.05);
    }
    75% {
        transform: translate(10px, -10px) scale(1);
    }
}

@keyframes orbitFloat3 {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(10px, 20px) scale(1.05);
    }
    50% {
        transform: translate(-15px, 15px) scale(0.95);
    }
    75% {
        transform: translate(-20px, -10px) scale(1);
    }
}

/* ===================================
   PULSING GLOW EFFECTS
=================================== */

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 
            0 0 20px currentColor,
            0 0 40px rgba(0, 229, 255, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px currentColor,
            0 0 80px rgba(0, 229, 255, 0.5),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

@keyframes pulseGlowOrange {
    0%, 100% {
        box-shadow: 
            0 0 20px currentColor,
            0 0 40px rgba(255, 158, 64, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px currentColor,
            0 0 80px rgba(255, 158, 64, 0.5),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

@keyframes pulseGlowLime {
    0%, 100% {
        box-shadow: 
            0 0 20px currentColor,
            0 0 40px rgba(192, 255, 0, 0.3),
            inset 0 0 20px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px currentColor,
            0 0 80px rgba(192, 255, 0, 0.5),
            inset 0 0 30px rgba(255, 255, 255, 0.2);
    }
}

/* ===================================
   ENTRANCE ANIMATIONS (Staggered)
=================================== */

@keyframes bubbleEntrance {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.15) rotate(20deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ===================================
   CONNECTING LINES ANIMATION
=================================== */

@keyframes lineGlow {
    0%, 100% {
        opacity: 0.3;
        stroke-dashoffset: 0;
    }
    50% {
        opacity: 0.6;
        stroke-dashoffset: 10;
    }
}

/* ===================================
   ENHANCED BUBBLE STYLES
=================================== */

.features-visual-area {
    position: relative;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* SVG Container for connecting lines */
.bubble-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.bubble-connections line {
    stroke: rgba(0, 229, 255, 0.2);
    stroke-width: 1;
    stroke-dasharray: 5, 5;
    animation: lineGlow 3s ease-in-out infinite;
}

/* Enhanced Bubble Base */
.chem-bubble {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    
    /* Add entrance animation */
    animation: bubbleEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

/* Magnesium - Main bubble */
.bubble-mg {
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, #1a1a1a, #0a0a0a);
    border: 2px solid #00e5ff;
    color: #00e5ff;
    top: 20%;
    left: 10%;
    font-size: 1.8rem;
    z-index: 3;
    
    animation: 
        orbitFloat1 8s ease-in-out infinite,
        pulseGlow 3s ease-in-out infinite,
        bubbleEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: 0s, 0s, 0s;
}

/* B6 */
.bubble-b6 {
    width: 100px;
    height: 100px;
    background: rgba(20, 20, 20, 0.6);
    border: 2px solid #ff9e40;
    color: #ff9e40;
    top: 30%;
    right: 15%;
    z-index: 2;
    
    animation: 
        orbitFloat2 7s ease-in-out infinite,
        pulseGlowOrange 3.5s ease-in-out infinite,
        bubbleEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: 0s, 0.5s, 0.2s;
}

/* B12 - Featured */
.bubble-b12 {
    width: 120px;
    height: 120px;
    background: rgba(20, 20, 20, 0.6);
    border: 2px solid #c0ff00;
    color: #c0ff00;
    bottom: 20%;
    left: 45%;
    font-size: 1.6rem;
    z-index: 3;
    
    animation: 
        orbitFloat3 6.5s ease-in-out infinite,
        pulseGlowLime 3s ease-in-out infinite,
        bubbleEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: 0s, 1s, 0.4s;
}

/* B3 - Niacin */
.bubble-b3 {
    width: 90px;
    height: 90px;
    background: rgba(20, 20, 20, 0.6);
    border: 2px solid #00e5ff;
    color: #00e5ff;
    top: 15%;
    right: 25%;
    font-size: 1.2rem;
    z-index: 1;
    
    animation: 
        orbitFloat1 9s ease-in-out infinite,
        pulseGlow 4s ease-in-out infinite,
        bubbleEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: 0s, 1.5s, 0.6s;
}

/* B7 - Biotin */
.bubble-b7 {
    width: 80px;
    height: 80px;
    background: rgba(20, 20, 20, 0.6);
    border: 2px solid #ff9e40;
    color: #ff9e40;
    bottom: 30%;
    right: 10%;
    font-size: 1.1rem;
    z-index: 1;
    
    animation: 
        orbitFloat2 8.5s ease-in-out infinite,
        pulseGlowOrange 4.5s ease-in-out infinite,
        bubbleEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    animation-delay: 0s, 2s, 0.8s;
}

/* ===================================
   HOVER INTERACTIONS (Desktop)
=================================== */

@media (min-width: 1024px) {
    .chem-bubble:hover {
        transform: scale(1.25) !important;
        z-index: 10 !important;
        border-width: 3px;
        animation-play-state: paused;
    }
    
    .bubble-mg:hover {
        box-shadow: 
            0 0 60px #00e5ff,
            0 0 120px rgba(0, 229, 255, 0.6),
            inset 0 0 40px rgba(0, 229, 255, 0.3);
    }
    
    .bubble-b6:hover,
    .bubble-b7:hover {
        box-shadow: 
            0 0 60px #ff9e40,
            0 0 120px rgba(255, 158, 64, 0.6),
            inset 0 0 40px rgba(255, 158, 64, 0.3);
    }
    
    .bubble-b12:hover,
    .bubble-b3:hover {
        box-shadow: 
            0 0 60px #c0ff00,
            0 0 120px rgba(192, 255, 0, 0.6),
            inset 0 0 40px rgba(192, 255, 0, 0.3);
    }

    /* Magnetic effect - bubble follows cursor slightly */
    .features-visual-area:hover .chem-bubble {
        transition: transform 0.2s ease-out;
    }
}

/* ===================================
   BUBBLE CONTENT ANIMATIONS
=================================== */

.symbol {
    font-size: 1.5rem;
    animation: symbolPulse 2s ease-in-out infinite;
    display: inline-block;
}

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

/* Tooltip on hover */
.chem-bubble::after {
    content: attr(data-name);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.chem-bubble:hover::after {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* ===================================
   MOBILE OPTIMIZATIONS
=================================== */

@media (max-width: 768px) {
    /* Simplify animations on mobile for performance */
    .chem-bubble {
        animation: bubbleEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    }
    
    .bubble-mg {
        animation: 
            orbitFloat1 10s ease-in-out infinite,
            bubbleEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    }
    
    .bubble-b6,
    .bubble-b12,
    .bubble-b3,
    .bubble-b7 {
        animation: 
            orbitFloat2 12s ease-in-out infinite,
            bubbleEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    }
    
    /* Tap effect for mobile */
    .chem-bubble:active {
        transform: scale(1.1);
        filter: brightness(1.3);
    }
    
    /* Hide connecting lines on mobile */
    .bubble-connections {
        display: none;
    }
}

/* ===================================
   ACCESSIBILITY
=================================== */

@media (prefers-reduced-motion: reduce) {
    .chem-bubble {
        animation: none !important;
    }
    
    .symbol {
        animation: none !important;
    }
}

/* ===================================
   ADDITIONAL VISUAL ENHANCEMENTS
=================================== */

/* Ambient glow around section */
.functional-core-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(
        circle,
        rgba(0, 229, 255, 0.1) 0%,
        rgba(192, 255, 0, 0.05) 50%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 0;
    animation: ambientGlow 8s ease-in-out infinite alternate;
}

@keyframes ambientGlow {
    0% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Particle effects (optional - requires JS) */
.bubble-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    animation: particleFloat 3s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--tx), var(--ty)) scale(0);
    }
}