/* =============================================================================
   DESPAIR BOT — Animations CSS
   GSAP targets, keyframes, transitions, and micro-interactions.
   ============================================================================= */

/* --- Page Load Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--accent-cyan-dim);
    }
    50% {
        box-shadow: 0 0 20px var(--accent-cyan-glow);
    }
}

/* --- Shake Animation (Login Error) --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* --- Staggered Entry for Cards --- */
.animate-in {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
.animate-in:nth-child(5) { animation-delay: 0.25s; }
.animate-in:nth-child(6) { animation-delay: 0.3s; }

/* --- Card Hover Effects --- */
.card-interactive {
    transition: all var(--transition-normal);
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-cyan);
    border-color: var(--accent-cyan);
}

/* --- Stat Counter Animation Target --- */
.stat-counter {
    transition: all var(--transition-slow);
}

/* --- Table Row Hover Glow --- */
.table-container tr {
    transition: all var(--transition-fast);
}

.table-container tr:hover {
    box-shadow: inset 3px 0 0 var(--accent-cyan);
}

/* --- Button Press Effect --- */
.btn:active {
    transform: translateY(0) scale(0.98);
}

/* --- Loading Pulse for Live Elements --- */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-success);
    animation: pulse 2s ease-in-out infinite;
}

/* --- Three.js Canvas Target --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* --- Login Card Animation --- */
.login-card {
    animation: fadeInUp 0.6s ease forwards;
    position: relative;
    z-index: 10;
}

.login-card.error {
    animation: shake 0.5s ease-in-out, fadeInUp 0.6s ease forwards;
}

/* --- Sidebar Nav Link Active Indicator --- */
.nav-link.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-cyan);
    border-radius: 3px 0 0 3px;
}

/* --- Toggle Animation --- */
.toggle-switch input:checked + .toggle-slider {
    animation: glowPulse 2s ease-in-out 1;
}

/* --- Progress Bar --- */
.progress-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-amber));
    border-radius: 2px;
    transition: width var(--transition-slow);
}

/* --- Ripple Effect --- */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.ripple:active::after {
    width: 200px;
    height: 200px;
}
