/* Download Section Styles with Animations and Gradients */

.download-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 30px 0;
}

.download-btn, .episode-btn, .watch-btn {
  position: relative;
  padding: 16px 32px;
  border: none;
  border-radius: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  z-index: 1;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.download-btn {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
  box-shadow: 0 8px 32px 0 rgba(102, 126, 234, 0.37);
}

.episode-btn {
  background: linear-gradient(135deg, rgba(240, 147, 251, 0.9) 0%, rgba(245, 87, 108, 0.9) 100%);
  box-shadow: 0 8px 32px 0 rgba(240, 147, 251, 0.37);
}

.watch-btn {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.9) 0%, rgba(0, 242, 254, 0.9) 100%);
  box-shadow: 0 8px 32px 0 rgba(79, 172, 254, 0.37);
}

/* Animated gradient on hover */
.download-btn::before, .episode-btn::before, .watch-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
  z-index: -1;
}

.download-btn:hover::before, .episode-btn:hover::before, .watch-btn:hover::before {
  left: 100%;
}

.download-btn:hover, .episode-btn:hover, .watch-btn:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 12px 40px 0 rgba(102, 126, 234, 0.5);
  border-color: rgba(255, 255, 255, 0.4);
}

.download-btn:active, .episode-btn:active, .watch-btn:active {
  transform: translateY(-2px) scale(0.98);
}

/* Loading State with Pulse */
.download-btn.loading, .episode-btn.loading, .watch-btn.loading {
  background: linear-gradient(135deg, rgba(255, 94, 77, 0.9) 0%, rgba(245, 147, 49, 0.9) 100%);
  cursor: wait;
  animation: pulse-glow 1.5s ease-in-out infinite;
  box-shadow: 0 8px 32px 0 rgba(255, 94, 77, 0.6);
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 8px 32px 0 rgba(255, 94, 77, 0.6);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 12px 48px 0 rgba(255, 94, 77, 0.8);
    transform: scale(1.03);
  }
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success State */
.download-btn.success, .episode-btn.success, .watch-btn.success {
  background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

/* Error State */
.download-btn.error, .episode-btn.error, .watch-btn.error {
  background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
}

/* Episode Grid Layout */
.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

/* Movie vs Series Detection Badge */
.content-type-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.content-type-badge.movie {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.content-type-badge.series {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

/* Inline Video Player (Not Popup) */
.inline-video-player {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease, margin 0.6s ease, opacity 0.4s ease;
  opacity: 0;
  margin: 0;
  background: #1a1a1a;
  border-radius: 12px;
}

.inline-video-player.active {
  max-height: 800px;
  opacity: 1;
  margin: 20px 0;
}

.inline-player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.inline-player-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.close-inline-player {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 6px;
  transition: background 0.3s ease;
}

.close-inline-player:hover {
  background: rgba(255, 255, 255, 0.3);
}

.inline-player-body {
  padding: 0;
  background: #000;
}

.inline-player-body video {
  width: 100%;
  height: auto;
  max-height: 600px;
  display: block;
}

/* Shrink movie details when player is active */
.movie-detail.player-active .poster-box {
  transform: scale(0.8);
  transition: transform 0.6s ease;
}

.movie-detail.player-active .detail-content {
  transform: scale(0.95);
  transition: transform 0.6s ease;
}

/* Loading animation for inline player */
.inline-player-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  background: #000;
}

/* Keep old overlay for loading state */
.video-player-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.video-player-container {
  width: 90%;
  max-width: 600px;
  background: #1a1a1a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: #2a2a2a;
  border-bottom: 2px solid #667eea;
}

.player-header h3 {
  margin: 0;
  color: white;
  font-size: 1.3rem;
}

.close-player {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s ease;
}

.close-player:hover {
  background: rgba(255, 255, 255, 0.1);
}

.player-body {
  padding: 0;
}

.player-body video {
  width: 100%;
  height: auto;
  max-height: 70vh;
  display: block;
}

/* Responsive */
@media (max-width: 768px) {
  .download-btn, .episode-btn, .watch-btn {
    padding: 14px 24px;
    font-size: 1rem;
  }
  
  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }
  
  .video-player-container {
    width: 95%;
  }
  
  .player-header {
    padding: 15px 20px;
  }
  
  .player-header h3 {
    font-size: 1.1rem;
  }
}
