/* ===== Padrão: Tema Claro (sem forçar dark global) ===== */

/* Corpo e tipografia */
:root {
  --bs-body-bg: #f8f9fa;
  --bs-body-color: #212529;
}

body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  background-size: cover;
  min-height: 100vh;
  margin: 0;
}

/* Cards */
.card {
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: .75rem;
}

/* Títulos/leituras */
h1,
p {
  color: #1f2937;
  text-shadow: none;
}

/* Botões (ajuste geral) */
.btn {
  border-radius: 6px;
}

/* Campos (claro) */
.form-control,
.form-select,
textarea.form-control {
  background-color: #fff;
  color: #212529;
  border-color: #ced4da;
}

::placeholder {
  color: #6c757d;
}

#note::placeholder {
  color: #6b7280;
  opacity: 1;
}

/* Tabelas (claro) */
.table {
  /* usa defaults do Bootstrap */
}

/* Botões de paginação (claro) */
#prev,
#next {
  background-color: #e9ecef;
  color: #212529;
  border: 1px solid #ced4da;
  min-width: 90px;
}

#prev:hover:not(:disabled),
#next:hover:not(:disabled) {
  background-color: #dee2e6;
}

#prev:disabled,
#next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Busca (claro) */
input.form-control,
input[type="date"].form-control {
  font-weight: 500;
}

/* Filtro: botão (claro) */
#formBusca button.btn {
  color: #212529;
  border-color: #ced4da;
  background-color: #f8f9fa;
}

#formBusca button.btn:hover {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

/* Navbar fixa */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Text hint */
.text-hint {
  color: rgba(0, 0, 0, .55) !important;
}

/* Espaçamento em listas dentro dos cards */
.card-body ul li+li {
  margin-top: 0.5rem;
}

/* Mobile: tabela em cards */
@media (max-width: 812px) {
  table thead {
    display: none;
  }

  table.table>tbody>tr>td {
    display: block;
    width: 100%;
    border: none !important;
    padding: 0 !important;
  }

  #tblBody {
    display: flex;
    flex-direction: column;
    gap: .5rem;
  }
}

/* Resumo e transcrição (claro) */
.resumo-text {
  line-height: 1.7;
  font-size: 0.95rem;
  color: #374151;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.resumo-text p {
  margin-bottom: .6rem;
}

.resumo-section-title {
  font-weight: 600;
  letter-spacing: .2px;
  color: #111827;
  margin: .25rem 0 .4rem;
}

.muted-sep {
  border-top: 1px dashed rgba(0, 0, 0, .15);
  margin: .75rem 0;
}

.transcricao-box {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: .9rem;
  color: #111827;
  background: rgba(0, 0, 0, .02);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: .5rem;
  padding: .75rem .9rem;
}

/* Classe opcional usada em páginas antigas */
.card-dark {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, .06);
}

/* Cronômetro */
.cronometro {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ===== Tema Escuro: só quando data-bs-theme="dark" ===== */

[data-bs-theme="dark"] {
  --bs-body-bg: #0f1115;
  --bs-body-color: #e5e7eb;
  --bs-card-bg: #161a22;
  --bs-card-border-color: rgba(255, 255, 255, .08);
  --bs-border-color: rgba(255, 255, 255, .12);
  --bs-link-color: #93c5fd;
  --bs-link-hover-color: #bfdbfe;
}

[data-bs-theme="dark"] body {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .card {
  background-color: var(--bs-card-bg);
  border-color: var(--bs-card-border-color);
}

/* Inputs no escuro */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] textarea.form-control {
  background-color: #0f1115;
  color: #e5e7eb;
  border-color: #2b303b;
}

[data-bs-theme="dark"] ::placeholder {
  color: #9ca3af;
}

/* Tabela no escuro (usa tokens Bootstrap) */
[data-bs-theme="dark"] .table {
  --bs-table-color: #e5e7eb;
  --bs-table-bg: transparent;
  --bs-table-border-color: rgba(255, 255, 255, .1);
  --bs-table-striped-bg: rgba(255, 255, 255, .03);
  --bs-table-hover-bg: rgba(255, 255, 255, .05);
}

/* Botões outline no escuro */
[data-bs-theme="dark"] .btn-outline-secondary {
  color: #e5e7eb;
  border-color: #2b303b;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
  background-color: #1c212b;
  border-color: #3a4151;
}

/* Botões de paginação (escuro) */
[data-bs-theme="dark"] #prev,
[data-bs-theme="dark"] #next {
  background-color: #343a40;
  color: #f8f9fa;
  border: 1px solid #555;
}

[data-bs-theme="dark"] #prev:hover:not(:disabled),
[data-bs-theme="dark"] #next:hover:not(:disabled) {
  background-color: #495057;
}

/* Busca (escuro) */
[data-bs-theme="dark"] input.form-control,
[data-bs-theme="dark"] input[type="date"].form-control {
  background-color: #0f1115;
  color: #e5e7eb;
  border-color: #2b303b;
}

/* Resumo/transcrição (escuro) */
[data-bs-theme="dark"] .resumo-text {
  color: #e9ecef;
}

[data-bs-theme="dark"] .resumo-section-title {
  color: #f8f9fa;
}

[data-bs-theme="dark"] .muted-sep {
  border-top: 1px dashed rgba(255, 255, 255, .15);
}

