/* === LOADING ANIMATIONS CSS === */

/* Loading Container */
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
}

body[data-theme="light"] .loading-container {
  background: rgba(255, 255, 255, 0.95);
}

body[data-theme="light"] .loading-text,
body[data-theme="light"] .quote-loading {
  color: #1f2937;
}

.loading-container.active {
  opacity: 1;
  visibility: visible;
}

/* Film Reel Spinner */
.film-reel-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  position: relative;
}

.film-reel-spinner svg {
  filter: drop-shadow(0 0 20px var(--accent-color));
}

.reel-circle {
  stroke: var(--accent-color);
  stroke-dasharray: 283;
  stroke-dashoffset: 75;
  animation: spinDash 2s linear infinite;
  stroke-linecap: round;
}

.reel-small-circle {
  animation: spinReel 2s linear infinite;
}

/* Film strip holes */
.film-holes {
  position: absolute;
  width: 100%;
  height: 100%;
  animation: spinReel 2s linear infinite;
}

.film-hole {
  fill: var(--accent-color);
  opacity: 0.8;
}

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

@keyframes spinDash {
  0% { 
    stroke-dashoffset: 283;
    transform: rotate(0deg);
  }
  50% {
    stroke-dashoffset: 75;
    transform: rotate(180deg);
  }
  100% { 
    stroke-dashoffset: 283;
    transform: rotate(360deg);
  }
}

/* Popcorn Loading Bar */
.popcorn-loading-bar {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 40px auto;
}

.popcorn-bar {
  background-color: rgba(255, 255, 255, 0.1);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.popcorn-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, #FFD700, #FFA500, #FFD700);
  background-size: 200% 100%;
  animation: fillProgress 3s ease-out forwards, shimmer 1s linear infinite;
  border-radius: 4px;
  width: 0%;
}

.popcorn-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

.popcorn-particle {
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, #FFFACD 0%, #FFD700 100%);
  border-radius: 50% 50% 50% 10%;
  position: absolute;
  top: -20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  animation: popAnimation 2s ease-out infinite;
}

.popcorn-particle:nth-child(2) {
  animation-delay: 0.3s;
  left: 20%;
}

.popcorn-particle:nth-child(3) {
  animation-delay: 0.6s;
  left: 40%;
}

.popcorn-particle:nth-child(4) {
  animation-delay: 0.9s;
  left: 60%;
}

.popcorn-particle:nth-child(5) {
  animation-delay: 1.2s;
  left: 80%;
}

@keyframes popAnimation {
  0% { 
    transform: translateY(0) rotate(0deg) scale(0);
    opacity: 0;
  }
  20% {
    transform: translateY(-30px) rotate(180deg) scale(1.2);
    opacity: 1;
  }
  50% { 
    transform: translateY(-40px) rotate(360deg) scale(1);
    opacity: 1;
  }
  100% { 
    transform: translateY(20px) rotate(720deg) scale(0.8);
    opacity: 0;
  }
}

/* Share Button Styles */
.share-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  animation: fadeInUp 0.6s ease-out;
}

.share-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--text);
  opacity: 0.8;
}

.share-header i {
  font-size: 1.2rem;
  animation: pulse 2s ease-in-out infinite;
}

.share-header span {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.share-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.75rem;
  max-width: 500px;
  margin: 0 auto;
}

.share-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.25rem;
  border-radius: 12px;
  text-decoration: none;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
}

.share-btn:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.share-btn:hover:before {
  opacity: 1;
}

.share-btn i {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
  transition: transform 0.3s ease;
}

.share-btn:hover i {
  transform: translateY(-3px) scale(1.1);
}

.share-label {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.share-btn:hover .share-label {
  opacity: 1;
}

/* Individual social media colors with gradient backgrounds */
.share-btn.facebook {
  background: linear-gradient(135deg, #1877f2, #0e5eb8);
  box-shadow: 0 4px 15px rgba(24, 119, 242, 0.3);
}

.share-btn.facebook:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(24, 119, 242, 0.4);
}

.share-btn.twitter {
  background: linear-gradient(135deg, #1da1f2, #0d8bd9);
  box-shadow: 0 4px 15px rgba(29, 161, 242, 0.3);
}

.share-btn.twitter:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(29, 161, 242, 0.4);
}

.share-btn.instagram {
  background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4);
  box-shadow: 0 4px 15px rgba(221, 42, 123, 0.3);
}

.share-btn.instagram:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(221, 42, 123, 0.4);
  background: linear-gradient(135deg, #515bd4, #8134af, #dd2a7b, #f58529);
}

.share-btn.whatsapp {
  background: linear-gradient(135deg, #25d366, #128c7e);
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.share-btn.whatsapp:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.share-btn.telegram {
  background: linear-gradient(135deg, #0088cc, #0066aa);
  box-shadow: 0 4px 15px rgba(0, 136, 204, 0.3);
}

.share-btn.telegram:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

.share-btn.reddit {
  background: linear-gradient(135deg, #ff4500, #ff6314);
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
}

.share-btn.reddit:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(255, 69, 0, 0.4);
}

.share-btn.linkedin {
  background: linear-gradient(135deg, #0077b5, #005885);
  box-shadow: 0 4px 15px rgba(0, 119, 181, 0.3);
}

.share-btn.linkedin:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 119, 181, 0.4);
}

.share-btn.pinterest {
  background: linear-gradient(135deg, #bd081c, #8b0615);
  box-shadow: 0 4px 15px rgba(189, 8, 28, 0.3);
}

.share-btn.pinterest:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(189, 8, 28, 0.4);
}

.share-btn.email {
  background: linear-gradient(135deg, #4a5568, #2d3748);
  box-shadow: 0 4px 15px rgba(74, 85, 104, 0.3);
}

.share-btn.email:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(74, 85, 104, 0.4);
}

/* Ripple effect on click */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.share-btn::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}

.share-btn:active::after {
  animation: ripple 0.6s ease-out;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .share-buttons {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
  
  .share-btn {
    padding: 0.75rem 0.25rem;
    border-radius: 12px;
  }
  
  .share-btn i {
    font-size: 1.25rem;
  }
  
  .share-label {
    font-size: 0.65rem;
  }
}

/* Pulse animation for share header icon */
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
}

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

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

/* Movie Quotes */
.quote-loading {
  text-align: center;
  margin-top: 30px;
  color: var(--text-light, #ffffff);
}

.quote {
  font-size: 1.4rem;
  margin-bottom: 15px;
  font-style: italic;
  opacity: 0;
  animation: fadeInOut 4s ease-in-out infinite;
  min-height: 2em;
  font-family: 'Georgia', serif;
  color: var(--accent-color);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent-color);
  text-shadow: 0 0 10px rgba(255, 111, 97, 0.5);
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; transform: translateY(10px); }
  20%, 80% { opacity: 1; transform: translateY(0); }
}

/* Loading text */
.loading-text {
  display: block;
  text-align: center;
  margin-top: 15px;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.loading-text::after {
  content: '...';
  display: inline-block;
  animation: dots 1.5s steps(4) infinite;
  width: 20px;
  text-align: left;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Different loading styles for different actions */
.loading-container.search-loading .film-reel-spinner {
  display: flex;
}

.loading-container.search-loading .popcorn-loading-bar {
  display: none;
}

.loading-container.random-loading .film-reel-spinner {
  display: none;
}

.loading-container.random-loading .popcorn-loading-bar {
  display: block;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .quote {
    font-size: 1.1rem;
  }
  
  .progress {
    font-size: 1.5rem;
  }
  
  .popcorn-loading-bar {
    max-width: 300px;
  }
}

