/* ========================================
   VSCode v1.104 - Animations
   ======================================== */

/* ========================================
   Global Animation Variables
   ======================================== */
:root {
    --transition-fast: 0.15s;
    --transition-normal: 0.25s;
    --transition-slow: 0.4s;
    --easing-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
    --easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --easing-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

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

.ripple::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

.ripple.clicked::after {
    animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* ========================================
   Pulse Effects
   ======================================== */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 204, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(0, 122, 204, 0);
    }
}

/* ========================================
   Shake Effect
   ======================================== */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* ========================================
   Fade Animations
   ======================================== */
.fade-in {
    animation: fadeIn var(--transition-normal) ease;
}

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

.fade-out {
    animation: fadeOut var(--transition-normal) ease forwards;
}

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

.fade-in-up {
    animation: fadeInUp var(--transition-normal) ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-down {
    animation: fadeInDown var(--transition-normal) ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-left {
    animation: fadeInLeft var(--transition-normal) ease;
}

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

.fade-in-right {
    animation: fadeInRight var(--transition-normal) ease;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   Scale Animations
   ======================================== */
.scale-in {
    animation: scaleIn var(--transition-normal) var(--easing-smooth);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.scale-out {
    animation: scaleOut var(--transition-normal) var(--easing-smooth) forwards;
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

.pop-in {
    animation: popIn var(--transition-normal) var(--easing-elastic);
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   Slide Animations
   ======================================== */
.slide-in-left {
    animation: slideInLeft var(--transition-slow) var(--easing-smooth);
}

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

.slide-in-right {
    animation: slideInRight var(--transition-slow) var(--easing-smooth);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-up {
    animation: slideInUp var(--transition-slow) var(--easing-smooth);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-down {
    animation: slideInDown var(--transition-slow) var(--easing-smooth);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Typing Animation
   ======================================== */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid var(--vscode-text);
    white-space: nowrap;
    animation: 
        typing 3.5s steps(40, end),
        blinkCursor 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blinkCursor {
    from, to { border-color: transparent; }
    50% { border-color: var(--vscode-text); }
}

/* ========================================
   Loading Animations
   ======================================== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: var(--vscode-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: var(--vscode-accent);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0; }

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.progress-bar-animated {
    position: relative;
    overflow: hidden;
}

.progress-bar-animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ========================================
   Tab Switching Animation
   ======================================== */
.tab-switch-enter {
    animation: tabSwitchEnter 0.4s var(--easing-smooth);
}

@keyframes tabSwitchEnter {
    0% {
        opacity: 0;
        transform: translateY(5px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.code-switch {
    animation: codeSwitch 0.5s var(--easing-smooth);
}

@keyframes codeSwitch {
    0% {
        opacity: 0;
        filter: blur(2px);
    }
    50% {
        opacity: 0.5;
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        filter: blur(0);
    }
}

/* ========================================
   File Save Animation
   ======================================== */
.save-flash {
    animation: saveFlash 0.5s ease;
}

@keyframes saveFlash {
    0% { background: transparent; }
    25% { background: rgba(0, 122, 204, 0.2); }
    100% { background: transparent; }
}

/* ========================================
   Hover Effects
   ======================================== */
.hover-lift {
    transition: transform var(--transition-fast) var(--easing-smooth),
                box-shadow var(--transition-fast) var(--easing-smooth);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hover-glow {
    transition: box-shadow var(--transition-fast) var(--easing-smooth);
}

.hover-glow:hover {
    box-shadow: 0 0 15px rgba(0, 122, 204, 0.4);
}

/* ========================================
   Icon Animations
   ======================================== */
.icon-spin {
    animation: iconSpin 1s linear infinite;
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.icon-bounce {
    animation: iconBounce 0.6s ease infinite;
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.icon-wiggle {
    animation: iconWiggle 0.5s ease-in-out;
}

@keyframes iconWiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

/* ========================================
   Cursor Animations
   ======================================== */
.cursor-move {
    transition: all 0.15s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.cursor-jump {
    animation: cursorJump 0.3s var(--easing-smooth);
}

@keyframes cursorJump {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); }
}

/* ========================================
   Highlight Effects
   ======================================== */
.highlight-flash {
    animation: highlightFlash 1s ease;
}

@keyframes highlightFlash {
    0% { background: rgba(255, 255, 0, 0); }
    20% { background: rgba(255, 255, 0, 0.3); }
    100% { background: rgba(255, 255, 0, 0); }
}

.selection-expand {
    animation: selectionExpand 0.2s var(--easing-smooth);
}

@keyframes selectionExpand {
    from {
        opacity: 0;
        transform: scaleX(0);
    }
    to {
        opacity: 1;
        transform: scaleX(1);
    }
}

/* ========================================
   Terminal Animations
   ======================================== */
.terminal-cursor {
    animation: terminalCursor 1s step-end infinite;
}

@keyframes terminalCursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.terminal-line-appear {
    animation: terminalLineAppear 0.3s ease;
}

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

/* ========================================
   Panel Animations
   ======================================== */
.panel-slide-up {
    animation: panelSlideUp 0.3s var(--easing-smooth);
}

@keyframes panelSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-slide-down {
    animation: panelSlideDown 0.3s var(--easing-smooth) forwards;
}

@keyframes panelSlideDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* ========================================
   Sidebar Animations
   ======================================== */
.sidebar-expand {
    animation: sidebarExpand 0.3s var(--easing-smooth);
}

@keyframes sidebarExpand {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 260px;
        opacity: 1;
    }
}

.tree-item-expand {
    animation: treeItemExpand 0.25s var(--easing-smooth);
}

@keyframes treeItemExpand {
    from {
        opacity: 0;
        transform: translateY(-5px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 100px;
    }
}

/* ========================================
   Notification Animations
   ======================================== */
.notification-enter {
    animation: notificationEnter 0.4s var(--easing-bounce);
}

@keyframes notificationEnter {
    0% {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.notification-exit {
    animation: notificationExit 0.3s var(--easing-smooth) forwards;
}

@keyframes notificationExit {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }
}

/* ========================================
   Glitch Effect (for errors)
   ======================================== */
.glitch {
    animation: glitch 0.5s ease;
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

/* ========================================
   Code Completion Animation
   ======================================== */
.autocomplete-enter {
    animation: autocompleteEnter 0.2s var(--easing-smooth);
}

@keyframes autocompleteEnter {
    from {
        opacity: 0;
        transform: translateY(-5px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========================================
   Activity Indicator
   ======================================== */
.activity-pulse {
    position: relative;
}

.activity-pulse::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: var(--vscode-success);
    border-radius: 50%;
    animation: activityPulse 2s ease-in-out infinite;
}

@keyframes activityPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }
}

/* ========================================
   Focus Ring Animation
   ======================================== */
.focus-ring {
    position: relative;
}

.focus-ring::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid var(--vscode-accent);
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.focus-ring:focus-within::after {
    opacity: 1;
    animation: focusRing 0.3s ease;
}

@keyframes focusRing {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}
