:root {
  --bg: #0a0d18;
  --bg-2: #0e1424;
  --surface: #131b2e;
  --surface-2: #1a2440;
  --border: #22304d;
  --text: #e8edf5;
  --text-2: #8fa0bd;
  --text-3: #5a6b85;
  --accent: #22d3ee;
  --accent-2: #06b6d4;
  --purple: #c084fc;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* El atributo hidden debe ganar SIEMPRE sobre cualquier display */
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 20% -10%, rgba(34, 211, 238, 0.06), transparent),
    radial-gradient(1000px 500px at 100% 0%, rgba(192, 132, 252, 0.05), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 20, 36, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  gap: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; }
.brand__logo { font-size: 24px; }
.accent { color: var(--accent); }
.topbar__hint { color: var(--text-2); font-size: 14px; }

/* ---------- Container ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- Filtros ---------- */
.filters { margin-bottom: 24px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #04060d;
  border-color: transparent;
}
.filters__row { display: flex; gap: 12px; flex-wrap: wrap; }
.input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 16px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--text-3); }
#search { flex: 1; min-width: 220px; }
.select { flex: 0 0 auto; min-width: 200px; cursor: pointer; }
.stats { margin-top: 12px; color: var(--text-3); font-size: 13px; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card__top { display: flex; align-items: center; gap: 12px; }
.card__logo {
  width: 48px; height: 48px; border-radius: 10px;
  background: var(--surface-2);
  object-fit: contain; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.card__logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.card__info { min-width: 0; }
.card__name {
  font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card__group { color: var(--text-3); font-size: 12px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__badge {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; padding: 3px 8px; border-radius: 999px;
  font-weight: 700; letter-spacing: 0.5px;
}
.badge--live { background: rgba(34, 211, 238, 0.15); color: var(--accent); }
.badge--movie { background: rgba(192, 132, 252, 0.15); color: var(--purple); }
.badge--series { background: rgba(52, 211, 153, 0.15); color: var(--green); }
.btn-report {
  margin-top: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-report:hover { background: var(--red); color: #fff; border-color: transparent; }

/* ---------- Paginación ---------- */
.pagination {
  display: flex; justify-content: center; align-items: center;
  gap: 6px; margin-top: 28px; flex-wrap: wrap;
}
.page-btn {
  min-width: 40px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); border-radius: var(--radius-sm);
  cursor: pointer; font-size: 14px; transition: all 0.15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--text); }
.page-btn.active {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #04060d; border-color: transparent; font-weight: 700;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.loader, .empty { text-align: center; color: var(--text-2); padding: 40px; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(4, 6, 13, 0.75);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal__box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px; width: 100%; max-width: 460px;
  box-shadow: var(--shadow); position: relative;
}
.modal__close {
  position: absolute; top: 16px; right: 18px;
  background: none; border: none; color: var(--text-2);
  font-size: 26px; cursor: pointer; line-height: 1;
}
.modal__close:hover { color: var(--text); }
.modal__title { font-size: 20px; margin-bottom: 8px; }
.modal__item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  margin-bottom: 18px; font-size: 14px;
}
.modal__item strong { color: var(--accent); }

/* ---------- Formulario ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--text-2); font-weight: 600; }
.form__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.btn {
  padding: 11px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all 0.15s;
}
.btn--primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #04060d;
}
.btn--primary:hover { filter: brightness(1.1); }
.btn--primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn--ghost:hover { color: var(--text); }
.form__msg { font-size: 13px; text-align: center; min-height: 18px; }
.form__msg.error { color: var(--red); }
.form__msg.success { color: var(--green); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--green); color: #04120c;
  padding: 14px 24px; border-radius: var(--radius);
  font-weight: 600; box-shadow: var(--shadow); z-index: 200;
  animation: slideUp 0.3s ease;
}
.toast.error { background: var(--red); color: #1a0508; }
@keyframes slideUp { from { opacity: 0; transform: translate(-50%, 20px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 600px) {
  .topbar__hint { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ============================================================
   SELECTOR DE VISTA + MODOS DE VISTA (list / cards / poster)
   ============================================================ */
.filters__bottom {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 12px; flex-wrap: wrap;
}
.view-switch { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px; }
.view-btn {
  background: none; border: none; color: var(--text-3);
  width: 38px; height: 34px; border-radius: 999px;
  cursor: pointer; font-size: 16px; transition: all 0.15s;
}
.view-btn:hover { color: var(--text); }
.view-btn.active { background: var(--accent); color: #04060d; }

/* --- Vista LISTA (por defecto, máxima legibilidad) --- */
.grid.view-list { grid-template-columns: 1fr; gap: 8px; }
.grid.view-list .card {
  flex-direction: row; align-items: center; gap: 14px;
  padding: 12px 16px;
}
.grid.view-list .card__badge {
  position: static; order: -1; flex: 0 0 auto;
}
.grid.view-list .card__top { flex: 1; min-width: 0; }
.grid.view-list .card__name { white-space: normal; }
.grid.view-list .btn-report {
  margin-top: 0; flex: 0 0 auto; width: auto; padding: 9px 16px;
}
.grid.view-list .card__logo { width: 40px; height: 40px; }

/* --- Vista TARJETAS (2 líneas, badge arriba) --- */
.grid.view-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.view-cards .card__badge { position: static; align-self: flex-start; margin-bottom: 4px; }
.grid.view-cards .card__name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- Vista PÓSTER (logo grande arriba) --- */
.grid.view-poster { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.grid.view-poster .card { align-items: stretch; }
.grid.view-poster .card__top { flex-direction: column; align-items: flex-start; }
.grid.view-poster .card__logo { width: 100%; height: 90px; margin-bottom: 8px; font-size: 34px; }
.grid.view-poster .card__badge { position: absolute; top: 20px; left: 20px; }
.grid.view-poster .card__name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Responsive: en móvil, tarjetas y póster con columnas más chicas */
@media (max-width: 600px) {
  .container { padding: 16px 12px 50px; }
  .grid.view-cards { grid-template-columns: 1fr; }
  .grid.view-poster { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .view-switch { order: -1; }
  .filters__bottom { justify-content: center; }
}

/* ============================================================
   SKELETON LOADING (placeholders animados)
   ============================================================ */
.skeleton-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.skel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px;
}
.skel__box, .skel__line {
  background: linear-gradient(90deg, var(--surface-2) 25%, #223052 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px;
}
.skel__box { width: 40px; height: 40px; flex: 0 0 auto; }
.skel__lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel__line { height: 12px; }
.skel__line.short { width: 40%; }
.skel__line.medium { width: 70%; }
.skel__btn { width: 90px; height: 34px; flex: 0 0 auto; border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-2) 25%, #223052 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   LOGO
   ============================================================ */
.brand__img { height: 34px; width: auto; vertical-align: middle; }

/* ============================================================
   NAV entre secciones (Reportar / Solicitar)
   ============================================================ */
.section-nav { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.section-nav__btn {
  padding: 11px 22px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.section-nav__btn.active { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #04060d; border-color: transparent; }

/* ============================================================
   FORMULARIO DE SOLICITUD
   ============================================================ */
.request-box {
  max-width: 560px; margin: 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px;
}
.request-box h2 { margin-bottom: 6px; }
.request-box .sub { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }
.g-recaptcha { margin: 4px 0; }

/* ============================================================
   SELECCIÓN MÚLTIPLE
   ============================================================ */
.card__check {
  position: absolute; top: 12px; right: 12px;
  width: 24px; height: 24px; border-radius: 6px;
  border: 2px solid var(--border); background: var(--surface-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 2; transition: all 0.15s;
}
.card__check.checked { background: var(--accent); border-color: var(--accent); }
.card__check.checked::after { content: '✓'; color: #04060d; font-weight: 900; font-size: 14px; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

/* En vista lista, el check va antes */
.grid.view-list .card__check { position: static; order: -2; }
/* En cards/poster el badge se corre para no chocar con el check */
.grid.view-cards .card__badge, .grid.view-poster .card__badge { right: 44px; }

/* Barra de selección flotante */
.selection-bar {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--bg-2); border: 1px solid var(--accent);
  border-radius: 999px; padding: 10px 12px 10px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5); z-index: 90;
  animation: slideUp 0.25s ease;
}
.selection-bar__count { font-weight: 700; font-size: 14px; }
.selection-bar__count span { color: var(--accent); }
.selection-bar__btn {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: #04060d; border: none; border-radius: 999px;
  padding: 10px 20px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.selection-bar__clear {
  background: none; border: none; color: var(--text-2);
  cursor: pointer; font-size: 20px; padding: 0 4px;
}
.modal__item.multi { max-height: 160px; overflow-y: auto; }
.modal__item .multi-item { padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.modal__item .multi-item:last-child { border-bottom: none; }
