/* ============================================================
   CineStream — Animations & Micro-interactions
   ============================================================ */

/* ── Keyframe Definitions ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-in-right {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slide-in-left {
  from { opacity: 0; transform: translateX(-40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(229, 9, 20, 0.3); }
  50% { box-shadow: 0 0 40px rgba(229, 9, 20, 0.6), 0 0 80px rgba(229, 9, 20, 0.2); }
}

@keyframes pulse-blue {
  0%, 100% { box-shadow: 0 0 20px rgba(20, 209, 255, 0.2); }
  50% { box-shadow: 0 0 40px rgba(20, 209, 255, 0.5), 0 0 80px rgba(20, 209, 255, 0.1); }
}

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

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

@keyframes hero-zoom {
  from { transform: scale(1.05); }
  to { transform: scale(1); }
}

@keyframes logo-appear {
  0% { opacity: 0; transform: scale(0.8) translateY(-10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

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

@keyframes carousel-slide-in {
  from { opacity: 0; transform: scale(1.04); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes progress-stripe {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

/* ── Animation Classes ── */
.animate-fade-up {
  animation: fade-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.animate-fade-in {
  animation: fade-in 0.4s ease both;
}

.animate-slide-right {
  animation: slide-in-right 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.animate-scale-in {
  animation: scale-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-logo {
  animation: logo-appear 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Delay Utilities ── */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-600 { animation-delay: 600ms; }
.delay-800 { animation-delay: 800ms; }

/* ── Hero Image Animation ── */
.hero-backdrop img {
  animation: hero-zoom 8s ease-out both;
}

/* ── Shimmer (Button loading state) ── */
.btn-shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  animation: shimmer 1.5s infinite;
}

/* ── Pulsing Glow on Primary CTA ── */
.pulse-red {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

.pulse-blue {
  animation: pulse-blue 2.5s ease-in-out infinite;
}

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

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

/* ── Card Hover Glow ── */
.poster-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.4s ease;
  background: linear-gradient(
    135deg,
    rgba(20, 209, 255, 0.06) 0%,
    transparent 50%
  );
  pointer-events: none;
}

.poster-card:hover::after {
  opacity: 1;
}

/* ── Gradient Text Animation ── */
.gradient-text-animated {
  background: linear-gradient(90deg, #e50914, #ff6b6b, #14d1ff, #a6e6ff, #e50914);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 4s ease infinite;
}

/* ── Video Player Controls Animation ── */
.player-controls {
  transition: opacity 0.4s ease, transform 0.3s ease;
}

.player-controls.hidden {
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

/* ── Carousel Transitions ── */
.carousel-slide {
  animation: carousel-slide-in 0.6s ease both;
}

/* ── Input focus ring animation ── */
.input-field:focus {
  animation: pulse-blue 2s ease-in-out;
}

/* ── Page entrance animations ── */
.section { opacity: 0; }
.section.visible {
  animation: fade-up 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
  opacity: 1;
}

/* ── Notification dot ── */
.notif-dot {
  width: 8px;
  height: 8px;
  background: var(--c-primary-container);
  border-radius: 50%;
  border: 2px solid var(--c-background);
  animation: pulse-glow 2s ease-in-out infinite;
}

/* ── Loading bar at top ── */
.top-loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-primary-container), var(--c-secondary-container));
  z-index: 9999;
  transition: width 0.3s ease;
}

/* ── Gift code success animation ── */
@keyframes success-pop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.success-icon-anim {
  animation: success-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Subscription plan glow ── */
.plan-card.featured {
  animation: pulse-glow 3s ease-in-out infinite;
}

.plan-card.featured:hover {
  animation: none;
}
