/* ========================================
   MOVIE WEB APP - ANIMATIONS
   Micro-interactions & Transitions
   ======================================== */

/* ========================================
   FADE IN ANIMATIONS
   ======================================== */
@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 fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease forwards;
}

.fade-in-down {
    animation: fadeInDown 0.5s ease forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.5s ease forwards;
}

.fade-in-right {
    animation: fadeInRight 0.5s ease forwards;
}

.fade-in-scale {
    animation: fadeInScale 0.4s ease forwards;
}

/* Staggered Animation Delays */
.stagger-1 {
    animation-delay: 0.05s;
}

.stagger-2 {
    animation-delay: 0.1s;
}

.stagger-3 {
    animation-delay: 0.15s;
}

.stagger-4 {
    animation-delay: 0.2s;
}

.stagger-5 {
    animation-delay: 0.25s;
}

.stagger-6 {
    animation-delay: 0.3s;
}

.stagger-7 {
    animation-delay: 0.35s;
}

.stagger-8 {
    animation-delay: 0.4s;
}

/* Initially hidden for scroll animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   PULSE & GLOW EFFECTS
   ======================================== */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(224, 64, 112, 0.3);
    }

    50% {
        box-shadow: 0 0 40px rgba(224, 64, 112, 0.5);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* ========================================
   BUTTON ANIMATIONS
   ======================================== */
.btn-animated {
    position: relative;
    overflow: hidden;
}

.btn-animated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-animated:active::before {
    width: 300px;
    height: 300px;
}

/* Ripple Effect */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple-effect {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* ========================================
   CARD HOVER EFFECTS
   ======================================== */
.card-hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-lift:hover {
    transform: translateY(-8px);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        0 0 60px rgba(224, 64, 112, 0.15);
}

.card-hover-glow {
    transition: box-shadow 0.3s ease;
}

.card-hover-glow:hover {
    box-shadow:
        0 0 0 1px rgba(224, 64, 112, 0.3),
        0 0 40px rgba(224, 64, 112, 0.2);
}

.card-hover-border {
    position: relative;
}

.card-hover-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-hover-border:hover::before {
    opacity: 1;
}

/* ========================================
   IMAGE EFFECTS
   ======================================== */
.img-zoom {
    overflow: hidden;
}

.img-zoom img {
    transition: transform 0.5s ease;
}

.img-zoom:hover img {
    transform: scale(1.1);
}

.img-blur-in {
    filter: blur(20px);
    transition: filter 0.5s ease;
}

.img-blur-in.loaded {
    filter: blur(0);
}

/* Ken Burns Effect for Hero */
@keyframes kenBurns {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

.ken-burns img {
    animation: kenBurns 20s ease-in-out alternate infinite;
}

/* ========================================
   LOADING ANIMATIONS
   ======================================== */
@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

/* Progress Bar */
@keyframes progress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

.progress-bar {
    height: 3px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    animation: progress 2s ease-in-out infinite;
}

/* ========================================
   SCROLL INDICATOR
   ======================================== */
@keyframes scrollDown {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(10px);
    }
}

.scroll-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.scroll-indicator-mouse {
    width: 24px;
    height: 40px;
    border: 2px solid var(--text-secondary);
    border-radius: 12px;
    position: relative;
}

.scroll-indicator-wheel {
    width: 4px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollDown 1.5s ease-in-out infinite;
}

/* ========================================
   MODAL ANIMATIONS
   ======================================== */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-backdrop {
    animation: modalFadeIn 0.3s ease;
}

.modal-content {
    animation: modalSlideIn 0.4s ease;
}

/* ========================================
   HERO SLIDER TRANSITIONS
   ======================================== */
.hero-slide {
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
}

.hero-slide.active {
    opacity: 1;
}

.hero-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease 0.3s, transform 0.6s ease 0.3s;
}

.hero-slide.active .hero-content {
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   GENRE PILL ANIMATIONS
   ======================================== */
.filter-chip {
    transition: all 0.2s ease;
}

.filter-chip:active {
    transform: scale(0.95);
}

.filter-chip.active {
    animation: fadeInScale 0.2s ease;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast {
    animation: slideInRight 0.3s ease;
}

.toast.closing {
    animation: slideOutRight 0.3s ease forwards;
}

/* ========================================
   RATING CIRCLE ANIMATION
   ======================================== */
@keyframes ratingFill {
    from {
        stroke-dashoffset: 100;
    }
}

.rating-circle {
    transform: rotate(-90deg);
}

.rating-circle-fill {
    animation: ratingFill 1s ease forwards;
}

/* ========================================
   TYPEWRITER EFFECT
   ======================================== */
@keyframes typewriter {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {
    50% {
        border-color: transparent;
    }
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--text-primary);
    animation:
        typewriter 3s steps(40) 1s forwards,
        blink 0.75s step-end infinite;
}

/* ========================================
   PARALLAX EFFECT
   ======================================== */
.parallax {
    transform: translateZ(0);
    will-change: transform;
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .ken-burns img {
        animation: none;
    }

    .hero-slide {
        transition-duration: 0.01ms;
    }
}