/* ============================================
   IPTV Panel — CSS Principal
   ============================================ */

/* Reset & variáveis */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0f;
  --bg2:       #111118;
  --bg3:       #1c1c28;
  --card-bg:   #16161e;
  --accent:    #e50914;
  --accent2:   #ff6b35;
  --focus:     #ffffff;
  --text:      #e8e8f0;
  --text-dim:  #888899;
  --border:    #2a2a3a;
  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 4px 24px rgba(0,0,0,.6);
  --transition: .18s ease;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }

/* ============================================
   Tela de Login
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a0a20 0%, var(--bg) 70%);
}

.login-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: .05em;
  color: var(--accent);
}
.login-logo p {
  color: var(--text-dim);
  font-size: .85rem;
  margin-top: .3rem;
}

.form-group {
  margin-bottom: 1.2rem;
}
.form-group label {
  display: block;
  font-size: .8rem;
  color: var(--text-dim);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-group input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .7rem 1rem;
  font-size: 1rem;
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group input.focused {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .8rem 1.5rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  outline: none;
}
.btn:hover, .btn.focused {
  background: #c0070f;
  box-shadow: 0 0 0 3px rgba(229,9,20,.35);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.error-msg {
  background: rgba(229,9,20,.15);
  border: 1px solid var(--accent);
  color: #ff6b6b;
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  font-size: .88rem;
  margin-bottom: 1rem;
  display: none;
}
.error-msg.visible { display: block; }

/* ============================================
   Layout Principal — Topbar + Sidebar
   ============================================ */
.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: .6rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 1rem;
}
.topbar-brand {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .04em;
  text-decoration: none;
  flex-shrink: 0;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: .8rem;
  font-size: .85rem;
  color: var(--text-dim);
}
.topbar-user span { color: var(--text); font-weight: 600; }
.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: .3rem .8rem;
  font-size: .8rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}
.btn-logout:hover, .btn-logout.focused {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Topbar Nav (global) ---- */
.topbar-nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex: 1;
  justify-content: center;
}
.topbar-nav-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .38rem .9rem;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.topbar-nav-link:hover {
  color: var(--text);
  background: rgba(255,255,255,.06);
}
.topbar-nav-link.active {
  color: var(--text);
  background: rgba(229,9,20,.12);
}
.topbar-nav-link .nav-icon { font-size: 1rem; line-height: 1; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}
.topbar-username {
  font-size: .82rem;
  color: var(--text-dim);
  padding: 0 .25rem;
  white-space: nowrap;
}
.topbar-username strong { color: var(--text); }

.topbar-icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: .95rem;
  text-decoration: none;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.topbar-icon-btn:hover {
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.topbar-icon-btn.settings:hover,
.topbar-icon-btn.settings.active {
  border-color: var(--accent);
  color: var(--accent);
}
.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

/* ---- Nav Tabs ---- */
.nav-tabs {
  display: flex;
  gap: .5rem;
  background: var(--bg2);
  padding: .5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.nav-tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: .5rem 1.2rem;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all var(--transition);
  outline: none;
}
.nav-tab:hover, .nav-tab.focused {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(229,9,20,.1);
}
.nav-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================
   Sidebar de Categorias + Conteúdo Principal
   ============================================ */
.content-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 110px);
}

.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: .8rem 0;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  padding: .4rem 1rem;
  margin-bottom: .3rem;
}

/* Dropdown mobile: oculto em desktop, visível somente via @media */
.cat-dropdown-wrap { display: none; }

/* ============================================
   Toolbar: Dropdown de Categorias + Busca
   ============================================ */
.content-toolbar {
  display: flex;
  gap: .6rem;
  margin-bottom: 1rem;
  align-items: stretch;
}
.content-toolbar .search-bar {
  flex: 1;
  min-width: 120px;
  margin-bottom: 0;
}
.cat-dropdown-wrap {
  position: relative;
  flex-shrink: 0;
}
.cat-dropdown-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: .4rem .85rem;
  cursor: pointer;
  font-size: .9rem;
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition);
  height: 100%;
}
.cat-dropdown-btn:hover,
.cat-dropdown-btn.open { border-color: var(--accent); }
.cat-dropdown-label {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-chevron {
  flex-shrink: 0;
  transition: transform .2s;
}
.cat-dropdown-btn.open .cat-chevron { transform: rotate(180deg); }
.cat-dropdown-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  width: 260px;
  max-height: 360px;
  overflow-y: auto;
  padding: .4rem 0;
}
.cat-dropdown-panel[hidden] { display: none; }

