/* ============ Temas ProAC-Bolsas (identidade UENF) ============ */
:root,
[data-theme="light"] {
  --bg-page: #F5F7FB;
  --surface: #FFFFFF;
  --surface-hover: #EEEDF7;

  --primary: #1D3770;
  --primary-hover: #3B3A86;
  --secondary: #3B3A86;
  --accent: #F7941D;

  --text-strong: #111827;
  --text-body: #4B5563;
  --text-muted: #6B7280;

  --border: #E5E7EB;
  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --badge-bg: #EEEDF7;
  --badge-text: #3B3A86;
}

[data-theme="dark"] {
  --bg-page: #0B1120;
  --surface: #121B2E;
  --surface-hover: #1C2740;

  --primary: #5B82D6;
  --primary-hover: #7A99E0;
  --secondary: #9AA3E5;
  --accent: #F7941D;

  --text-strong: #E2E8F0;
  --text-body: #CBD5E1;
  --text-muted: #94A3B8;

  --border: #26334D;
  --danger: #F87171;
  --danger-hover: #FCA5A5;
  --badge-bg: #232F4D;
  --badge-text: #A5B4FC;
}

body {
  background-color: var(--bg-page);
  color: var(--text-body);
}

/* superfícies */
.card        { background-color: var(--surface); border-color: var(--border); }
.row-hover:hover { background-color: var(--surface-hover); }

/* texto */
.text-heading { color: var(--text-strong); }
.text-body    { color: var(--text-body); }
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--secondary); }

/* ações */
.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); }
.link-nav { color: var(--primary); }
.link-nav:hover { color: var(--secondary); }
.link-danger { color: var(--danger); }
.link-danger:hover { color: var(--danger-hover); }

/* formulários */
.input-field { background-color: var(--surface); border: 1px solid var(--border); color: var(--text-strong); }
.input-field:focus { border-color: var(--primary); outline: 2px solid color-mix(in srgb, var(--primary) 30%, transparent); }

/* tabelas e badges */
.table-header { color: var(--primary); border-color: var(--border); }
.badge-role { background-color: var(--badge-bg); color: var(--badge-text); }

/* acentos */
.accent-bar { border-left-color: var(--accent); }

/* ============ Navbar ============ */
.navbar {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.navbar-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  flex-wrap: wrap;
}
.nav-link {
  color: var(--text-body);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
}
.nav-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.theme-btn {
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--text-body);
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
}
.theme-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.nav-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 0;
}

/* ============ Paginação (Pagy) ============ */
.pagy {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.pagy > * {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-body);
  border-radius: 0.375rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.875rem;
  text-decoration: none;
}
.pagy > a:hover {
  color: var(--primary);
  border-color: var(--primary);
}
.pagy .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagy .gap {
  border: none;
  background: none;
  color: var(--text-muted);
}

/* ============ Ícones ============ */
.icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ============ Botão Nova Modalidade ============ */
.btn-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.22);
}

