/* ============================================
   FivesModels - Animations & Transitions
   ============================================ */

/* --- Keyframes --- */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

@keyframes fadeInRight {
    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 pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

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

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

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

/* --- Animation Classes (Scroll-triggered) --- */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-in {
    opacity: 0;
    transition: opacity 0.6s ease-out;
}

.animate-fade-in.animated {
    opacity: 1;
}

.animate-fade-up {
    opacity: 0;
    transform: translateY(40px);
    transition: all 0.6s ease-out;
}

.animate-fade-up.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-down {
    opacity: 0;
    transform: translateY(-40px);
    transition: all 0.6s ease-out;
}

.animate-fade-down.animated {
    opacity: 1;
    transform: translateY(0);
}

.animate-fade-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: all 0.6s ease-out;
}

.animate-fade-left.animated {
    opacity: 1;
    transform: translateX(0);
}

.animate-fade-right {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.6s ease-out;
}

.animate-fade-right.animated {
    opacity: 1;
    transform: translateX(0);
}

.animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.6s ease-out;
}

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

/* Stagger animations for children */
.stagger-children > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
}

.stagger-children.animated > *:nth-child(1) { transition-delay: 0s; }
.stagger-children.animated > *:nth-child(2) { transition-delay: 0.1s; }
.stagger-children.animated > *:nth-child(3) { transition-delay: 0.2s; }
.stagger-children.animated > *:nth-child(4) { transition-delay: 0.3s; }
.stagger-children.animated > *:nth-child(5) { transition-delay: 0.4s; }
.stagger-children.animated > *:nth-child(6) { transition-delay: 0.5s; }

.stagger-children.animated > * {
    opacity: 1;
    transform: translateY(0);
}

/* --- Hover Effects --- */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.hover-scale {
    transition: transform var(--transition-base);
}

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

.hover-glow {
    transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
    box-shadow: 0 0 20px rgba(255, 107, 53, 0.3);
}

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

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease-out, height 0.6s ease-out;
}

.btn:active::after {
    width: 200%;
    height: 200%;
}

/* --- Loading States --- */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn.loading {
    color: transparent !important;
}

/* --- Skeleton Loading --- */
.skeleton {
    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;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 2em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-card {
    height: 200px;
}

/* --- Notification Animations --- */
.notification-enter {
    animation: fadeInRight 0.3s ease-out;
}

.notification-exit {
    animation: fadeInRight 0.3s ease-out reverse forwards;
}

/* --- Modal Animations --- */
.modal-backdrop {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
}

.modal-content {
    opacity: 0;
    transform: scale(0.95) translateY(-20px);
    transition: all 0.3s ease;
}

.modal-backdrop.active .modal-content {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* --- Counter Animation --- */
.counter {
    display: inline-block;
}

/* --- Typewriter Effect --- */
.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--accent-primary);
    white-space: nowrap;
    animation:
        typing 3.5s steps(40, end),
        blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--accent-primary); }
}

/* --- Gradient Text Animation --- */
.gradient-text {
    background: linear-gradient(
        90deg,
        var(--accent-primary),
        var(--accent-hover),
        var(--accent-primary)
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shimmer 3s linear infinite;
}

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

.floating-delayed {
    animation: float 3s ease-in-out infinite;
    animation-delay: 1s;
}

/* --- Pulsing Elements --- */
.pulsing {
    animation: pulse 2s ease-in-out infinite;
}

/* --- Focus States --- */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

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

    .animate-on-scroll,
    .animate-fade-in,
    .animate-fade-up,
    .animate-fade-down,
    .animate-fade-left,
    .animate-fade-right,
    .animate-scale {
        opacity: 1;
        transform: none;
    }

    .stagger-children > * {
        opacity: 1;
        transform: none;
    }
}
