/**
 * Live Feeds CSS for whattimeisitin.app
 * Responsive video components with fallbacks and controls
 */

.live-feed-section {
  margin: 0.5rem 0 1.5rem;
  opacity: 1;
  animation: fadeInUp 0.6s ease-out forwards;
}

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

.live-feed-card {
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-width: 680px;
  margin: 0 auto;
}

.live-feed-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.live-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.live-feed-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.live-feed-icon {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  background: var(--accent-glow, rgba(167, 139, 250, 0.15));
  color: var(--accent, #a78bfa);
}

.live-feed-title h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
}

.live-feed-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.live-feed-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.live-feed-status.live {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.live-feed-status.live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: livePulse 2s infinite;
}

.live-feed-status.offline {
  background: rgba(156, 163, 175, 0.1);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.2);
}

.live-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: livePulse 2s infinite;
}

@keyframes livePulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.live-feed-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  font-weight: 600;
}

.live-feed-toggle:hover {
  background: var(--accent, #a78bfa);
  color: #ffffff;
  transform: scale(1.05);
}

.live-feed-toggle.is-off {
  background: var(--bg-card);
  border-color: var(--border);
  color: var(--text-primary);
}

.live-feed-toggle.is-on {
  background: #b91c1c;
  border-color: #991b1b;
  color: #ffffff;
}

.live-feed-toggle.is-on:hover {
  background: #991b1b;
  border-color: #7f1d1d;
  color: #ffffff;
}

.live-feed-toggle:focus-visible,
.play-button:focus-visible,
.live-feed-refresh:focus-visible {
  outline: 2px solid var(--accent, #a78bfa);
  outline-offset: 2px;
}

.live-feed-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  background: var(--bg) !important;
  border-radius: 8px;
  overflow: hidden;
}

.live-feed-iframe-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.live-feed-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none !important;
  background: var(--bg) !important;
  opacity: 0;
  transition: opacity 0.5s ease;
  border-radius: 8px;
}

.live-feed-iframe-wrapper iframe.loaded {
  opacity: 1;
}

/* Force override any YouTube or browser default styling */
.live-feed-iframe-wrapper iframe {
  background-color: var(--bg) !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.live-feed-card .live-feed-container {
  background-color: var(--bg) !important;
  border: none !important;
}

.live-feed-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.live-feed-thumbnail {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.live-feed-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-feed-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.live-feed-thumbnail:hover .live-feed-overlay {
  background: rgba(0, 0, 0, 0.5);
}

.play-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50px;
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.play-button:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.05);
}

.play-icon {
  font-size: 1.5rem;
  color: #1f2937;
}

.play-button span:last-child {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
}

.live-feed-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.9rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

.live-feed-source {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.live-feed-refresh {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.26rem 0.55rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.live-feed-refresh:hover {
  background: var(--accent, #a78bfa);
  color: white;
}

/* Dark mode adjustments - now using theme CSS variables */

/* Responsive design */
@media (max-width: 768px) {
  .live-feed-header {
    padding: 0.75rem 1rem;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
  }
  
  .live-feed-controls {
    width: 100%;
    justify-content: space-between;
  }
  
  .live-feed-title h3 { font-size: 0.93rem; }
  
  .live-feed-footer {
    padding: 0.5rem 0.75rem;
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
  
  .play-button {
    padding: 0.75rem 1.25rem;
  }
  
  .play-icon {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .live-feed-section {
    margin: 0.4rem 0 1.2rem;
  }
  
  .live-feed-header {
    padding: 0.5rem 0.75rem;
  }
  
  .live-feed-footer {
    padding: 0.5rem 0.75rem;
  }
  
  .live-feed-controls {
    gap: 0.5rem;
  }
  
  .live-feed-status { font-size: 0.68rem; padding: 0.2rem 0.45rem; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  .live-feed-card,
  .live-feed-toggle,
  .play-button,
  .live-feed-overlay,
  .live-feed-iframe-wrapper iframe {
    animation: none;
    transition: none;
  }
  
  .live-dot {
    animation: none;
  }
  
  .loading-spinner {
    animation: none;
  }
  
  .fadeInUp {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .live-feed-card {
    border-width: 2px;
  }

  .live-feed-toggle {
    border-width: 2px;
  }
  
  .live-feed-status.live {
    background: #22c55e;
    color: white;
  }
  
  .live-feed-status.offline {
    background: #6b7280;
    color: white;
  }

  .live-feed-toggle.is-on {
    background: #991b1b;
    border-color: #7f1d1d;
    color: white;
  }
}

/* Print styles */
@media print {
  .live-feed-section {
    display: none;
  }
}
