/**
 * =============================================================================
 * KREEDANEX — YouTube Live Styles
 * =============================================================================
 * Reuses the host site's existing design tokens (defined in index.html's
 * :root — --glass, --border, --cyan, --violet, --magenta, --live-red, --text,
 * --muted, --radius, --font-display, --font-body, --transition) so this
 * module inherits dark mode / theme automatically. Fallback values are
 * provided after each var() in case this file is ever used standalone.
 * =============================================================================
 */

#ytLiveContainer {
  width: 100%;
  min-height: 430px;
  border-radius: var(--radius, 16px);
  overflow: hidden;
  position: relative;
}

/* ---------------------------------------------------------------------- */
/*  Shared card shell                                                      */
/* ---------------------------------------------------------------------- */
.yt-card {
  width: 100%;
  min-height: 430px;
  border-radius: var(--radius, 16px);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--glass, rgba(255,255,255,0.05));
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.yt-fade-in { animation: ytFadeScale 0.5s cubic-bezier(0.4,0,0.2,1); }
@keyframes ytFadeScale {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.yt-info { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.yt-title {
  font-family: var(--font-display, sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text, #f1f5f9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.yt-meta-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--muted, #64748b); }
.yt-dot-sep { opacity: 0.6; }
.yt-muted { color: var(--muted, #64748b); }
.yt-eyebrow {
  font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase;
  color: var(--cyan, #00e5ff); font-weight: 600;
}

/* ---------------------------------------------------------------------- */
/*  LIVE state                                                             */
/* ---------------------------------------------------------------------- */
.yt-card-live {
  border-color: rgba(239,68,68,0.3);
  box-shadow: 0 0 40px rgba(239,68,68,0.10);
}

.yt-facade {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface, #0a0d14);
  cursor: none; /* site uses a custom cursor */
}

.yt-thumb {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.05);
}

.yt-play-btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 72px; height: 72px;
  border-radius: 50%;
  border: none;
  background: rgba(239,68,68,0.9);
  color: #fff;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 0 rgba(239,68,68,0.5);
  transition: transform 0.25s ease, box-shadow 0.6s ease, background 0.25s ease;
  animation: ytPulseRing 2.2s ease-out infinite;
}
.yt-play-btn:hover { transform: scale(1.08); background: rgba(239,68,68,1); }
.yt-play-btn:focus-visible { outline: 2px solid var(--cyan, #00e5ff); outline-offset: 4px; }
.yt-play-icon { transform: translateX(2px); }

@keyframes ytPulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
  70%  { box-shadow: 0 0 0 22px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

.yt-live-badge {
  position: absolute;
  top: 14px; left: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(239,68,68,0.4);
  color: #fca5a5;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  backdrop-filter: blur(6px);
}
.yt-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--live-red, #ef4444);
  box-shadow: 0 0 8px var(--live-red, #ef4444);
  animation: ytPulseDot 1.5s ease-in-out infinite;
}
@keyframes ytPulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.8); }
}

.yt-iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
  background: var(--surface, #0a0d14);
}

.yt-viewers-row { color: var(--text, #f1f5f9); font-weight: 600; }
.yt-eye { font-size: 1rem; }

.yt-watch-btn { align-self: flex-start; margin-top: 6px; }

/* ---------------------------------------------------------------------- */
/*  OFFLINE state                                                          */
/* ---------------------------------------------------------------------- */
.yt-card-offline { padding: 20px; gap: 16px; }

.yt-offline-status {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 1px;
  color: var(--muted, #64748b);
}
.yt-offline-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted, #64748b);
}

.yt-offline-body { display: flex; gap: 18px; flex: 1; }
.yt-thumb-link {
  flex: 0 0 45%;
  border-radius: var(--radius-sm, 10px);
  overflow: hidden;
  align-self: flex-start;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  transition: var(--transition, 0.35s ease);
}
.yt-thumb-link:hover { border-color: rgba(0,229,255,0.3); transform: translateY(-2px); }
.yt-thumb-offline { aspect-ratio: 16/9; object-fit: cover; }

.yt-offline-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------------- */
/*  ERROR state                                                            */
/* ---------------------------------------------------------------------- */
.yt-card-error {
  align-items: center; justify-content: center; text-align: center;
  gap: 12px; padding: 40px 24px; color: var(--muted, #64748b);
}
.yt-error-icon { font-size: 1.8rem; }

/* ---------------------------------------------------------------------- */
/*  SKELETON loading                                                       */
/* ---------------------------------------------------------------------- */
.yt-skeleton {
  width: 100%; min-height: 430px;
  border-radius: var(--radius, 16px);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  background: var(--glass, rgba(255,255,255,0.05));
  padding: 0 0 22px;
  overflow: hidden;
}
.yt-skeleton-thumb {
  width: 100%; aspect-ratio: 16/9;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 37%, rgba(255,255,255,0.04) 63%);
  background-size: 400% 100%;
  animation: ytShimmer 1.4s ease infinite;
}
.yt-skeleton-lines { padding: 20px 22px 0; display: flex; flex-direction: column; gap: 12px; }
.yt-skeleton-line {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.09) 37%, rgba(255,255,255,0.04) 63%);
  background-size: 400% 100%;
  animation: ytShimmer 1.4s ease infinite;
}
.yt-skeleton-line.w60 { width: 60%; }
.yt-skeleton-line.w40 { width: 40%; }
.yt-skeleton-line.w30 { width: 30%; }
@keyframes ytShimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---------------------------------------------------------------------- */
/*  Accessibility                                                          */
/* ---------------------------------------------------------------------- */
@media (prefers-contrast: more) {
  .yt-card, .yt-skeleton { border-width: 2px; }
  .yt-live-badge { border-width: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .yt-fade-in, .yt-play-btn, .yt-live-dot, .yt-skeleton-thumb, .yt-skeleton-line {
    animation: none !important;
  }
}

/* ---------------------------------------------------------------------- */
/*  Light-mode support (site is dark-first; this covers a future toggle)  */
/* ---------------------------------------------------------------------- */
@media (prefers-color-scheme: light) {
  .yt-card, .yt-skeleton { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
}

/* ---------------------------------------------------------------------- */
/*  Responsive                                                             */
/* ---------------------------------------------------------------------- */
@media (max-width: 860px) {
  .yt-offline-body { flex-direction: column; }
  .yt-thumb-link { flex: 0 0 auto; width: 100%; }
}
@media (max-width: 560px) {
  .yt-play-btn { width: 58px; height: 58px; font-size: 1.2rem; }
  .yt-title { font-size: 1rem; }
  .yt-live-badge { top: 10px; left: 10px; padding: 5px 10px; font-size: 0.65rem; }
  .yt-card, .yt-skeleton, #ytLiveContainer { min-height: 320px; }
}
