/* ============================================================
   UniTV Admin — estilo "Qpanel": sidebar fixa + dashboard escuro
   Reaproveita os tokens de css/style.css
   ============================================================ */

body.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------- Tela de login ---------- */
.login-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}
.login-card img { width: 48px; height: 48px; margin-bottom: 12px; }
.login-card h1 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 24px;
}
.login-card .form-group { text-align: left; }
.login-card .btn-buy { margin-top: 8px; }

.tab-toggle {
  display: flex;
  background: var(--surface-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
}
.tab-btn {
  flex: 1;
  border: none;
  background: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 0;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab-btn.active { background: var(--surface); color: var(--text); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.link-esqueci {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 14px 0 0;
  cursor: pointer;
}
.link-esqueci:hover { color: var(--text); text-decoration: underline; }

.link-voltar {
  display: block;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  margin-top: 22px;
}
.link-voltar:hover { color: var(--text); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.sidebar .brand {
  padding: 8px 10px 24px;
}
.sidebar .brand img { width: 32px; height: 32px; }
.sidebar .brand span { font-size: 16px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-body);
  margin-bottom: 4px;
  transition: background .15s, color .15s;
}
.nav-item .ico { font-size: 16px; width: 18px; text-align: center; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--surface-2);
  color: var(--text);
  position: relative;
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--gradient);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ---------- Área principal ---------- */
.admin-main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 60px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.admin-topbar h1 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0;
}
.admin-topbar .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

.view { display: none; }
.view.active { display: block; }

/* ---------- Cards de estatística ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
}
.stat-card .stat-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gradient);
}

/* ---------- Painéis / seções ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 4px;
}
.panel .panel-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 20px;
}

textarea.bulk-input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
textarea.bulk-input:focus { outline: none; border-color: var(--amber); }

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--amber); }

/* ---------- Tabela ---------- */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table .mono { font-family: var(--font-mono); font-size: 12px; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.disponivel { background: rgba(34,197,94,0.14); color: var(--green); }
.badge.pago { background: rgba(34,197,94,0.14); color: var(--green); }
.badge.pendente { background: rgba(242,169,59,0.14); color: var(--amber); }
.badge.sem-estoque, .badge.pago_sem_estoque { background: rgba(226,55,68,0.14); color: var(--red); }

.panel-perigo {
  border-color: rgba(226, 55, 68, 0.35);
}
.panel-perigo h2 { color: var(--red); }

.btn-danger {
  border: none;
  background: var(--red);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.btn-danger:disabled {
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: not-allowed;
}

.status-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-family: var(--font-body);
  font-size: 12.5px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pill:hover { color: var(--text); }
.pill.active {
  background: var(--gradient);
  color: #0a0e18;
  border-color: transparent;
}

.badge.leads { background: rgba(46, 74, 158, 0.16); color: #7f9cf5; }
.badge.vencendo { background: rgba(242, 169, 59, 0.14); color: var(--amber); }
.badge.compraram { background: rgba(34, 197, 94, 0.14); color: var(--green); }

.icon-btn {
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 6px;
  border-radius: 6px;
}
.icon-btn:hover { color: var(--red); background: var(--surface-2); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
}

@media (max-width: 860px) {
  body.admin-body { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .brand { display: none; }
  .sidebar-footer { display: none; }
  .nav-item { white-space: nowrap; }
  .admin-main { padding: 20px; }
}
