/**
 * Timeline Animation Styles
 * 
 * Performance-optimized animations for the process timeline visualization.
 * Uses CSS transforms and opacity for GPU-accelerated animations.
 * 
 * Requirements: 4.5
 */

/* Loading State Animations */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

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

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

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

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

@keyframes pulse-subtle {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* Loading Skeleton */
.timeline-loading {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(
        to right,
        #f0f0f0 0%,
        #e0e0e0 20%,
        #f0f0f0 40%,
        #f0f0f0 100%
    );
    background-size: 1000px 100%;
    border-radius: 8px;
}

.timeline-skeleton-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.timeline-skeleton-line {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.timeline-skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

/* Fade-in animations for timeline elements */
.timeline-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.phase-card {
    animation: fadeIn 0.6s ease-out forwards;
    animation-delay: calc(var(--phase-index, 0) * 0.1s);
}

/* Stagger animation for phase cards */
.phase-card:nth-child(1) { animation-delay: 0.1s; }
.phase-card:nth-child(2) { animation-delay: 0.2s; }
.phase-card:nth-child(3) { animation-delay: 0.3s; }
.phase-card:nth-child(4) { animation-delay: 0.4s; }
.phase-card:nth-child(5) { animation-delay: 0.5s; }
.phase-card:nth-child(6) { animation-delay: 0.6s; }

/* Smooth transitions for interactive elements */
.phase-card,
.phase-content,
.phase-status-circle,
.admin-stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effects with GPU acceleration */
.phase-card:hover {
    transform: translateY(-4px);
}

.phase-status-circle:hover {
    transform: scale(1.1) rotate(5deg);
}

.admin-stat-card:hover {
    transform: translateY(-2px);
}

/* Active phase pulse animation */
.phase-card[data-status="active"] .phase-status-circle {
    animation: pulse-subtle 2s ease-in-out infinite;
}

/* Urgent phase attention animation */
@keyframes attention-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
    }
}

.phase-card[data-status="urgent"] .phase-status-circle {
    animation: attention-pulse 2s ease-in-out infinite;
}

/* Smooth color transitions */
.phase-card[data-status="active"],
.phase-card[data-status="urgent"],
.phase-card[data-status="completed"] {
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.timeline-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: rgb(59, 130, 246);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .phase-card:hover,
    .phase-status-circle:hover,
    .admin-stat-card:hover {
        transform: none;
    }
}

/* Performance optimization: will-change for animated elements */
.phase-card,
.phase-status-circle,
.admin-stat-card {
    will-change: transform;
}

/* Remove will-change after animation completes */
.phase-card.animation-complete,
.phase-status-circle.animation-complete,
.admin-stat-card.animation-complete {
    will-change: auto;
}

/* Smooth scroll behavior */
.process-timeline-container {
    scroll-behavior: smooth;
}

/* Focus styles for keyboard navigation */
.phase-card:focus-within {
    outline: 2px solid rgb(59, 130, 246);
    outline-offset: 4px;
    border-radius: 8px;
}

/* Button hover animations */
.phase-action-button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.phase-action-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.phase-action-button:active:not(:disabled) {
    transform: translateY(0);
}

/* Admin panel slide-in animation */
.admin-panel {
    animation: slideInFromLeft 0.6s ease-out forwards;
}

/* Contact info fade-in */
.contact-info {
    animation: fadeIn 0.8s ease-out 0.7s forwards;
    opacity: 0;
}

/* Gradient animation for active elements */
@keyframes gradient-shift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.gradient-animated {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}
