/**
 * Transitions Component Styles
 * Page transition and animation effects
 */

/* Page Transition Container */
.mtune-page-content {
    position: relative;
}

/* Page Enter Animation */
.mtune-page-content.entering {
    animation: pageEnter 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* Page Exit Animation */
.mtune-page-content.exiting {
    animation: pageExit 0.25s ease-in both;
}

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

/* Fade Transitions */
.mtune-fade-enter {
    animation: fadeEnter 0.3s ease both;
}

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

.mtune-fade-exit {
    animation: fadeExit 0.3s ease both;
}

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

/* Scale Transitions */
.mtune-scale-enter {
    animation: scaleEnter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

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

.mtune-scale-exit {
    animation: scaleExit 0.3s ease both;
}

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

/* Slide Up Transitions */
.mtune-slide-up-enter {
    animation: slideUpEnter 0.4s ease-out both;
}

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

.mtune-slide-up-exit {
    animation: slideUpExit 0.3s ease-in both;
}

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

/* Stagger Children Animation */
.mtune-stagger-children > * {
    animation: staggerFadeIn 0.4s ease-out both;
}

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

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

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

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

/* Shake Animation (for errors) */
.mtune-shake {
    animation: shake 0.5s ease-in-out;
}

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

/* Bounce Animation */
.mtune-bounce {
    animation: bounce 0.5s ease-in-out;
}

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

/* Glow Pulse Animation */
.mtune-glow-pulse {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(var(--mtune-primary-rgb), 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(var(--mtune-primary-rgb), 0.6);
    }
}

/* Loading Spinner */
.mtune-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--mtune-glass-border);
    border-top-color: var(--mtune-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Loading Dots */
.mtune-loading-dots {
    display: flex;
    gap: var(--mtune-space-xs);
    align-items: center;
}

.mtune-loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--mtune-primary);
    border-radius: 50%;
    animation: loadingDot 1.2s ease-in-out infinite;
}

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

@keyframes loadingDot {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

.mtune-ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Morphing Background */
.mtune-morphing-bg {
    position: relative;
    overflow: hidden;
}

.mtune-morphing-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(var(--mtune-primary-rgb), 0.1) 0%,
        transparent 50%
    );
    animation: morphingBg 15s ease-in-out infinite;
}

@keyframes morphingBg {
    0%, 100% {
        transform: translate(0, 0);
    }
    25% {
        transform: translate(10%, 10%);
    }
    50% {
        transform: translate(0, 20%);
    }
    75% {
        transform: translate(-10%, 10%);
    }
}

/* Success Check Animation */
.mtune-success-check {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--mtune-success);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: successPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mtune-success-check svg {
    width: 30px;
    height: 30px;
    color: white;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkDraw 0.4s ease-out 0.2s forwards;
}

@keyframes successPop {
    0% {
        transform: scale(0);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes checkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

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

