﻿/* ─────────────────────────────────────────────────────────────
   ANI-STREAM Player Styles
   ───────────────────────────────────────────────────────────── */

/* HTML5 [hidden] attribute override — yazar CSS rule'ları display:flex
   ile [hidden]'i geçersiz kılıyordu (segments.js next-card her zaman
   görünür kalıyordu). [hidden] her durumda gizler. */
.ar-player-wrap [hidden],
.ar-next-card[hidden],
.ar-skip-btn[hidden] {
  display: none !important;
}

/* Kaynak yok / hata mesajı — siyah ekran üstüne ortalanmış overlay */
.ar-player-status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-family: 'Inter', system-ui, sans-serif;
  z-index: 5;
  pointer-events: none;
}
.ar-player-status__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(232, 0, 61, 0.12);
  display: grid;
  place-items: center;
  color: #ff4466;
  font-size: 22px;
}
.ar-player-status__title {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.ar-player-status__sub {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.5);
  max-width: 380px;
  line-height: 1.5;
}

.ar-player-wrap {
  position: relative;
  width: 100%;
  max-width: var(--container-max, 1280px);
  margin: 0 auto;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  transition: box-shadow 0.6s ease;
}
.ar-player-wrap:fullscreen { border-radius: 0; max-width: none; }

.ar-video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ─── Skip Button ─────────────────────────────────────────── */
.ar-skip-btn {
  position: absolute;
  bottom: 80px; right: 24px;
  padding: 12px 22px;
  background: rgba(232, 0, 61, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  z-index: 12;
  box-shadow: 0 8px 24px rgba(232, 0, 61, 0.35);
}
.ar-skip-btn.is-visible { opacity: 1; transform: translateY(0); }
.ar-skip-btn:hover { background: #ff2055; }

/* ─── Next Episode Card ───────────────────────────────────── */
.ar-next-card {
  position: absolute;
  bottom: 88px; right: 24px;
  display: flex;
  gap: 14px;
  width: 360px;
  padding: 14px;
  background: rgba(13, 13, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: white;
  z-index: 11;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: ar-fade-up 0.4s ease-out;
}
.ar-next-card__poster {
  flex: 0 0 96px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  background: #222;
}
.ar-next-card__poster img { width: 100%; height: 100%; object-fit: cover; }
.ar-next-card__body { flex: 1; min-width: 0; }
.ar-next-card__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255, 100, 130, 0.85);
  margin-bottom: 4px;
}
.ar-next-card__title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 6px;
}
.ar-next-card__countdown {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}
.ar-next-card__cd { color: var(--accent, #ff4466); font-weight: 700; font-variant-numeric: tabular-nums; }
.ar-next-card__actions { display: flex; gap: 8px; }
.ar-next-card__go,
.ar-next-card__cancel {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: 0;
  font-family: inherit;
}
.ar-next-card__go {
  background: var(--accent, #e8003d);
  color: white;
}
.ar-next-card__go:hover { background: #c5002f; }
.ar-next-card__cancel {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.ar-next-card__cancel:hover { background: rgba(255, 255, 255, 0.14); }

/* ─── Progress segments overlay ───────────────────────────── */
.ar-progress { position: relative; height: 6px; }
.ar-segments-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ar-segments-overlay > span {
  position: absolute;
  top: 0; bottom: 0;
  opacity: 0.55;
  border-radius: 2px;
}
.ar-seg-intro  { background: linear-gradient(90deg, #ff4466, #c5002f); }
.ar-seg-recap  { background: linear-gradient(90deg, #f59e0b, #d97706); }
.ar-seg-ending { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }
.ar-chapter-marker {
  width: 2px !important;   /* override */
  background: rgba(255, 255, 255, 0.6);
}

/* ─── Settings Panel ──────────────────────────────────────── */
.ar-settings-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  max-width: 100%;
  background: rgba(13, 13, 20, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  z-index: 30;
  overflow-y: auto;
  animation: ar-slide-in 0.3s ease-out;
}
.ar-settings__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ar-settings__head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.ar-settings__close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-size: 18px;
  font-family: inherit;
}
.ar-settings__close:hover { background: rgba(255, 255, 255, 0.12); color: white; }
.ar-settings__body { padding: 20px 24px; }
.ar-settings__sec {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ar-settings__sec:last-child { border-bottom: 0; }
.ar-settings__sec h4 {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  margin: 0 0 14px;
}
.ar-settings__sec label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 10px;
  gap: 12px;
}
.ar-settings__sec select,
.ar-settings__sec input[type="text"],
.ar-settings__sec input[type="number"] {
  flex: 0 0 130px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
}
.ar-settings__sec input[type="checkbox"] {
  width: 38px; height: 22px;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}
.ar-settings__sec input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
}
.ar-settings__sec input[type="checkbox"]:checked {
  background: var(--accent, #e8003d);
}
.ar-settings__sec input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

/* ─── P2P/HLS Status Bar ──────────────────────────────────── */
.ar-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  max-width: var(--container-max, 1280px);
  margin: 14px auto 0;
  padding: 10px 18px;
  background: rgba(13, 13, 20, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ar-status-bar__source {
  font-weight: 700;
  color: rgba(255, 100, 130, 0.9);
}
.ar-status-bar.source-hls .ar-status-bar__source { color: rgba(130, 200, 255, 0.9); }
.ar-status-bar.source-direct .ar-status-bar__source { color: rgba(255, 215, 130, 0.9); }
.ar-status-bar.source-hls .ar-status-bar__ul    { display: none; }
.ar-status-bar.source-hls .ar-status-bar__peers { display: none; }
.ar-status-bar__toggle {
  margin-left: auto;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.75);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
}
.ar-status-bar__toggle:hover { background: rgba(255, 255, 255, 0.12); }
.ar-status-bar__detail {
  flex-basis: 100%;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 18px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}
.ar-status-bar__detail code {
  color: rgba(255, 255, 255, 0.85);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── Settings range slider value label ───────────────────── */
.ar-settings__val {
  flex: 0 0 50px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.ar-settings__sec input[type="range"] {
  flex: 1;
  margin: 0 8px;
  accent-color: var(--accent, #e8003d);
}
.ar-settings__sec input[type="color"] {
  width: 50px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  cursor: pointer;
}
.ar-settings__sec input[type="text"] {
  flex: 0 0 130px;
}

/* ─── Animations ──────────────────────────────────────────── */
@keyframes ar-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes ar-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 720px) {
  .ar-skip-btn { bottom: 70px; right: 12px; padding: 10px 18px; font-size: 13px; }
  .ar-next-card { width: calc(100% - 24px); bottom: 78px; right: 12px; }
  .ar-settings-panel { width: 100%; }
}

/* ═════════════════════════════════════════════════════════════════
   FULLSCREEN HOTFIX v2 — element-agnostik
   ─────────────────────────────────────────────────────────────────
   v1 problemi: `.plyr` element'inin fullscreen olduğunu varsayıyordu;
   gerçekte #ar-player wrapper'ı (aspect-ratio: 16/9 inline'lı)
   fullscreen oluyor → kurallar yanlış selektörü hedef alıyor.
   v2: HANGİ element fullscreen olursa olsun universal selektör.
   ═════════════════════════════════════════════════════════════════ */

/* HANGİ element fullscreen olursa olsun, ekrana sığ */
:fullscreen,
:-webkit-full-screen,
:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  min-width: 100vw !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  background: #000 !important;
  box-sizing: border-box !important;
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

/* Fullscreen olan elementin İÇİNDEKİ tüm wrapper'lar genişlesin */
:fullscreen .plyr,
:fullscreen .plyr__video-wrapper,
:fullscreen .ar-player-wrap,
:-webkit-full-screen .plyr,
:-webkit-full-screen .plyr__video-wrapper,
:-webkit-full-screen .ar-player-wrap,
:-moz-full-screen .plyr,
:-moz-full-screen .plyr__video-wrapper,
:-moz-full-screen .ar-player-wrap {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding: 0 !important;
  padding-bottom: 0 !important;     /* Plyr 56.25% hack ÖLDÜR */
  margin: 0 !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  position: relative !important;
}

/* Video element (toggle class varyantları dahil) */
:fullscreen video,
:-webkit-full-screen video,
:-moz-full-screen video,
.plyr--fullscreen-active video,
.plyr--fullscreen-fallback video {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  position: absolute !important;
  inset: 0 !important;
}

/* #ar-player wrapper'ı için ÖZEL — inline aspect-ratio override */
#ar-player:fullscreen,
#ar-player:-webkit-full-screen,
#ar-player:-moz-full-screen {
  aspect-ratio: auto !important;
  border-radius: 0 !important;
}

/* Plyr fallback class'ları (browser fullscreen API yoksa) */
.plyr--fullscreen-active,
.plyr--fullscreen-fallback {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-width: 100vw !important;
  max-height: 100vh !important;
  z-index: 999999 !important;
  background: #000 !important;
}

.plyr--fullscreen-active .plyr__video-wrapper,
.plyr--fullscreen-fallback .plyr__video-wrapper {
  width: 100% !important;
  height: 100% !important;
  padding-bottom: 0 !important;
  aspect-ratio: auto !important;
}

/* Kontrol bar — her durumda altta */
:fullscreen .plyr__controls,
:-webkit-full-screen .plyr__controls,
:-moz-full-screen .plyr__controls,
.plyr--fullscreen-active .plyr__controls,
.plyr--fullscreen-fallback .plyr__controls {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  background: linear-gradient(transparent, rgba(0,0,0,0.85)) !important;
  padding: 20px 16px env(safe-area-inset-bottom, 12px) !important;
  z-index: 10 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   FULLSCREEN PARENT CHAIN HOTFIX — Plyr üst kapsayıcı zinciri (1280px kilidi)
   Normal mod: .ar-player-wrap max-width:1280px + aspect-ratio 16/9 korunur.
   Sadece tam ekran / plyr--fullscreen-active altında geçerli.
   ═══════════════════════════════════════════════════════════════════ */

/* Tam ekran modunda en dış section'dan en iç video elementine kadar tüm zinciri genişlet */
.plyr:fullscreen #ar-player,
.plyr:fullscreen .ar-player-wrap,
.plyr--fullscreen-active #ar-player,
.plyr--fullscreen-active .ar-player-wrap,
:-webkit-full-screen #ar-player,
:-webkit-full-screen .ar-player-wrap,
:-moz-full-screen #ar-player,
:-moz-full-screen .ar-player-wrap,
:fullscreen #ar-player,
:fullscreen .ar-player-wrap,
#ar-player:fullscreen,
#ar-player:-webkit-full-screen,
#ar-player:-moz-full-screen,
.ar-player-wrap:fullscreen,
.ar-player-wrap:-webkit-full-screen,
.ar-player-wrap:-moz-full-screen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    aspect-ratio: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
}

/* Plyr içindeki video kutusunun ve wrapper'ın tüm ekranı kaplaması */
.plyr:fullscreen .plyr__video-wrapper,
.plyr--fullscreen-active .plyr__video-wrapper,
.plyr:fullscreen video,
.plyr--fullscreen-active video {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain !important; /* Videonun orijinal oranını bozmadan ekrana tam oturt */
    aspect-ratio: auto !important;
}

/* Tam ekrandayken kontrol çubuğunun ekranın en alt sınırına milimetrik çakılması */
.plyr:fullscreen .plyr__controls,
.plyr--fullscreen-active .plyr__controls {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 2147483647 !important; /* Her şeyin en üstünde kalsın */
    background: linear-gradient(transparent, rgba(0,0,0,0.9)) !important;
}

/* Plyr fallback: .plyr--fullscreen-active çocukta — üst #ar-player / .ar-player-wrap için :has() */
#ar-player:has(> .plyr.plyr--fullscreen-active),
.ar-player-wrap:has(> .plyr.plyr--fullscreen-active),
.video-player-section:has(.plyr--fullscreen-active) {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    aspect-ratio: auto !important;
    padding: 0 !important;
    margin: 0 !important;
}
/* ═══ FULLSCREEN v3 — Plyr container (.video-player-section) zinciri ═══ */
.video-player-section:fullscreen,
.video-player-section:-webkit-full-screen,
.video-player-section:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  background: #000 !important;
}

.video-player-section:fullscreen #ar-player,
.video-player-section:fullscreen .ar-player-wrap,
.video-player-section:-webkit-full-screen #ar-player,
.video-player-section:-webkit-full-screen .ar-player-wrap,
.video-player-section:-moz-full-screen #ar-player,
.video-player-section:-moz-full-screen .ar-player-wrap {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

.video-player-section:fullscreen .plyr,
.video-player-section:fullscreen .plyr__video-wrapper,
.video-player-section:-webkit-full-screen .plyr,
.video-player-section:-webkit-full-screen .plyr__video-wrapper,
.plyr.plyr--fullscreen-active,
.plyr.plyr--fullscreen-active .plyr__video-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding-bottom: 0 !important;
  aspect-ratio: auto !important;
}

.video-player-section:fullscreen video,
.video-player-section:-webkit-full-screen video,
.video-player-section:-moz-full-screen video,
.plyr.plyr--fullscreen-active video {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  position: absolute !important;
  inset: 0 !important;
}

.video-player-section:fullscreen .plyr__controls,
.video-player-section:-webkit-full-screen .plyr__controls,
.plyr.plyr--fullscreen-active .plyr__controls {
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 2147483647 !important;
  background: linear-gradient(transparent, rgba(0,0,0,0.9)) !important;
}
/* FULLSCREEN v4 — #ar-player .plyr (1,1,0) üzerinde kazanır: section+fullscreen+#ar-player */
section.video-player-section:fullscreen > #ar-player.ar-player-wrap,
section.video-player-section:-webkit-full-screen > #ar-player.ar-player-wrap,
section.video-player-section:-moz-full-screen > #ar-player.ar-player-wrap {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}

section.video-player-section:fullscreen #ar-player .plyr,
section.video-player-section:fullscreen #ar-player .plyr__video-wrapper,
section.video-player-section:-webkit-full-screen #ar-player .plyr,
section.video-player-section:-webkit-full-screen #ar-player .plyr__video-wrapper,
section.video-player-section:-moz-full-screen #ar-player .plyr,
section.video-player-section:-moz-full-screen #ar-player .plyr__video-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding-bottom: 0 !important;
  aspect-ratio: auto !important;
  position: relative !important;
}

section.video-player-section:fullscreen #ar-player video,
section.video-player-section:-webkit-full-screen #ar-player video,
section.video-player-section:-moz-full-screen #ar-player video {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
}

/* Native fullscreen — body class (JS); theater ile aynı özgüllük */
body.ar-native-fs .video-player-section {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  background: #000 !important;
}
body.ar-native-fs #ar-player.ar-player-wrap {
  flex: 1 1 auto !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  margin: 0 !important;
  border-radius: 0 !important;
  overflow: hidden !important;
}
body.ar-native-fs #ar-player .plyr,
body.ar-native-fs #ar-player .plyr__video-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  padding-bottom: 0 !important;
  aspect-ratio: auto !important;
}
body.ar-native-fs #ar-player video {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
}