.cat-item {
  display: flex;
  align-items: center;
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .9rem;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  outline: none;
  gap: .5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-item:hover, .cat-item.focused {
  background: var(--bg3);
  color: var(--text);
  outline: none;
}
.cat-item.active {
  border-left-color: var(--accent);
  background: var(--bg3);
  color: var(--text);
  font-weight: 600;
}

/* ============================================
   Grid de Cards
   ============================================ */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
}

.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  gap: .8rem;
}
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.section-count {
  font-size: .8rem;
  color: var(--text-dim);
  background: var(--bg3);
  padding: .15rem .6rem;
  border-radius: 20px;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .4rem .8rem;
  gap: .5rem;
  margin-bottom: 1rem;
}
.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: .95rem;
  flex: 1;
}
.search-bar svg { color: var(--text-dim); flex-shrink: 0; }

/* ---- Cards ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

/* canais ao vivo têm card mais largo */
.cards-grid.live-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.card {
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  outline: none;
  position: relative;
}
.card:hover, .card.focused {
  border-color: var(--accent);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 32px rgba(229,9,20,.3);
  z-index: 2;
}
.card:active { transform: scale(.98); }

.card-thumb {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--bg3);
  display: block;
}
.card-thumb.thumb-wide {
  aspect-ratio: 16/9;
}
.card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: .8rem;
}
.card-thumb-placeholder.thumb-wide {
  aspect-ratio: 16/9;
}

.card-body {
  padding: .6rem .8rem .8rem;
}
.card-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: .2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Live badge */
.badge-live {
  position: absolute;
  top: .5rem;
  left: .5rem;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .1rem .4rem;
  border-radius: 3px;
}

/* ---- Watch progress bar (on movie/series cards) ---- */
.card-prog-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255,255,255,.15);
}
.card-prog-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

/* ---- "ASSISTINDO" badge on series cards ---- */
.badge-watching {
  position: absolute;
  bottom: .5rem;
  left: .5rem;
  background: rgba(229,9,20,.88);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .1rem .4rem;
  border-radius: 3px;
  text-transform: uppercase;
}

/* ---- Sidebar recently-watched category ---- */
.cat-item-recent {
  color: var(--accent);
  font-weight: 700;
}
.cat-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .6rem;
  font-weight: 800;
  border-radius: 9px;
  padding: 0 .35rem;
  margin-left: .3rem;
  vertical-align: middle;
  line-height: 1.4;
}

/* ============================================
   Player
   ============================================ */
.player-page {
  background: #000;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

#video-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #000;
}

#main-video {
  width: 100%;
  height: 100%;
  max-height: 100vh;
  object-fit: contain;
  outline: none;
}

.player-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,.75) 0%,
    transparent 25%,
    transparent 70%,
    rgba(0,0,0,.85) 100%
  );
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.player-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.player-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
}
.btn-back {
  background: rgba(255,255,255,.12);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1.2rem;
  transition: background var(--transition);
  outline: none;
  flex-shrink: 0;
}
.btn-back:hover, .btn-back.focused {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(229,9,20,.35);
}
.player-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-subtitle {
  font-size: .85rem;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  flex-wrap: wrap;
}
.ctrl-btn {
  background: rgba(255,255,255,.12);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 1.1rem;
  transition: background var(--transition);
  outline: none;
  flex-shrink: 0;
}
.ctrl-btn:hover, .ctrl-btn.focused {
  background: var(--accent);
}
.ctrl-btn.btn-fullscreen { margin-left: auto; }

.progress-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}
.progress-bar-wrap span { color: rgba(255,255,255,.7); font-size: .8rem; white-space: nowrap; }
.progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.2);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width .5s linear;
}

/* Spinner de loading */
.spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.5);
  z-index: 10;
}
.spinner-ring {
  width: 52px; height: 52px;
  border: 4px solid rgba(255,255,255,.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   Modal de detalhes (filme/série)
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.75);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  transition: transform .2s ease;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg3);
  overflow: hidden;
}
.modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.modal-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, var(--bg2));
}

.modal-body { padding: 1.2rem 1.5rem 1.5rem; }
.modal-title { font-size: 1.4rem; font-weight: 800; margin-bottom: .4rem; }
.modal-meta { color: var(--text-dim); font-size: .85rem; margin-bottom: .8rem; }
.modal-desc { font-size: .9rem; color: var(--text-dim); line-height: 1.7; margin-bottom: 1.2rem; }

