/* ==========================================================================
   ТВ ПОВТОР — СТИЛИ РАЗДЕЛА «ТЕЛЕПРОГРАММА» (WIDE EPG HUB)
   Премиальный кинематографичный дизайн, живая сетка передач,
   поиск, фильтры времени и дат, интерактивные карточки каналов.
   ========================================================================== */

/* Переключатель разделов в верхней шапке */
.header-nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-left: 14px;
}

.header-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.header-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.header-tab-btn.active {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

/* Контейнер режима «Телепрограмма» (заменяет 3-колоночный плеер, когда активен) */
.programma-view-container {
  display: none;
  width: 100vw;
  height: calc(100vh - 60px);
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  overflow-x: hidden;
  background: #07090e;
  box-sizing: border-box;
  padding: 24px 32px 60px;
}

.programma-view-container.active {
  display: flex;
  flex-direction: column;
}

/* Шапка страницы телепрограммы */
.prog-hero-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.prog-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.prog-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prog-h1 {
  font-size: 1.75rem;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.prog-subtitle {
  font-size: 0.95rem;
  color: #94a3b8;
  margin: 0;
}

/* Внутренние табы телепрограммы */
.prog-subnav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0d1322;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.prog-subnav-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.prog-subnav-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.prog-subnav-btn.active {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

/* Панель фильтров: даты, время суток, категории, поиск */
.prog-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #0b0f1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.prog-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

/* Кнопки дат */
.prog-dates-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.prog-dates-slider::-webkit-scrollbar {
  display: none;
}

.prog-date-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.prog-date-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.prog-date-pill.active {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* Фильтры времени суток */
.prog-time-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.prog-time-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.prog-time-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.prog-time-btn.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
  color: #93c5fd;
  font-weight: 700;
}

/* Поиск по передачам в телепрограмме */
.prog-search-box {
  position: relative;
  flex: 1 1 300px;
  max-width: 450px;
}

.prog-search-input {
  width: 100%;
  background: #07090e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  padding: 9px 38px 9px 36px;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.prog-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.prog-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: #64748b;
  pointer-events: none;
}

.prog-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 0.95rem;
  display: none;
}

/* СЕТКА «СЕЙЧАС В ЭФИРЕ» (GRID) */
.prog-grid-live {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.live-channel-card {
  background: #0d121f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.live-channel-card:hover {
  transform: translateY(-3px);
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 16px rgba(59, 130, 246, 0.2);
}

.live-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-card-logo {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #080c16;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.live-card-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.live-card-info {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.live-card-name {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-card-group {
  font-size: 0.76rem;
  color: #64748b;
  font-weight: 600;
}

.live-badge-pulse {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: pulseLive 2s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulseLive {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

.live-card-prog {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 12px;
}

.live-prog-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-prog-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #94a3b8;
}

.live-prog-time {
  color: #60a5fa;
  font-weight: 700;
}

.live-prog-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}

.live-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #60a5fa);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.live-card-next {
  font-size: 0.78rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-card-next-time {
  color: #94a3b8;
  font-weight: 700;
}

/* СЕТКА «ПО КАНАЛАМ» (РАСПИСАНИЕ ДНЯ) */
.prog-by-channel-wrap {
  display: flex;
  gap: 20px;
  height: calc(100vh - 270px);
  min-height: 500px;
}

.prog-channel-selector {
  width: 320px;
  flex-shrink: 0;
  background: #0b0f1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prog-chan-search {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0e1424;
}

.prog-chan-list {
  flex: 1 1 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 4px;
}

.prog-chan-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.prog-chan-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.prog-chan-item.active {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
}

.prog-chan-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #080c16;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  flex-shrink: 0;
}

.prog-chan-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.prog-chan-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Расписание выбранного канала */
.prog-schedule-panel {
  flex: 1 1 0;
  background: #0b0f1a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.prog-schedule-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0e1424;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prog-sched-head-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prog-sched-logo {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #080c16;
  padding: 4px;
}

.prog-sched-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.prog-sched-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.prog-sched-date {
  font-size: 0.85rem;
  color: #60a5fa;
  font-weight: 700;
}

.prog-schedule-list {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prog-row-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
}

.prog-row-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(96, 165, 250, 0.3);
}

.prog-row-card.live {
  background: rgba(239, 68, 68, 0.12);
  border: 1.5px solid #ef4444;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.25);
}

.prog-row-time {
  width: 80px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #60a5fa;
  flex-shrink: 0;
  padding-top: 2px;
}

.prog-row-card.live .prog-row-time {
  color: #f87171;
}

.prog-row-info {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prog-row-title {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  line-height: 1.3;
}

.prog-row-desc {
  font-size: 0.82rem;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

.prog-row-action {
  flex-shrink: 0;
  align-self: center;
}

.btn-prog-watch {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-prog-watch:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.5);
}

.btn-prog-archive {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-prog-archive:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
}

/* РЕЗУЛЬТАТЫ ПОИСКА ПЕРЕДАЧ */
.prog-search-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #0d121f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 18px;
  transition: all 0.2s ease;
}

.search-result-card:hover {
  border-color: #3b82f6;
  background: #111827;
  transform: translateY(-2px);
}

.search-res-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 0;
}

.search-res-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #080c16;
  padding: 3px;
  flex-shrink: 0;
}

.search-res-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.search-res-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.search-res-channel {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 700;
}

.search-res-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
}

.search-res-time {
  font-size: 0.82rem;
  color: #60a5fa;
  font-weight: 700;
}

.search-res-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin: 2px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Мобильная адаптивность */
@media (max-width: 900px) {
  .programma-view-container {
    padding: 16px 12px 60px;
  }
  .prog-by-channel-wrap {
    flex-direction: column;
    height: auto;
  }
  .prog-channel-selector {
    width: 100%;
    max-height: 200px;
  }
  .prog-schedule-panel {
    min-height: 400px;
  }
  .prog-grid-live {
    grid-template-columns: 1fr;
  }
}
