/* ========================================
   FLOATING BALLS - Interactive Skill Visualization
   ======================================== */

.floating-balls-section {
    margin: 60px auto;
    padding: 40px 20px;
    max-width: 1200px;
}

.floating-balls-header {
    text-align: center;
    margin-bottom: 30px;
}

.floating-balls-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.8rem, 5vw, 2.5rem);
    color: #0ff;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

.floating-balls-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    max-width: 600px;
    margin: 0 auto;
}

/* Container for the floating balls */
.floating-balls-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: linear-gradient(135deg, 
        rgba(10, 15, 31, 0.9) 0%, 
        rgba(20, 25, 50, 0.8) 100%);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 0 60px rgba(0, 255, 255, 0.05);
    cursor: grab;
    touch-action: none;
    /* Rendering optimization */
    transform: translateZ(0);
    will-change: auto;
    isolation: isolate;
}

.floating-balls-container:active {
    cursor: grabbing;
}

/* Individual ball styling */
.skill-ball {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.2) 0%, 
        rgba(0, 200, 255, 0.3) 100%);
    border: 2px solid rgba(0, 255, 255, 0.6);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    padding: 10px;
    box-shadow: 
        0 5px 15px rgba(0, 255, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    user-select: none;
    cursor: grab;
    z-index: 1;
    /* Hardware acceleration and smoothness */
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.skill-ball:hover {
    border-color: #0ff;
    box-shadow: 
        0 8px 25px rgba(0, 255, 255, 0.5),
        inset 0 0 30px rgba(0, 255, 255, 0.2);
    transform: scale(1.05);
}

.skill-ball:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.skill-ball.dragging {
    z-index: 100;
    cursor: grabbing;
    box-shadow: 
        0 15px 40px rgba(0, 255, 255, 0.6),
        inset 0 0 40px rgba(0, 255, 255, 0.3);
}

/* Click animation effect */
@keyframes ripple {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 255, 0.7);
    }
    100% {
        box-shadow: 0 0 0 30px rgba(0, 255, 255, 0);
    }
}

.skill-ball.clicked {
    animation: ripple 0.6s ease-out;
}

/* Glow pulse on hover */
@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 
            0 5px 15px rgba(0, 255, 255, 0.3),
            inset 0 0 20px rgba(0, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 8px 30px rgba(0, 255, 255, 0.6),
            inset 0 0 40px rgba(0, 255, 255, 0.3);
    }
}

.skill-ball:hover {
    animation: glow-pulse 1.5s ease-in-out infinite;
}

/* Tooltip for additional info */
.skill-ball-tooltip {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%) scale(0);
    background: rgba(10, 15, 31, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    pointer-events: none;
    border: 1px solid rgba(0, 255, 255, 0.5);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.skill-ball-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(10, 15, 31, 0.95);
}

.skill-ball:hover .skill-ball-tooltip {
    transform: translateX(-50%) scale(1);
    opacity: 1;
}

/* Confetti effect on click */
.confetti-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #0ff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999;
    animation: confetti-fall 1s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) rotate(720deg);
        opacity: 0;
    }
}

/* Control panel */
.floating-balls-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.floating-balls-controls button {
    padding: 10px 20px;
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid rgba(0, 255, 255, 0.5);
    border-radius: 8px;
    color: #0ff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.floating-balls-controls button:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #0ff;
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.3);
}

.floating-balls-controls button:active {
    transform: scale(0.95);
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .floating-balls-section {
        padding: 30px 15px;
        margin: 40px auto;
    }
    
    .floating-balls-container {
        height: 400px;
        border-radius: 15px;
    }
    
    .skill-ball {
        font-size: 0.75rem;
        padding: 8px;
    }
    
    .floating-balls-header h2 {
        font-size: 1.6rem;
    }
    
    .floating-balls-controls button {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
}

@media screen and (max-width: 480px) {
    .floating-balls-container {
        height: 350px;
    }
    
    .skill-ball {
        font-size: 0.7rem;
        padding: 6px;
    }
    
    .floating-balls-header h2 {
        font-size: 1.4rem;
    }
}

/* Accessibility */
.skill-ball:focus {
    outline: 3px solid #0ff;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .skill-ball,
    .skill-ball-tooltip,
    .confetti-particle {
        animation: none;
        transition: none;
    }
}