[data-bs-theme="dark"] .transcricao-box {
  color: #f1f3f5;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .08);
}

/* Compat: card-dark no escuro */
[data-bs-theme="dark"] .card-dark {
  background: #2b2f33;
  border: 1px solid rgba(255, 255, 255, .06);
}

/* Estilo antigo .btn-outline-light mantido apenas se necessário */
.btn-outline-light {
  color: inherit;
  border-color: currentColor;
}

[data-bs-theme="light"] body {
  background-color: #f8f9fa !important;
  color: #212529 !important;
}

[data-bs-theme="light"] .card {
  background-color: #ffffff !important;
  color: #212529 !important;
  border-color: rgba(0, 0, 0, .06) !important;
}

/* Centraliza e equilibra os botões Entrar / Criar conta */
.nav-pills.justify-content-center .nav-link {
  font-weight: 500;
  padding: 0.4rem 1.2rem;
  border-radius: 0.5rem;
}

.nav-pills.justify-content-center .nav-link.active {
  background-color: var(--bs-primary);
  color: #fff;
}

/* Remove espaçamento vertical excessivo no card */
.login-card .card-body {
  padding-top: 2rem !important;
  padding-bottom: 2rem !important;
}

/* Corrige espaçamento e margens */
.login-card form .btn {
  font-weight: 500;
  padding: 0.55rem;
}

/* Botões de tabs no login */
.btn-toggle .btn {
  min-width: 120px;
  font-weight: 500;
}

.btn-toggle .btn:focus {
  box-shadow: none;
}

/* Estilo do botão ativo (Bootstrap adiciona .active automaticamente) */
.btn-toggle .btn.active {
  background-color: var(--bs-primary);
  color: #fff;
  border-color: var(--bs-primary);
}

/* Corrige desalinhamento das nav-pills no topo do login */
.nav-pills.justify-content-center {
  margin-top: 1rem;
}

.nav-pills.justify-content-center .nav-link {
  border-radius: 0.5rem;
  padding: 0.45rem 1.5rem;
  font-weight: 500;
}

.nav-pills.justify-content-center .nav-link.active {
  background-color: var(--bs-primary);
  color: #fff;
}

/* Cabeçalho do login: alinhar título + tabs na mesma linha */
#pills-tab {
  margin: 0 !important;
}

/* sem margem extra */
#pills-tab .nav-link {
  line-height: 1;
  /* evita “afundar” vertical */
  padding: .45rem 1.2rem;
  /* tamanho homogêneo */
  border-radius: .5rem;
  font-weight: 500;
}

#pills-tab .nav-link.active {
  background-color: var(--bs-primary);
  color: #fff;
}

/* ===== Correções de legibilidade no DARK (index) ===== */

/* Título/lead do herói mais contrastados */
[data-bs-theme="dark"] .display-6 {
  color: #e5e7eb;
}

[data-bs-theme="dark"] .lead {
  color: #cbd5e1;
}

/* Data das notícias menos desbotada */
[data-bs-theme="dark"] #newsDate {
  color: #94a3b8 !important;
}

/* Cards de notícias: fundo escuro de alto contraste e texto claro */
[data-bs-theme="dark"] #newsRow .card,
[data-bs-theme="dark"] .bg-secondary-subtle {
  background-color: #161a22 !important;
  /* fundo do card */
  border-color: rgba(255, 255, 255, .08) !important;
  color: #e5e7eb !important;
  /* texto padrão */
}

/* Títulos dentro dos cards */
[data-bs-theme="dark"] #newsRow .card h3,
[data-bs-theme="dark"] #newsRow .card h4,
[data-bs-theme="dark"] #newsRow .card h5 {
  color: #f3f4f6 !important;
}

/* Títulos dentro dos cards */
[data-bs-theme="light"] #newsRow .card h3,
[data-bs-theme="light"] #newsRow .card h4,
[data-bs-theme="light"] #newsRow .card h5 {
  color: #050505 !important;
}

/* Links dentro dos cards: azul legível e hover mais claro */
[data-bs-theme="dark"] #newsRow .card a {
  color: #93c5fd !important;
  text-decoration: none;
}

[data-bs-theme="dark"] #newsRow .card a:hover {
  color: #bfdbfe !important;
  text-decoration: underline;
}

/* Pequeno respiro: evita texto colado nas bordas em cards renderizados via JS */
#newsRow .card {
  border-radius: .9rem;
}

#newsRow .card>* {
  padding-left: .25rem;
  padding-right: .25rem;
}

/* ===== Interações: visual neutro por tema ===== */
#interacoes .interacao-card {
  background-color: #ffffff;
  color: #212529;
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: .75rem;
  padding: .75rem .9rem;
}

#interacoes .interacao-card .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}

#interacoes .interacao-card .body {
  line-height: 1.55;
  color: #374151;
}

#interacoes .interacao-card .footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: .5rem;
}

/* Dark mode */
[data-bs-theme="dark"] #interacoes .interacao-card {
  background-color: #161a22;
  color: #e5e7eb;
  border-color: rgba(255, 255, 255, .08);
}

[data-bs-theme="dark"] #interacoes .interacao-card .body {
  color: #e5e7eb;
}

/* Badges e datas dentro do card */
#interacoes .badge {
  font-weight: 600;
}

[data-bs-theme="dark"] #interacoes .text-secondary {
  color: #94a3b8 !important;
}