/* ============================================================================
   HUB Digital — Tema "novo" (piloto)
   Camada de design tokens que sobrescreve variáveis Bootstrap.
   Ativação opt-in via kill switch: ?theme=novo (cookie hub_theme=novo).
   Default permanece o tema atual definido em views/partials/cabecalho.ejs.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Tipografia base mais legível */
  --bs-body-font-size: 15.5px;
  --bs-body-line-height: 1.6;
  --bs-body-color: #1f2937;
  --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Famílias semânticas */
  --hub-font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --hub-font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;

  /* Paleta DigitalNet (mantida — só tipografia muda) */
  --verde-primario: #16824C;
  --verde-claro: #1a9c5b;
  --verde-escuro: #106b3c;
}

/* Sai do "html font-size: 80%" do tema antigo — volta a 100% para a tipografia
   nova fazer sentido. Mantemos o zoom apenas dentro do escopo desse tema. */
html {
  font-size: 100%;
}

body {
  font-family: var(--hub-font-ui);
  font-size: var(--bs-body-font-size);
  line-height: var(--bs-body-line-height);
  color: var(--bs-body-color);
  font-weight: 400;
  font-variation-settings: 'wght' 450;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Hierarquia tipográfica mais firme */
h1, .h1 { font-size: 1.9rem;  font-weight: 700; letter-spacing: -0.5px; }
h2, .h2 { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.4px; }
h3, .h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.2px; }
h4, .h4 { font-size: 1.1rem;  font-weight: 600; }
h5, .h5 { font-size: 1rem;    font-weight: 600; }

/* Códigos, IDs, tokens, hashes — sempre monoespaçada */
code, pre, kbd, samp,
.hub-mono,
.id-monospace,
[data-hub="mono"] {
  font-family: var(--hub-font-mono);
  font-feature-settings: 'liga' 0, 'calt' 0;
}

/* Labels de formulário com peso mais claro */
.form-label,
label.form-label {
  font-weight: 500;
  color: #111827;
  margin-bottom: 0.4rem;
}

/* Inputs: hit area maior, fonte coerente */
.form-control,
.form-select {
  font-size: 0.97rem;
  padding: 0.5rem 0.75rem;
  color: var(--bs-body-color);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--verde-primario);
  box-shadow: 0 0 0 0.2rem rgba(22, 130, 76, 0.18);
}

/* Tabelas: mais ar entre linhas, cabeçalho mais firme */
.table > :not(caption) > * > * {
  padding: 0.65rem 0.75rem;
}