/* ============ Layout padrão (listagem) ============ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; gap: 1rem; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--heading, inherit); }
.notice { margin-bottom: 1rem; padding: 0.75rem 1rem; background: #ecfdf5; color: #047857; border-left: 4px solid #10b981; border-radius: 0.375rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th { text-align: left; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted, #6b7280); border-bottom: 1px solid var(--border, #e5e7eb); }
.table th.th-actions { text-align: right; }
.table td { padding: 0.875rem 1rem; border-bottom: 1px solid var(--border, #e5e7eb); color: var(--body, #374151); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-alt, rgba(0,0,0,0.03)); }
.table tbody tr.inactive { opacity: 0.5; }

.badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 9999px; background: currentColor; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }

.actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.action-btn { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 0.375rem; color: var(--body, #374151); transition: background 0.15s, color 0.15s; }
.action-btn:hover { background: rgba(0,0,0,0.06); }
.action-btn-edit:hover { color: #2563eb; }
.action-btn-delete:hover { color: #dc2626; background: #fef2f2; }

.empty-state { padding: 2.5rem; text-align: center; }
.empty-title { font-size: 1.125rem; font-weight: 600; color: var(--heading, inherit); margin-bottom: 0.25rem; }
.empty-text { font-size: 0.875rem; color: var(--muted, #6b7280); margin-bottom: 1rem; }

/* ============ Botões ============ */
.btn-primary, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-secondary { padding: 0.625rem 1rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; background: transparent; border: 1px solid var(--border, #d1d5db); color: var(--body, #374151); cursor: pointer; transition: background 0.15s; }
.btn-secondary:hover { background: rgba(0,0,0,0.06); }

/* ============ Formulário ============ */
.page-form { max-width: 32rem; margin: 0 auto; padding: 1.5rem; }
.page-title-form { margin-bottom: 1.5rem; }
.form-card { padding: 1.5rem; }
.form-field { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; color: var(--body, #374151); }
.form-hint { font-size: 0.75rem; color: var(--muted, #6b7280); margin-top: 0.25rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-checkbox { width: 1rem; height: 1rem; accent-color: var(--primary, #1d4ed8); }
.form-label-inline { font-size: 0.875rem; color: var(--body, #374151); }
.form-errors { margin-bottom: 1rem; padding: 0.75rem 1rem; background: #fef2f2; color: #b91c1c; border-left: 4px solid #ef4444; border-radius: 0.375rem; font-size: 0.875rem; }
.form-errors h2 { font-weight: 600; margin-bottom: 0.25rem; }
.form-errors ul { list-style: disc; margin-left: 1.25rem; }
.form-footer { display: flex; gap: 0.75rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border, #e5e7eb); }
.form-footer .btn-primary { flex: 1; }
.form-footer .btn-secondary { flex: 1; }

/* ============ Correção de contraste (herda a cor do tema) ============ */
.table td,
.table th,
.action-btn,
.form-label,
.btn-secondary,
.empty-text,
.form-hint {
  color: inherit;
}
.table th {
  opacity: 0.75;
}

/* ============ Badge de Perfil (Usuários) ============ */
.badge-role { background: #dbeafe; color: #1d4ed8; }

/* Botão "novo" à direita, com respiro da borda */
.page-header { padding-right: 1.5rem; }

/* ============ Botão primário aprimorado ============ */
.btn-primary {
  border-radius: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}
.btn-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.06);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ============ Navbar: cores padronizadas com o tema ============ */
.nav-logout,
.link-danger {
  color: inherit;
}
.nav-logout:hover,
.link-danger:hover {
  color: inherit;
  opacity: 0.75;
}

/* ============ Navbar: identificação do usuário ============ */
.navbar-user {
  color: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.9;
}

/* ============ Badges de Perfil por cor (Usuários) ============ */
.badge-role-admin { background: #dbeafe; color: #1d4ed8; }
.badge-role-gestor { background: #dcfce7; color: #15803d; }
.badge-role-auxiliar { background: #fef3c7; color: #b45309; }

/* ============ Estados de situação: cores distintas dos tipos de usuário ============ */
.badge-active { background: #cffafe; color: #0e7490; }
.badge-inactive { background: #e5e7eb; color: #4b5563; }

/* ============ Estados de situação: preenchimento sólido (distinto dos perfis) ============ */
.badge-active { background: #16a34a; color: #ffffff; }
.badge-inactive { background: #6b7280; color: #ffffff; }

/* ============ Ações: ícones coloridos ============ */
.action-btn-edit { color: #2563eb; }
.action-btn-delete { color: #dc2626; }
.action-btn-edit:hover { background: #eff6ff; }
.action-btn-delete:hover { background: #fef2f2; }

/* ============ Labels: herdam a cor do tema (contraste correto) ============ */
.form-label,
.form-label-inline {
  color: inherit;
}

/* ============ Labels distintos do texto digitado ============ */
.form-label,
.form-label-inline {
  color: var(--muted, #94a3b8);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ============ Campos isolados do rótulo (fundo + borda) ============ */
.input-field {
  background: var(--surface-alt, rgba(0, 0, 0, 0.06));
  border: 1px solid var(--border, #334155);
  color: inherit;
}
.input-field:focus {
  border-color: var(--primary, #3b82f6);
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ============ Inputs: borda mais visível ============ */
.input-field {
  border: 1.5px solid #64748b;
}
.input-field:hover {
  border-color: #94a3b8;
}
.input-field:focus {
  border-color: var(--primary, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ============ Inputs: foco em azul vibrante ============ */
.input-field:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.35);
}

/* ============ Divisor de formulário ============ */
.form-divider { border: none; border-top: 1px solid var(--border, #334155); margin: 1rem 0; }
