/* ── LAYOUT TV ─────────────────────────────────────── */
#tv-section {
  padding: 0 !important;
  height: calc(100vh - 0px);
  overflow: hidden;
  display: none;
  max-width: 100%;
}
#tv-section.active {
  display: flex;
  flex-direction: column;
}
.tv-layout {
  display: flex;
  max-height: 95%;
  min-height: 95%;
  border-radius: 12px;
  overflow: hidden;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
#tv-sidebar {
  width: 260px;
  min-width: 260px;
  background: var(--surface-color, #111318);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.tv-sidebar-header {
  padding: 20px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}
.tv-logo-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #ff6b35;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex-shrink: 0;
}
.tv-logo-eyebrow {
  font-size: 9px; color: rgba(255,255,255,0.35);
  letter-spacing: .2em; text-transform: uppercase; margin-bottom: 2px;
}
.tv-logo-name {
  font-size: 20px; font-weight: 700; line-height: 1;
  color: var(--text-color, #f0f2f7);
}
.tv-logo-name span { color: #ff6b35; }
.tv-sidebar-label {
  padding: 12px 20px 6px;
  font-size: 9px; letter-spacing: .2em;
  color: rgba(255,255,255,0.3); text-transform: uppercase;
}
.tv-sidebar-search { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
#tv-country-list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; }

/* ── SEARCH INPUTS ───────────────────────────────────── */
.tv-search-wrap { position: relative; }
.tv-search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: rgba(255,255,255,0.3); pointer-events: none;
}
.tv-search-wrap input,
.tv-csearch-wrap input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text-color, #f0f2f7);
  font-size: 13px;
  padding: 9px 12px 9px 36px;
  outline: none;
  transition: border-color .2s;
}
.tv-search-wrap input:focus,
.tv-csearch-wrap input:focus { border-color: #ff6b35; }
.tv-search-wrap input::placeholder,
.tv-csearch-wrap input::placeholder { color: rgba(255,255,255,0.25); }

/* ── COUNTRY ITEMS ───────────────────────────────────── */
.tv-country-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  cursor: pointer; margin-bottom: 2px;
  border: 1px solid transparent;
  transition: background .15s;
  user-select: none;
}
.tv-country-item:hover { background: rgba(255,255,255,0.05); }
.tv-country-item.active {
  background: rgba(255,107,53,0.1);
  border-color: rgba(255,107,53,0.2);
}
.tv-cflag { font-size: 20px; line-height: 1; flex-shrink: 0; }
.tv-cinfo { flex: 1; min-width: 0; }
.tv-cname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-country-item.active .tv-cname { color: #ff9a6c; }
.tv-ccode { font-size: 9px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: .1em; }
.tv-ccount {
  font-size: 10px; color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.06);
  padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
}
.tv-country-item.active .tv-ccount { background: rgba(255,107,53,0.15); color: #ff9a6c; }

/* ── MAIN TV ─────────────────────────────────────────── */
#tv-main {
  flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; min-width: 0;
}
#tv-topbar {
  background: var(--surface-color, #111318);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; flex-shrink: 0; gap: 16px;
}
.tv-topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tv-tb-flag { font-size: 26px; line-height: 1; flex-shrink: 0; }
.tv-tb-title { font-size: 22px; font-weight: 700; line-height: 1; }
.tv-tb-sub { font-size: 10px; color: rgba(255,255,255,0.35); letter-spacing: .08em; margin-top: 2px; }
.tv-topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tv-stat-chip {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px; padding: 5px 12px; font-size: 11px;
  color: rgba(255,255,255,0.5); white-space: nowrap;
}
.tv-stat-chip b { color: #ff6b35; margin-right: 4px; }

#tv-channel-searchbar {
  background: var(--surface-color, #111318);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 12px 18px; flex-shrink: 0;
}
.tv-csearch-wrap { position: relative; max-width: 440px; }
.tv-csearch-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.08); border: none; border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 11px;
}
.tv-csearch-clear:hover { color: #fff; }

#tv-filterbar {
  background: var(--surface-color, #111318);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center;
  padding: 0 12px; flex-shrink: 0; overflow-x: auto;
}
#tv-filterbar::-webkit-scrollbar { height: 0; }
.tv-ftab {
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,0.35); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  user-select: none; transition: color .15s, border-color .15s; flex-shrink: 0;
}
.tv-ftab:hover { color: rgba(255,255,255,0.75); }
.tv-ftab.active { color: #ff9a6c; border-bottom-color: #ff6b35; }

#tv-grid-scroll { flex: 1; overflow-y: auto; padding: 16px; }
.tv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

/* ── CARDS ───────────────────────────────────────────── */
.tv-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; overflow: hidden; cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.tv-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,107,53,0.35);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.tv-card:active { transform: scale(.97); }
.tv-card-thumb {
  height: 100px; background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.tv-card-logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #ff6b35;
}
.tv-card-play {
  position: absolute; inset: 0;
  background: rgba(255,107,53,0.12);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.tv-card:hover .tv-card-play { opacity: 1; }
.tv-play-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,107,53,0.85);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}
.tv-card-body { padding: 12px 14px 14px; }
.tv-card-name { font-size: 13px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }
.tv-card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 4px; }
.tv-tag {
  font-size: 9px; padding: 2px 7px; border-radius: 4px;
  letter-spacing: .05em; text-transform: uppercase; border: 1px solid;
}
.tv-tag-hls { background: rgba(74,222,128,.08); color: #4ade80; border-color: rgba(74,222,128,.2); }
.tv-tag-yt { background: rgba(239,68,68,.08); color: #f87171; border-color: rgba(239,68,68,.18); }
.tv-tag-geo { background: rgba(251,191,36,.08); color: #fbbf24; border-color: rgba(251,191,36,.2); }
.tv-card-streams { font-size: 10px; color: rgba(255,255,255,.3); }

/* ── LIVE BADGE ──────────────────────────────────────── */
.tv-live-dot {
  position: absolute; top: 8px; right: 8px;
  display: flex; align-items: center; gap: 4px;
  background: rgba(8,9,12,.75); border: 1px solid rgba(255,107,53,.3);
  border-radius: 20px; padding: 3px 7px; backdrop-filter: blur(4px);
}
.tv-live-pulse {
  width: 5px; height: 5px; border-radius: 50%; background: #ff6b35;
  animation: tv-pulse 1.4s ease-in-out infinite;
}
@keyframes tv-pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }
.tv-live-text { font-size: 8px; color: #ff9a6c; letter-spacing: .1em; }

/* ── ESTADOS ─────────────────────────────────────────── */
.tv-center-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; color: rgba(255,255,255,.3);
  padding: 40px; text-align: center;
}
.tv-center-state p { font-size: 15px; color: rgba(255,255,255,.5); }
.tv-center-state small { font-size: 11px; line-height: 1.8; }
.tv-spinner {
  width: 28px; height: 28px;
  border: 2px solid rgba(255,255,255,.1);
  border-top-color: #ff6b35; border-radius: 50%;
  animation: tv-spin .7s linear infinite;
}
@keyframes tv-spin { to { transform: rotate(360deg); } }

/* ── MODAL PLAYER ────────────────────────────────────── */
#tv-modal {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
#tv-modal.open { opacity: 1; pointer-events: all; }
.tv-modal-bg {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.88); backdrop-filter: blur(12px);
}
.tv-modal-box {
  position: relative; z-index: 1;
  background: #111318; border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px; width: 100%; max-width: 860px;
  overflow: hidden; box-shadow: 0 60px 100px rgba(0,0,0,.7);
  transform: scale(.95) translateY(10px);
  transition: transform .25s cubic-bezier(.34,1.2,.64,1);
}
#tv-modal.open .tv-modal-box { transform: scale(1) translateY(0); }
.tv-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.08); gap: 12px;
}
.tv-modal-ch-name { font-size: 17px; font-weight: 700; line-height: 1.3; }
.tv-modal-ch-meta { font-size: 11px; color: rgba(255,255,255,.35); display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.tv-modal-close {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.5); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.tv-modal-close:hover { background: rgba(248,113,113,.15); border-color: rgba(248,113,113,.3); color: #f87171; }
.tv-vid-wrap { background: #000; position: relative; aspect-ratio: 16/9; }
.tv-vid-loading {
  position: absolute; inset: 0; background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: rgba(255,255,255,.4); font-size: 13px;
}
.tv-vid-spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,.1);
  border-top-color: #ff6b35; border-radius: 50%;
  animation: tv-spin .7s linear infinite;
}
.tv-err-bar {
  background: rgba(248,113,113,.07); border: 1px solid rgba(248,113,113,.18);
  border-radius: 8px; padding: 10px 16px; font-size: 12px; color: #f87171;
  margin: 0 20px 14px; display: none; align-items: center; gap: 8px;
}
.tv-err-bar.show { display: flex; }
.tv-modal-sources {
  padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 48px;
}
.tv-src-label { font-size: 9px; color: rgba(255,255,255,.3); letter-spacing: .15em; text-transform: uppercase; margin-right: 4px; }
.tv-src-btn {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
  border-radius: 6px; color: rgba(255,255,255,.5); font-size: 10px;
  padding: 5px 12px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.tv-src-btn:hover { border-color: #ff6b35; color: #ff9a6c; }
.tv-src-btn.active { background: rgba(255,107,53,.1); border-color: rgba(255,107,53,.4); color: #ff9a6c; }

/* ── MOBILE PANEL ────────────────────────────────────── */
#tv-mobile-panel {
  display: none; position: fixed; inset: 0; z-index: 8000;
  background: #111318;
  transform: translateX(-100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  flex-direction: column; overflow: hidden;
}
#tv-mobile-panel.open { transform: translateX(0); }
.tv-mpanel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.tv-mpanel-title { font-size: 22px; font-weight: 700; }
.tv-mpanel-close {
  width: 34px; height: 34px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,.5); font-size: 16px; cursor: pointer;
}
.tv-mpanel-list { flex: 1; overflow-y: auto; padding: 6px 12px 80px; }

/* ── BOTTOM NAV TV (mobile) ──────────────────────────── */
#tv-botnav { display: none; }

/* ── RESPONSIVO ──────────────────────────────────────── */
@media (max-width: 768px) {
  #tv-sidebar { display: none; }
  #tv-mobile-panel { display: flex; }
  #tv-section.active #tv-botnav { display: flex; }
  #tv-botnav {
    position: fixed; bottom: 72px; left: 0; right: 0; /* acima do mobile-menu existente */
    height: 56px;
    background: rgba(17,19,24,.95);
    border-top: 1px solid rgba(255,255,255,.08);
    backdrop-filter: blur(20px);
    z-index: 400;
    display: flex;
  }
  .tv-bnav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; cursor: pointer;
    color: rgba(255,255,255,.35); border: none; background: none;
    font-size: 10px; font-weight: 500;
  }
  .tv-bnav-btn.active { color: #ff6b35; }
  .tv-bnav-btn i { font-size: 18px; }
  #tv-grid-scroll { padding: 12px 12px 130px; }
  .tv-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .tv-card-thumb { height: 82px; }
  #tv-modal { padding: 0; align-items: flex-end; }
  .tv-modal-box { border-radius: 16px 16px 0 0; max-width: 100%; border-bottom: none; }
}