.table > thead > tr > th {
  font-weight: 600;
  color: #374151;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

/* Cards com sombra mais sutil e raio maior */
.card {
  border: 1px solid #eef0f3;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* Botões: peso e altura coerentes com a fonte nova */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
}

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-lg { padding: 0.7rem 1.3rem; font-size: 1.05rem; }

/* Subnav tabs: tipografia mais nítida */
.subnav-tab {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Sidebar — apenas refina a fonte; estrutura segue inalterada */
.sidebar .nav-link {
  font-size: 0.95rem;
  letter-spacing: -0.1px;
}

.sidebar-section {
  font-size: 0.72rem;
}

/* Topbar */
.topbar {
  height: 52px;
}

/* Tooltips do Bootstrap — corpo maior e mais legível */
.tooltip {
  font-family: var(--hub-font-ui);
  font-size: 0.85rem;
}

.tooltip-inner {
  max-width: 280px;
  padding: 0.55rem 0.75rem;
  background-color: #1f2937;
  border-radius: 6px;
  text-align: left;
  line-height: 1.4;
}

/* Ícone de ajuda inline (padrão dos campos com tooltip) */
.form-label .bi-info-circle,
.form-label .hub-help {
  font-size: 0.85rem;
  color: #6b7280;
  margin-left: 0.25rem;
  cursor: help;
  vertical-align: 1px;
}

.form-label .bi-info-circle:hover,
.form-label .hub-help:hover {
  color: var(--verde-primario);
}

/* Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.2px;
  padding: 0.35em 0.6em;
}

/* ==========================================================================
   Componentes globais — promovido a tema padrão em 2026-05-29.
   Refinamentos que aplicam o mesmo padrão visual do calendário em todo o
   sistema sem reescrever views.
   ========================================================================== */

/* Sidebar — ar e contraste mais suaves */
.sidebar .nav-link {
  border-radius: 0 8px 8px 0;
  margin-right: 6px;
  font-weight: 500;
}

.sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar .nav-link.active {
  background: rgba(22, 130, 76, 0.18);
  font-weight: 600;
}

.sidebar-section {
  font-size: 0.68rem;
  letter-spacing: 1.2px;
  opacity: 0.7;
}

/* Topbar */
.topbar {
  border-bottom: 1px solid #eef0f3;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.02);
}

/* Botões — coerência geral, foco visual claro */
.btn {
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.15s ease;
  box-shadow: none;
}

.btn:focus,
.btn:focus-visible {
  box-shadow: 0 0 0 0.2rem rgba(22, 130, 76, 0.18) !important;
  outline: none;
}

.btn-success,
.btn-green {
  background-color: var(--verde-primario) !important;
  border-color: var(--verde-primario) !important;
}

.btn-success:hover,
.btn-green:hover {
  background-color: var(--verde-escuro) !important;
  border-color: var(--verde-escuro) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(22, 130, 76, 0.22);
}

.btn-outline-success,
.btn-outline-green {
  color: var(--verde-primario) !important;
  border-color: var(--verde-primario) !important;
}

.btn-outline-success:hover,
.btn-outline-green:hover {
  background-color: var(--verde-primario) !important;
  color: #ffffff !important;
}

/* Inputs — visual unificado, feedback de foco coerente */
.form-control,
.form-select {
  border-radius: 8px;
  border-color: #e5e7eb;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:hover,
.form-select:hover {
  border-color: #d1d5db;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--verde-primario);
  box-shadow: 0 0 0 0.2rem rgba(22, 130, 76, 0.15);
}

.input-group-text {
  background: #f9fafb;
  border-color: #e5e7eb;
  color: #6b7280;
}

/* Cards e listas */
.card {
  border-radius: 12px;
  border: 1px solid #eef0f3;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03), 0 1px 3px rgba(16, 24, 40, 0.04);
}

.card-header {
  background: #ffffff;
  border-bottom: 1px solid #f3f4f6;
  font-weight: 600;
  padding: 0.85rem 1.1rem;
}

/* Alertas — sutis e elegantes */
.alert {
  border-radius: 10px;
  border-width: 0;
  border-left: 4px solid;
  padding: 0.9rem 1rem;
}

.alert-success  { background: #f0fdf4; border-color: #16824C; color: #14532d; }
.alert-info     { background: #eff6ff; border-color: #3b82f6; color: #1e3a8a; }
.alert-warning  { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.alert-danger   { background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }

.alert .btn-close {
  filter: opacity(0.6);
}

/* Modal — cabeçalho clean, footer sem borda */
.modal-content {
  border-radius: 14px;
  border: none;
  box-shadow: 0 24px 50px rgba(16, 24, 40, 0.2);
}

.modal-header {
  padding: 1.1rem 1.25rem;
  border-bottom-color: #f3f4f6;
}

.modal-title {
  font-weight: 600;
  letter-spacing: -0.2px;
}

/* Dropdown */
.dropdown-menu {
  border-radius: 10px;
  border: 1px solid #eef0f3;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  padding: 0.4rem;
}

.dropdown-item {
  border-radius: 6px;
  padding: 0.45rem 0.7rem;
  font-size: 0.92rem;
}

.dropdown-item:hover {
  background: rgba(22, 130, 76, 0.08);
  color: var(--verde-escuro);
}

/* Breadcrumb — bem fininho */
.breadcrumb {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.breadcrumb a {
  color: #6b7280;
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--verde-primario);
  text-decoration: underline;
}

/* Badges — coerentes com paleta */
.badge {
  border-radius: 6px;
}

.badge.bg-light {
  background: #f3f4f6 !important;
  color: #374151 !important;
  border: 1px solid #e5e7eb;
}

/* Sub-nav (cabeçalhos secundários) */
.subnav-tab {
  border-radius: 8px 8px 0 0;
  padding: 0.6rem 1.1rem;
  font-size: 0.93rem;
  font-weight: 500;
}

.subnav-tab:hover {
  background: rgba(22, 130, 76, 0.04);
}

.subnav-tab.active {
  font-weight: 600;
  border-bottom-width: 3px;
}

/* Auxiliar visual: ícone (i) que aparece ao lado de label */
.hub-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 11px;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
  border: 1px solid #e5e7eb;
  transition: all 0.15s ease;
}

.hub-help::before {
  content: 'i';
  font-style: italic;
  font-weight: 700;
  font-family: serif;
  line-height: 1;
}

.hub-help:hover {
  background: var(--verde-primario);
  color: #ffffff;
  border-color: var(--verde-primario);
}

/* Botões com tooltip nativo (atributo title) — cursor "help" sutil */
[data-bs-toggle="tooltip"] {
  cursor: help;
}
button[data-bs-toggle="tooltip"],
a[data-bs-toggle="tooltip"] {
  cursor: pointer;
}

/* Códigos e IDs */
code, kbd, samp, pre, .id-monospace, .font-monospace, .hub-mono {
  font-family: var(--hub-font-mono);
  background: #f9fafb;
  color: #1f2937;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid #f3f4f6;
}

pre code {
  background: transparent;
  padding: 0;
  border: none;
}

/* Links — ressalto sutil, mesma cor do calendário */
a {
  color: var(--verde-primario);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--verde-escuro);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* "voltar" / nav links secundários no topo das telas */
.btn-light, .btn-outline-secondary {
  border-color: #e5e7eb;
}

/* Tabelas em listas — visual de "dataset" */
.table > thead > tr > th {
  font-size: 0.78rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.table-hover tbody tr:hover > * {
  background-color: rgba(22, 130, 76, 0.04) !important;
}

/* Página/erro — coerência */
.error-icon {
  filter: drop-shadow(0 4px 12px rgba(220, 53, 69, 0.3));
}

/* Marca o body para depuração visual / inspeção rápida (mantido em dev) */
body[data-theme="novo"]::before {
  content: 'tema: novo';
  position: fixed;
  bottom: 6px;
  right: 8px;
  z-index: 9999;
  font-family: var(--hub-font-mono);
  font-size: 10px;
  color: #9ca3af;
  background: rgba(255,255,255,0.85);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #e5e7eb;
  pointer-events: none;
}
