/**
 * Premium Page Transitions and Animations
 * Smooth, professional transitions for page elements
 */

/* Page Load Fade-in */
body {
    animation: pageLoadFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Smooth transitions for all interactive elements */
a, button, input, textarea, select {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card hover effects */
.card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

/* List item animations */
.list-item {
    animation: listItemSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.list-item:nth-child(1) { animation-delay: 0.05s; }
.list-item:nth-child(2) { animation-delay: 0.1s; }
.list-item:nth-child(3) { animation-delay: 0.15s; }
.list-item:nth-child(4) { animation-delay: 0.2s; }
.list-item:nth-child(5) { animation-delay: 0.25s; }
.list-item:nth-child(6) { animation-delay: 0.3s; }
.list-item:nth-child(7) { animation-delay: 0.35s; }
.list-item:nth-child(8) { animation-delay: 0.4s; }

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

/* Modal/Dialog animations */
.modal-overlay {
    animation: modalOverlayFadeIn 0.2s ease-out;
}

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

.modal-content {
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(32px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Dropdown menu animations */
.dropdown-menu {
    animation: dropdownSlideDown 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top center;
}

@keyframes dropdownSlideDown {
    from {
        opacity: 0;
        transform: translateY(-8px) scaleY(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scaleY(1);
    }
}

/* Button click animation */
button:active:not(:disabled) {
    transform: scale(0.97);
}

/* Input focus glow */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
    border-color: var(--accent-primary, #C41E3A);
}

/* Fade transitions for showing/hiding elements */
.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.fade-exit {
    opacity: 1;
}

.fade-exit-active {
    opacity: 0;
    transition: opacity 0.2s ease-in;
}

/* Slide transitions */
.slide-left-enter {
    transform: translateX(100%);
    opacity: 0;
}

.slide-left-enter-active {
    transform: translateX(0);
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease-out;
}

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

.slide-left-exit-active {
    transform: translateX(-100%);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease-in;
}

/* Scale transitions */
.scale-enter {
    transform: scale(0.9);
    opacity: 0;
}

.scale-enter-active {
    transform: scale(1);
    opacity: 1;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease-out;
}

.scale-exit {
    transform: scale(1);
    opacity: 1;
}

.scale-exit-active {
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease-in;
}

/* Stagger animation utility */
.stagger-container > * {
    animation: staggerFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.stagger-container > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-container > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-container > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-container > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-container > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-container > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-container > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-container > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-container > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-container > *:nth-child(10) { animation-delay: 0.5s; }

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

/* Loading bar animation (top of page) */
.loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--accent-primary, #C41E3A),
        transparent
    );
    animation: loadingBarSlide 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    z-index: 10001;
}

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

/* Pulse animation for notifications */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Bounce animation for attention */
.bounce {
    animation: bounce 1s ease-in-out infinite;
}

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

/* Shake animation for errors */
.shake {
    animation: shake 0.5s cubic-bezier(0.4, 0, 0.6, 1);
}

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Page transition container */
.page-transition {
    animation: pageTransitionFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* 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;
        scroll-behavior: auto !important;
    }
}

/* Skeleton shimmer (works with skeleton.css) */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to {
        left: 100%;
    }
}

/* Ripple effect for buttons */
.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.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

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

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--accent-primary, #C41E3A);
    outline-offset: 2px;
}

/* Smooth height transitions */
.height-transition {
    transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Content reveal animation */
.reveal {
    animation: reveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes reveal {
    from {
        opacity: 0;
        clip-path: inset(0 100% 0 0);
    }
    to {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

/* Flip animation */
.flip {
    animation: flip 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes flip {
    0% {
        transform: perspective(400px) rotateY(0);
    }
    100% {
        transform: perspective(400px) rotateY(180deg);
    }
}

/* Zoom in animation */
.zoom-in {
    animation: zoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Rotate animation */
.rotate {
    animation: rotate 1s linear infinite;
}

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

/* Progress bar fill animation */
.progress-bar-fill {
    animation: progressFill 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes progressFill {
    from {
        width: 0%;
    }
}

/* Gradient animation */
.gradient-animation {
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}
