/* Canlı TV: kanal tarayıcı (başlık, kategori çipleri, kanal ızgarası) ve izleme eklentileri.
   Yalnız theme.css tokenları; gölge, gradyan ve parlama yok (DESIGN.md Yasaklar). */

/* Kanal tarayıcı başlığı */
.tv-head {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
  gap: 12px 18px;
  margin-bottom: 12px;
}
.tv-title { margin: 0; flex: none; white-space: nowrap; }
.tv-count {
  color: var(--metin-ikincil);
  font-family: var(--font-sayi);
  font-size: calc(13px * var(--fs, 1));
  font-variant-numeric: tabular-nums;
}
.tv-count { flex: none; white-space: nowrap; }
.tv-lang { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 10px; min-width: 0; margin-left: auto; }
.tv-lang-text { color: var(--metin-ikincil); font-size: calc(12px * var(--fs, 1)); white-space: nowrap; }
.tv-select,
.tv-filter {
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid var(--sinir);
  border-radius: var(--radius-alan);
  background: var(--yuzey);
  color: var(--metin);
  font-size: calc(14px * var(--fs, 1));
}
.tv-select { min-width: 0; width: 160px; max-width: 100%; }
.tv-select:disabled { color: var(--metin-ikincil); }
.tv-filter { flex: 0 1 260px; width: 260px; min-width: 0; max-width: 100%; font-family: var(--font-sayi); }
.tv-filter::placeholder { color: var(--metin-ikincil); }
.tv-filter:focus { outline: 2px solid var(--ikincil); outline-offset: 0; }

/* Kategori çipleri: tek satır, dokunmayla yatay kaydırma */
.tv-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tv-chips::-webkit-scrollbar { display: none; }
.tv-chip {
  flex: none;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--sinir);
  border-radius: var(--radius-buton);
  background: transparent;
  color: var(--metin);
  font-weight: 500;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.tv-chip.is-active { background: var(--vurgu); border-color: var(--vurgu); color: var(--vurgu-metin); }

/* Kanal ızgarası */
.tv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.tv-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 10px 12px;
  border: 1px solid var(--sinir);
  border-radius: var(--radius-kart);
  background: var(--yuzey);
  box-shadow: var(--golge-kart);
  text-align: left;
  min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}
.tv-card:active { border-color: var(--vurgu); }
.tv-card-name {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 500;
  font-size: calc(12px * var(--fs, 1));
  line-height: 1.3;
}
.tv-card-cat {
  color: var(--metin-ikincil);
  font-size: calc(12px * var(--fs, 1));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Logo kutusu: nötr zemin, sığdırılmış görsel; görsel yoksa baş harfler */
.tv-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-kart);
  background: var(--sinir);
  overflow: hidden;
}
.tv-logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.tv-logo.is-text {
  color: var(--metin-ikincil);
  font-family: var(--font-sayi);
  font-size: calc(22px * var(--fs, 1));
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Durum mesajı */
.tv-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 20px;
  text-align: center;
  color: var(--metin-ikincil);
}
.tv-message[hidden] { display: none; }
.tv-message.is-error .state-msg { color: var(--hata); }

/* Canlı TV izleme: üst şerit yok; alt menü her zaman görünür (izleme görünümüyle aynı) */
#app-root[data-view="tvwatch"] { grid-template-rows: minmax(0, 1fr) auto; }
#app-root[data-view="tvwatch"] .topbar { display: none; }
#app-root[data-view="tvwatch"] .view { padding: 0; overflow: hidden; }
#app-root[data-view="tvwatch"] .version-line:not(.is-latest),
#app-root[data-view="tvwatch"] .version-note { display: none; }
#app-root[data-view="tvwatch"] .controls { padding-bottom: 22px; }

/* Üst şerit eklentileri: kanal logosu ve CANLI rozeti */
.tv-top-logo { flex: none; width: 72px; }
.tv-top-logo[hidden] { display: none; }
.tv-top-logo .tv-logo { aspect-ratio: 16 / 10; font-size: calc(14px * var(--fs, 1)); background: transparent; }
.tv-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--hata);
  border-radius: var(--radius-buton);
  color: var(--hata);
  font-family: var(--font-sayi);
  font-size: calc(12px * var(--fs, 1));
  font-weight: 700;
  letter-spacing: 0.06em;
}
.tv-live-badge i { width: 10px; height: 10px; border-radius: 50%; background: var(--hata); }

/* Kumanda eklentileri */
.ctl:disabled { opacity: 0.4; cursor: default; }
.ctl.is-on { color: var(--uyari); }
.tv-golive { border-color: var(--hata); color: var(--metin-video); }
.tv-golive[hidden] { display: none; }
.tv-golive svg { color: var(--hata); }
.tvwatch .btn-row .btn { background: transparent; }
.tvwatch .btn-row .btn:disabled { opacity: 0.4; cursor: default; }

