/* ====================================================================
   TOKENS DE DESIGN

   Conceito: sala de controle de uma rede de telas. Fundo escuro tipo
   ambiente de monitoramento, cada totem exibido como um mini monitor
   com uma luz de status (verde pulsando = ao vivo, cinza apagada =
   offline). Acento âmbar reservado só para ações do administrador,
   pra não competir com o verde de status.
   ==================================================================== */
:root {
  --bg: #0E1113;
  --superficie: #171B1F;
  --superficie-2: #1F2530;
  --borda: #2A313A;
  --texto: #E7EAEE;
  --texto-fraco: #8993A1;
  --texto-fraquissimo: #5B6470;

  --ao-vivo: #33D6A6;
  --ao-vivo-fundo: rgba(51, 214, 166, 0.12);
  --offline: #4B5560;
  --acento: #E8A33D;
  --acento-hover: #F2B457;
  --perigo: #E8654F;

  --fonte-display: "JetBrains Mono", "Courier New", monospace;
  --fonte-corpo: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --raio: 10px;
  --raio-pequeno: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--texto);
  font-family: var(--fonte-corpo);
  font-size: 15px;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(51, 214, 166, 0.05), transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(232, 163, 61, 0.04), transparent 35%);
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ==================== TOPO ==================== */
.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--borda);
  background: rgba(23, 27, 31, 0.6);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--fonte-display);
  letter-spacing: 0.12em;
  font-size: 13px;
  color: var(--texto-fraco);
}

.marca-icone {
  color: var(--ao-vivo);
  font-size: 16px;
}

.abas {
  display: flex;
  gap: 4px;
  background: var(--superficie);
  padding: 4px;
  border-radius: var(--raio);
  border: 1px solid var(--borda);
}

.aba {
  border: none;
  background: transparent;
  color: var(--texto-fraco);
  padding: 8px 18px;
  border-radius: var(--raio-pequeno);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.aba:hover { color: var(--texto); }

.aba.ativa {
  background: var(--superficie-2);
  color: var(--texto);
}

/* ==================== CONTEUDO / PAINEIS ==================== */
.conteudo {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px 80px;
}

.painel { display: none; }
.painel.painel-ativo { display: block; animation: aparecer 0.2s ease; }

@keyframes aparecer {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.painel-cabecalho {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 28px;
  gap: 20px;
}

.painel-cabecalho h1 {
  font-family: var(--fonte-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.subtitulo {
  margin: 0;
  color: var(--texto-fraco);
  font-size: 13.5px;
}

.botao-primario {
  background: var(--acento);
  color: #1A1300;
  border: none;
  padding: 10px 18px;
  border-radius: var(--raio-pequeno);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}
.botao-primario:hover { background: var(--acento-hover); }
.botao-primario:active { transform: scale(0.98); }

.botao-secundario {
  background: transparent;
  color: var(--texto-fraco);
  border: 1px solid var(--borda);
  padding: 10px 18px;
  border-radius: var(--raio-pequeno);
  font-size: 13.5px;
  font-weight: 500;
}
.botao-secundario:hover { color: var(--texto); border-color: var(--texto-fraquissimo); }

.botao-upload { display: inline-flex; align-items: center; }

/* ==================== GRADE DE TOTENS (mini monitores) ==================== */
.grade-totens {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.card-totem {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  overflow: hidden;
}

.card-totem-tela {
  aspect-ratio: 16 / 10;
  background: #05070A;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 1px solid var(--borda);
}

.card-totem-tela::before {
  /* leve textura de scanlines, sutil */
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.015) 0px,
    rgba(255,255,255,0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}

.status-luz {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--offline);
  z-index: 1;
}

.status-luz.online {
  background: var(--ao-vivo);
  box-shadow: 0 0 0 0 var(--ao-vivo-fundo);
  animation: pulsar 2s infinite;
}

@keyframes pulsar {
  0% { box-shadow: 0 0 0 0 rgba(51, 214, 166, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(51, 214, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(51, 214, 166, 0); }
}

.card-totem-video-atual {
  z-index: 1;
  font-family: var(--fonte-display);
  font-size: 11px;
  color: var(--texto-fraco);
  max-width: 90%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-totem-corpo {
  padding: 14px 16px;
}

.card-totem-nome {
  font-weight: 600;
  font-size: 14.5px;
  margin: 0 0 2px;
}

.card-totem-local {
  color: var(--texto-fraco);
  font-size: 12.5px;
  margin: 0 0 12px;
}

.card-totem-rodape {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  color: var(--texto-fraquissimo);
}

.link-acao {
  background: none;
  border: none;
  color: var(--ao-vivo);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}
.link-acao:hover { color: var(--acento); }

/* ==================== TABELA DE VIDEOS ==================== */
.tabela {
  width: 100%;
  border-collapse: collapse;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  overflow: hidden;
}

.tabela th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--texto-fraquissimo);
  padding: 12px 16px;
  border-bottom: 1px solid var(--borda);
}

.tabela td {
  padding: 12px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--borda);
}

.tabela tbody tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover { background: var(--superficie-2); }

/* ==================== LISTA DE PLAYLISTS ==================== */
.lista-playlists { display: flex; flex-direction: column; gap: 12px; }

.card-playlist {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 16px 18px;
}

.card-playlist-topo {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.card-playlist-nome { font-weight: 600; font-size: 14.5px; }
.card-playlist-contagem { color: var(--texto-fraco); font-size: 12px; }

.card-playlist-itens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-video {
  background: var(--superficie-2);
  border: 1px solid var(--borda);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--texto-fraco);
  font-family: var(--fonte-display);
}

/* ==================== MODAIS ==================== */
.sobreposicao {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.7);
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.sobreposicao.aberta { display: flex; }

.modal {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  padding: 26px;
  width: 400px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h2 {
  font-family: var(--fonte-display);
  font-size: 17px;
  margin: 0 0 18px;
}

.campo {
  display: block;
  font-size: 12.5px;
  color: var(--texto-fraco);
  margin-bottom: 14px;
}

.campo input[type="text"] {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--borda);
  color: var(--texto);
  padding: 10px 12px;
  border-radius: var(--raio-pequeno);
  font-size: 14px;
}

.campo input[type="text"]:focus {
  outline: 2px solid var(--ao-vivo);
  outline-offset: 1px;
  border-color: transparent;
}

.campo-label {
  font-size: 12.5px;
  color: var(--texto-fraco);
  margin: 0 0 10px;
}

.lista-selecao {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 18px;
}

.item-selecao {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--borda);
  border-radius: var(--raio-pequeno);
  font-size: 13.5px;
  cursor: pointer;
}

.item-selecao:hover { border-color: var(--texto-fraquissimo); }

.item-selecao input { accent-color: var(--ao-vivo); }

.modal-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.caixa-token {
  font-family: var(--fonte-display);
  background: var(--bg);
  border: 1px dashed var(--acento);
  color: var(--acento);
  padding: 12px;
  border-radius: var(--raio-pequeno);
  font-size: 13px;
  word-break: break-all;
  margin-bottom: 18px;
}

/* ==================== RESPONSIVO ==================== */
@media (max-width: 640px) {
  .topo { flex-direction: column; gap: 14px; align-items: stretch; }
  .conteudo { padding: 24px 16px 60px; }
  .painel-cabecalho { flex-direction: column; align-items: stretch; }
  .grade-totens { grid-template-columns: 1fr; }
}

/* respeita usuários que preferem menos animação */
@media (prefers-reduced-motion: reduce) {
  .status-luz.online { animation: none; }
  .painel.painel-ativo { animation: none; }
}