.modal-actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.btn-play {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .7rem 1.8rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  outline: none;
  transition: background var(--transition);
}
.btn-play:hover, .btn-play.focused {
  background: #c0070f;
  box-shadow: 0 0 0 3px rgba(229,9,20,.3);
}
.btn-secondary {
  background: rgba(255,255,255,.1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem 1.2rem;
  font-size: .95rem;
  cursor: pointer;
  outline: none;
  transition: background var(--transition);
}
.btn-secondary:hover, .btn-secondary.focused {
  background: rgba(255,255,255,.18);
}

/* Temporadas e episódios */
.seasons-list {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  margin-top: .5rem;
}
.season-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  padding: .3rem .9rem;
  font-size: .85rem;
  cursor: pointer;
  outline: none;
  transition: all var(--transition);
}
.season-btn.active, .season-btn:hover, .season-btn.focused {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .7rem;
  max-height: 300px;
  overflow-y: auto;
}
.episode-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
}
.episode-card:hover, .episode-card.focused {
  border-color: var(--accent);
  background: rgba(229,9,20,.1);
}
.ep-title { font-size: .85rem; font-weight: 600; margin-bottom: .2rem; }
.ep-meta  { font-size: .75rem; color: var(--text-dim); }

/* ============================================
   Loading skeleton
   ============================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg3) 25%, var(--bg2) 50%, var(--bg3) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.skeleton-card {
  border-radius: var(--radius);
  overflow: hidden;
}
.skeleton-thumb {
  width: 100%;
  aspect-ratio: 2/3;
}
.skeleton-line {
  height: 14px;
  margin: .8rem .8rem .4rem;
}
.skeleton-line.short {
  width: 60%;
  height: 11px;
  margin-bottom: .8rem;
}

/* ============================================
   Toast notification
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem 1.2rem;
  font-size: .9rem;
  min-width: 200px;
  box-shadow: var(--shadow);
  animation: slideIn .2s ease;
}
.toast.error { border-color: var(--accent); color: #ff6b6b; }
.toast.success { border-color: #2ea44f; color: #7ee09d; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Modo TV — foco aumentado
   ============================================ */
body.tv-mode .card.focused {
  border-color: var(--focus);
  transform: scale(1.06);
  box-shadow: 0 0 0 4px rgba(255,255,255,.3), 0 8px 32px rgba(0,0,0,.7);
}
body.tv-mode .cat-item.focused {
  background: var(--accent);
  color: #fff;
  border-left-color: #fff;
}
body.tv-mode .nav-tab.focused {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(229,9,20,.4);
}
body.tv-mode .btn-play.focused,
body.tv-mode .btn-back.focused,
body.tv-mode .ctrl-btn.focused {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ============================================
   Responsivo — Mobile
   ============================================ */
@media (max-width: 768px) {
  .content-layout {
    position: relative; /* para sidebar absolutamente posicionada */
    height: auto;
    overflow: visible;
  }
  /* Sidebar vira dropdown overlay no mobile */
  .sidebar {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 300;
    width: min(260px, 88vw);
    max-height: 360px;
    overflow-y: auto;
    border-right: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.55);
    padding: .4rem 0;
  }
  .sidebar.open { display: block; }
  .sidebar-title { display: none; }
  /* Botão dropdown visível no mobile */
  .cat-dropdown-wrap { display: flex; }
  .main-content { padding: .8rem; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .7rem; }
  .cards-grid.live-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

  .player-controls { flex-wrap: nowrap; }
  .progress-bar-wrap { flex: 1; }

  .topbar { padding: .5rem 1rem; }
  .nav-tabs { padding: .4rem 1rem; }
  .topbar-nav { display: none; }
  .topbar-username { display: none; }
}

@media (max-width: 480px) {
  .login-box { padding: 1.8rem 1.2rem; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
  .modal-body { padding: .8rem 1rem 1.2rem; }
  .modal-title { font-size: 1.1rem; }
}

/* ============================================
   Utilitários
   ============================================ */
.hidden { display: none !important; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.text-muted { color: var(--text-dim); }
.mt-1 { margin-top: .5rem; }
.mb-1 { margin-bottom: .5rem; }
.gap-1 { gap: .5rem; }
