/* Animations for Piogino Meetup App */

/* CSS Custom Properties for Animation */
:root {
    --animation-fast: 0.15s;
    --animation-normal: 0.3s;
    --animation-slow: 0.5s;
    --animation-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --animation-ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
    --animation-ease-in-out: cubic-bezier(0.645, 0.045, 0.355, 1);
}

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

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

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

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

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

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

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

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

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

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Button Animations */
@keyframes buttonPress {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes buttonHover {
    0% {
        transform: translateY(0);
        box-shadow: var(--shadow-md);
    }
    100% {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }
}

/* Notification Animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

/* Success Animations */
@keyframes checkmark {
    0% {
        stroke-dasharray: 0 50;
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dasharray: 50 0;
        stroke-dashoffset: 0;
    }
}

@keyframes successPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Applied Animation Classes */
.animate-fade-in {
    animation: fadeIn var(--animation-normal) var(--animation-ease-out) forwards;
}

.animate-fade-in-delay {
    animation: fadeIn var(--animation-normal) var(--animation-ease-out) 0.1s forwards;
    opacity: 0;
}

.animate-slide-up {
    animation: slideUp var(--animation-normal) var(--animation-ease-out) forwards;
}

.animate-slide-up-delay {
    animation: slideUp var(--animation-normal) var(--animation-ease-out) 0.2s forwards;
    opacity: 0;
}

.animate-slide-down {
    animation: slideDown var(--animation-normal) var(--animation-ease-out) forwards;
}

.animate-slide-in-left {
    animation: slideInLeft var(--animation-normal) var(--animation-ease-out) forwards;
}

.animate-slide-in-right {
    animation: slideInRight var(--animation-normal) var(--animation-ease-out) forwards;
}

.animate-scale-in {
    animation: scaleIn var(--animation-normal) var(--animation-bounce) forwards;
}

.animate-bounce-in {
    animation: bounceIn var(--animation-slow) var(--animation-bounce) forwards;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Interactive Element Animations */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-accent {
    transition: all var(--animation-fast) var(--animation-ease-out);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-accent:hover {
    animation: buttonHover var(--animation-fast) var(--animation-ease-out) forwards;
}

.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-accent:active {
    animation: buttonPress var(--animation-fast) var(--animation-ease-out);
}

/* Card Animations */
.card-enhanced {
    transition: all var(--animation-normal) var(--animation-ease-out);
}

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

.proposal-card {
    transition: all var(--animation-fast) var(--animation-ease-out);
}

.proposal-card:hover {
    transform: translateY(-1px);
}

/* Notification Animations */
.notification {
    animation: slideInFromRight var(--animation-normal) var(--animation-ease-out) forwards;
}

.notification.hide {
    animation: slideOutToRight var(--animation-normal) var(--animation-ease-out) forwards;
}

.notification.error {
    animation: slideInFromRight var(--animation-normal) var(--animation-ease-out) forwards,
               shake 0.5s ease-in-out 0.3s;
}

.notification.success .checkmark {
    animation: checkmark 0.6s ease-in-out 0.2s forwards;
}

.notification.success {
    animation: slideInFromRight var(--animation-normal) var(--animation-ease-out) forwards,
               successPulse 2s infinite 0.5s;
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, 
        var(--bg-tertiary) 25%, 
        var(--bg-secondary) 50%, 
        var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.loading-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.loading-dots::after {
    content: '';
    animation: loadingDots 1.5s infinite;
}

@keyframes loadingDots {
    0%, 20% {
        content: '.';
    }
    40% {
        content: '..';
    }
    60%, 100% {
        content: '...';
    }
}

/* Form Input Animations */
.input-primary {
    transition: all var(--animation-fast) var(--animation-ease-out);
}

.input-primary:focus {
    transform: scale(1.02);
}

.input-error {
    animation: shake 0.5s ease-in-out;
    border-color: var(--error-color) !important;
}

/* Page Transition Animations */
.page-enter {
    opacity: 0;
    transform: translateX(30px);
}

.page-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all var(--animation-normal) var(--animation-ease-out);
}

.page-exit {
    opacity: 1;
    transform: translateX(0);
}

.page-exit-active {
    opacity: 0;
    transform: translateX(-30px);
    transition: all var(--animation-normal) var(--animation-ease-out);
}

/* Staggered Animations for Lists */
.stagger-fade-in > * {
    opacity: 0;
    animation: fadeIn var(--animation-normal) var(--animation-ease-out) forwards;
}

.stagger-fade-in > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-fade-in > *:nth-child(6) { animation-delay: 0.6s; }

/* Micro-interactions */
.scale-on-hover {
    transition: transform var(--animation-fast) var(--animation-ease-out);
}

.scale-on-hover:hover {
    transform: scale(1.05);
}

.glow-on-hover {
    transition: box-shadow var(--animation-fast) var(--animation-ease-out);
}

.glow-on-hover:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Counter Animations */
@keyframes countUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.count-up {
    animation: countUp var(--animation-fast) var(--animation-ease-out);
}

/* Accessibility: Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .animate-spin {
        animation: none;
    }
    
    .loading-spinner {
        animation: none;
        border: 3px solid var(--primary-color);
    }
    
    .animate-pulse {
        animation: none;
    }
}

/* Print Media: Remove Animations */
@media print {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}