/**
 * Page Transitions & Animations CSS
 * Smooth transitions, page loads, and micro-interactions
 *
 * Features:
 * - Page load transitions
 * - Route change animations
 * - Hover effects
 * - Button animations
 * - Loading states
 * - Micro-interactions
 */

/* ========================================== */
/* PAGE LOAD TRANSITIONS */
/* ========================================== */

/* Fade in page on load */
body {
    animation: fadeInPage 0.5s ease-in;
}

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

/* Slide in from bottom on load */
.slide-in-bottom {
    animation: slideInBottom 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInBottom {
    0% {
        transform: translateY(50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide in from top */
.slide-in-top {
    animation: slideInTop 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes slideInTop {
    0% {
        transform: translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Slide in from left */
.slide-in-left {
    animation: slideInLeft 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Slide in from right */
.slide-in-right {
    animation: slideInRight 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* ========================================== */
/* SCALE & ZOOM ANIMATIONS */
/* ========================================== */

/* Scale in (grow) */
.scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes scaleIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scale out (shrink) */
.scale-out {
    animation: scaleOut 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes scaleOut {
    0% {
        transform: scale(1.1);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========================================== */
/* HOVER TRANSITIONS */
/* ========================================== */

/* Smooth lift on hover */
.hover-lift {
    transition: transform var(--yk-transition-base), box-shadow var(--yk-transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Grow on hover */
.hover-grow {
    transition: transform var(--yk-transition-base);
}

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

/* Brightness on hover */
.hover-brighten {
    transition: filter var(--yk-transition-base);
}

.hover-brighten:hover {
    filter: brightness(1.1);
}

/* Underline animation */
.hover-underline {
    position: relative;
    display: inline-block;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--yk-primary);
    transition: width var(--yk-transition-base);
}

.hover-underline:hover::after {
    width: 100%;
}

/* Glow effect on hover */
.hover-glow {
    transition: box-shadow var(--yk-transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(3, 191, 203, 0.5);
}

/* ========================================== */
/* BUTTON ANIMATIONS */
/* ========================================== */

/* Button ripple effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-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;
}

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

/* Button press effect */
.btn-press {
    transition: transform 0.1s ease;
}

.btn-press:active {
    transform: scale(0.95);
}

/* Button slide background */
.btn-slide {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
    z-index: -1;
}

.btn-slide:hover::before {
    left: 0;
}

/* ========================================== */
/* LOADING STATES */
/* ========================================== */

/* Spinning loader */
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

/* Bounce loader */
.bounce {
    animation: bounce 1s infinite;
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--yk-gray-200) 25%,
        var(--yk-gray-100) 50%,
        var(--yk-gray-200) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========================================== */
/* SCROLL ANIMATIONS */
/* ========================================== */

/* Fade in on scroll (using Intersection Observer in JS) */
.fade-in-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Slide in from left on scroll */
.slide-in-scroll-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-scroll-left.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Slide in from right on scroll */
.slide-in-scroll-right {
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-scroll-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Scale in on scroll */
.scale-in-scroll {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in-scroll.visible {
    opacity: 1;
    transform: scale(1);
}

/* ========================================== */
/* STAGGERED ANIMATIONS */
/* ========================================== */

/* Stagger animation delays for lists */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

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

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

/* ========================================== */
/* PAGE TRANSITION EFFECTS */
/* ========================================== */

/* Page exit fade */
.page-exit {
    animation: pageExit 0.3s ease-out forwards;
}

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

/* Page enter fade */
.page-enter {
    animation: pageEnter 0.3s ease-in forwards;
}

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

/* ========================================== */
/* MICRO-INTERACTIONS */
/* ========================================== */

/* Shake animation (for errors) */
.shake {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

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

/* Wiggle animation */
.wiggle {
    animation: wiggle 0.5s ease-in-out;
}

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

/* Heartbeat animation */
.heartbeat {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    10%, 30% { transform: scale(0.9); }
    20%, 40% { transform: scale(1.1); }
}

/* Float animation */
.float {
    animation: float 3s ease-in-out infinite;
}

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

/* ========================================== */
/* ALERT/NOTIFICATION ANIMATIONS */
/* ========================================== */

/* Slide down alert */
.alert-slide-down {
    animation: slideDown 0.4s ease-out;
}

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

/* Fade in alert */
.alert-fade-in {
    animation: alertFadeIn 0.4s ease-in;
}

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

/* ========================================== */
/* MODAL TRANSITIONS */
/* ========================================== */

/* Modal backdrop fade */
.modal-backdrop-fade {
    animation: backdropFade 0.3s ease-in;
}

@keyframes backdropFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.5;
    }
}

/* Modal slide in */
.modal-slide-in {
    animation: modalSlideIn 0.3s ease-out;
}

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

/* ========================================== */
/* CUSTOM UTILITIES */
/* ========================================== */

/* Smooth all transitions */
.transition-all {
    transition: all var(--yk-transition-base);
}

/* Transition specific properties */
.transition-transform {
    transition: transform var(--yk-transition-base);
}

.transition-opacity {
    transition: opacity var(--yk-transition-base);
}

.transition-colors {
    transition: background-color var(--yk-transition-base),
                color var(--yk-transition-base),
                border-color var(--yk-transition-base);
}

/* Animation delay utilities */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ========================================== */
/* ACCESSIBILITY - Reduce Motion */
/* ========================================== */

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
