/* TV Shows & Live TV Episode Tracker Styling */

.tv-shows-container {
  padding: 24px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

.tv-shows-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}

.tv-shows-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary, #38bdf8);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.tv-shows-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary, #ffffff);
  margin: 0 0 6px 0;
}

.tv-shows-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary, #9ca3af);
  margin: 0;
  max-width: 700px;
  line-height: 1.45;
}

.tv-shows-search-box {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 4px 8px;
  min-width: 320px;
}

.tv-shows-search-box input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 0.9rem;
  padding: 8px;
  flex: 1;
  outline: none;
}

.btn-tv-search {
  background: var(--accent-primary, #38bdf8);
  border: none;
  border-radius: 6px;
  color: #000;
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

/* Tabs */
.tv-shows-tabs {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.tv-tab-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary, #9ca3af);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.tv-tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.tv-tab-btn.active {
  background: var(--accent-primary, #38bdf8);
  color: #000;
  border-color: var(--accent-primary, #38bdf8);
  font-weight: 600;
}

/* Grid */
.tv-shows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.tv-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.tv-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(56, 189, 248, 0.4);
}

.tv-card-poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: #111;
  overflow: hidden;
}

.tv-card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tv-card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.tv-card-fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.2s;
}

.tv-card-fav-btn.is-active,
.tv-card-fav-btn:hover {
  color: #fbbf24;
  background: rgba(0, 0, 0, 0.85);
}

.tv-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tv-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.tv-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-bottom: 8px;
}

.badge-downloaded {
  color: #10b981;
  font-weight: 600;
}

.tv-card-next-airing {
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  color: #38bdf8;
}

.tv-card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.btn-tv-view-detail,
.btn-tv-follow {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-tv-view-detail:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
}

.btn-tv-follow:hover {
  background: var(--accent-primary, #38bdf8);
  color: #000;
}

/* Modal */
.tv-show-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.tv-modal-content {
  position: relative;
  background: #18181b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  z-index: 1;
}

.tv-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tv-modal-header {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.tv-modal-poster {
  width: 140px;
  aspect-ratio: 2/3;
  border-radius: 8px;
  object-fit: cover;
}

.tv-modal-header-info {
  flex: 1;
}

.tv-modal-network {
  font-size: 0.8rem;
  color: #38bdf8;
  font-weight: 600;
  text-transform: uppercase;
}

.tv-modal-title {
  font-size: 1.6rem;
  color: #fff;
  margin: 4px 0 10px 0;
}

.tv-modal-overview {
  font-size: 0.88rem;
  color: #a1a1aa;
  line-height: 1.45;
  margin-bottom: 16px;
}

.btn-tv-primary {
  background: var(--accent-primary, #38bdf8);
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-tv-primary.is-following {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid #10b981;
}

.tv-modal-episodes-section h3 {
  font-size: 1.15rem;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.tv-modal-ep-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 8px;
  gap: 16px;
}

.tv-modal-ep-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.ep-num {
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  font-weight: 700;
}

.tv-modal-ep-synopsis {
  font-size: 0.8rem;
  color: #71717a;
  margin: 0 0 4px 0;
  line-height: 1.35;
}

.tv-modal-ep-airing-info {
  font-size: 0.75rem;
  color: #9ca3af;
}

.badge-status-downloaded {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 600;
}

.badge-status-catchup {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 600;
}

.badge-status-upcoming {
  font-size: 0.75rem;
  color: #f59e0b;
}

.badge-status-live {
  font-size: 0.75rem;
  color: #ef4444;
  font-weight: 700;
}

.tv-modal-ep-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-ep-play {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
}

.btn-ep-download {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

/* Direct Episode Cards in Overview */
.tv-overview-section {
  margin-bottom: 36px;
}

.tv-overview-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 16px 0;
}

.tv-overview-section-title span.count-badge {
  font-size: 0.8rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary, #38bdf8);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.tv-direct-ep-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.tv-direct-ep-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.tv-direct-ep-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.tv-direct-ep-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
  overflow: hidden;
}

.tv-direct-ep-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tv-direct-ep-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.tv-direct-ep-status {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
}

.tv-direct-ep-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tv-direct-ep-show-name {
  font-size: 0.75rem;
  color: #38bdf8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.tv-direct-ep-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  margin: 0 0 6px 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tv-direct-ep-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 8px;
}

.tv-direct-ep-synopsis {
  font-size: 0.78rem;
  color: #a1a1aa;
  margin: 0 0 12px 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tv-direct-ep-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
}

.btn-direct-play,
.btn-direct-playlist,
.btn-direct-download {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-direct-play {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
}

.btn-direct-play:hover {
  background: var(--accent-primary, #38bdf8);
  color: #000;
}

.btn-direct-playlist:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-direct-download:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
  color: #10b981;
}

/* Empty states */
.tv-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #9ca3af;
}

.tv-empty-icon {
  margin-bottom: 16px;
  color: rgba(255, 255, 255, 0.2);
}

.tv-empty-state h3 {
  color: #fff;
  margin-bottom: 8px;
}

.tv-empty-state p {
  margin-bottom: 20px;
}