/* Yerleşim: sol sütun (üst şerit + video + kumanda), sağ sütun kanal paneli.
   Panel açılınca video daralır; panel görüntünün üstünü örtmez. */
.watch.tvwatch {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.watch.tvwatch.has-panel { grid-template-columns: minmax(0, 1fr) min(380px, 40%); }
.tv-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.tv-main .watch-stage { flex: 1 1 auto; min-height: 0; }

/* Üst şerit videonun dışında, üstünde ve her zaman görünür (tam alan dışında) */
.tvwatch:not(.is-full) .watch-top {
  position: static;
  padding: 4px 12px;
  background: var(--zemin);
  border-bottom: 1px solid var(--sinir);
}
.tvwatch.is-idle:not(.is-full) .watch-top { opacity: 1; pointer-events: auto; }
.tvwatch .watch-back {
  min-height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  background: var(--hata);
  border-color: var(--hata);
  color: var(--metin-video);
  font-weight: 600;
}
.tvwatch:not(.is-full) .watch-top .net-slot { min-height: 0; }

/* Kanal paneli (sağ sütun, kaydırılabilir) */
.tv-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid var(--sinir);
  background: var(--zemin);
}
.tv-panel[hidden] { display: none; }
.tv-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-bottom: 1px solid var(--sinir);
}
.tv-panel-title { margin: 0; font-family: var(--font-baslik); font-size: calc(16px * var(--fs, 1)); font-weight: 500; }
.tv-panel-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.tv-panel-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  padding: 8px 16px;
  border: 0;
  border-bottom: 1px solid var(--sinir);
  background: transparent;
  color: var(--metin);
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.tv-panel-item .tv-logo { flex: none; width: 88px; }
/* Kanal adi logonun yaninda okunur boyda; uzun adlar en fazla iki satira sarilir, tasmaz. */
.tv-panel-name {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 500;
  font-size: calc(16px * var(--fs, 1));
  line-height: 1.2;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.tv-panel-item.is-current { background: var(--yuzey); border-left: 4px solid var(--vurgu); padding-left: 12px; }
.tv-panel-item.is-current .tv-panel-name { color: var(--vurgu); }


/* Kumanda satiri tek satir: sigmazsa once ses cubugu daralir, sonra dusuk oncelikli ogeler gizlenir. */
.tvwatch .btn-row { flex-wrap: nowrap; gap: 6px; min-width: 0; }
.tvwatch .btn-row > * { flex-shrink: 0; }
.tvwatch .btn-row .spacer { flex: 1 1 0; min-width: 0; }
.tvwatch .btn-row .volume { flex: 0 1 110px; width: 110px; min-width: 0; }
.tvwatch .ctl { min-width: 48px; min-height: 48px; }
.tvwatch .btn-row .btn { min-height: 48px; padding: 0 12px; white-space: nowrap; }
.tvwatch .menu-wrap { margin: 0; }
.tvwatch .menu-btn { min-width: 64px; min-height: 48px; padding: 0 12px; }
.tvwatch .watch-top { min-width: 0; }
.tvwatch .watch-top > * { min-width: 0; }
.tvwatch .watch-back { white-space: nowrap; }
/* Kanal paneli acikken video sutunu daralir (1183 px kokte ~800 px): Canlıya dön yalniz simge, logo gizli */
.tvwatch.has-panel .tv-golive { font-size: 0; gap: 0; padding: 0; min-width: 48px; }
.tvwatch.has-panel .tv-top-logo { display: none; }
.tvwatch.has-panel .btn-row .volume { flex-basis: 80px; width: 80px; }

/* Dar pencere: izgara daralir, dusuk oncelikli ogeler gizlenir; hicbir sey ikinci satira gecmez */
@container app (max-width: 900px) {
  .tv-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tv-lang-text { display: none; }
  .tv-top-logo { display: none; }
  .tvwatch .btn-row .volume { display: none; }
  .tv-golive { font-size: 0; gap: 0; padding: 0; min-width: 48px; }
}
@container app (max-width: 700px) {
  .tv-count { display: none; }
  .tvwatch .btn-row .btn:not(.tv-golive) { font-size: 0; gap: 0; padding: 0; min-width: 48px; }
}

/* Kumanda videonun DISINDA, altinda (normal gorunum): sahne daralir, goruntu ortulmez.
   Tam alanda kumanda videonun ustunde yuzer ve hareketsizlikte solar. */
.tvwatch:not(.is-full) .controls {
  position: static;
  width: 100%;
  box-sizing: border-box;
  flex: none;
  background: var(--zemin);
  border-top: 1px solid var(--sinir);
}
.tvwatch.is-idle:not(.is-full) .controls { opacity: 1; pointer-events: auto; }
