/* ============================================================
   SIGAF - Dispenseção · camada de redesign compartilhada
   Aplicada sobre dashboard_itens_falta.css nas 4 seções.
   ============================================================ */

/* ---------- topbar: vidro, fixa, com respiro ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}
.brand-text strong {
  background: linear-gradient(92deg, var(--tx) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.01em;
}
.brand-mark img {
  filter: drop-shadow(0 2px 10px rgba(143, 198, 61, 0.25));
}
.brand-text .brand-sub {
  font-size: 9.5px;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.92;
}

/* ---------- navegação de seções (pills) ---------- */
.section-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 65%, transparent);
  position: sticky;
  /* logo abaixo da topbar; a filterbar empilha abaixo desta (ver --h-nav) */
  top: var(--h-topbar, 58px);
  z-index: 39;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.section-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--tx-2);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.18s, background 0.18s, border-color 0.18s, transform 0.12s;
}
.section-nav a:hover {
  color: var(--tx);
  background: var(--surface-2);
  transform: translateY(-1px);
}
.section-nav a.active {
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 4px 16px rgba(143, 198, 61, 0.35);
}
.section-nav a .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* ---------- barra de filtros ---------- */
.filterbar {
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 45%, transparent);
}
.chip {
  transition: transform 0.12s, box-shadow 0.18s, background 0.18s, color 0.18s;
}
.chip:hover { transform: translateY(-1px); }
.chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--on-accent);
  box-shadow: 0 3px 12px rgba(143, 198, 61, 0.3);
}
.chip.active small { color: color-mix(in srgb, var(--on-accent) 75%, transparent); }

/* ---------- cartões de métricas ---------- */
.status-strip .metric {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 88%, var(--bg)) 100%);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.status-strip .metric:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}
.status-strip .metric.accent {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: inset 0 2px 0 var(--accent), 0 6px 20px rgba(143, 198, 61, 0.08);
}
.status-strip .metric strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- painéis ---------- */
.chart-panel {
  border: 1px solid var(--line) !important;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  transition: border-color 0.2s;
}
.chart-panel:hover { border-color: var(--line-strong) !important; }
.chart-head h2 { letter-spacing: 0.01em; }

/* ---------- tabelas ---------- */
.comp-table thead th,
.ind-table thead th {
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
  backdrop-filter: blur(6px);
  font-weight: 700;
}
.comp-table tbody tr,
.ind-table tbody tr { transition: background 0.12s; }
.comp-table td, .ind-table td { font-variant-numeric: tabular-nums; }
.table-wrap { box-shadow: inset 0 0 0 1px var(--line); border: 0 !important; }

/* ---------- barras + linha de evolução ---------- */
.bars { position: relative; }
.bar-col .bar-stack { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.bar-col:hover .bar-stack { filter: brightness(1.12); }
.trend-overlay {
  position: absolute;
  inset: 18px 6px 0;
  pointer-events: none;
  z-index: 2;
}
.trend-overlay svg { width: 100%; height: 100%; overflow: visible; }
.trend-line {
  fill: none;
  stroke: var(--warn);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 6px rgba(240, 162, 75, 0.45));
}
.trend-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  border: 2px solid var(--bg);
  box-shadow: 0 1px 6px rgba(240, 162, 75, 0.5);
  transform: translate(-50%, -50%);
}
.legend .trend-key i {
  width: 16px !important;
  height: 3px !important;
  border-radius: 2px !important;
  background: var(--warn) !important;
}

/* ---------- botões ---------- */
.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  border: 0;
  box-shadow: 0 4px 14px rgba(143, 198, 61, 0.28);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.15s;
}
.primary-button:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
.primary-button:disabled { opacity: 0.45; box-shadow: none; }

/* ---------- busca ---------- */
.global-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 3px rgba(143, 198, 61, 0.12);
}

/* ---------- responsivo ---------- */
@media (max-width: 720px) {
  .section-nav { padding: 8px 12px; }
  .section-nav a { padding: 6px 12px; font-size: 12px; }
}

/* A barra de filtros grudava em top:58px com z-index 50, cobrindo por inteiro o menu
   de seções (top:57px, z-index 39) — a navegação sumia a 60px de rolagem. Agora ela
   empilha abaixo do menu e fica sob a topbar. */
:root { --h-topbar: 58px; --h-nav: 56px; }
.filterbar { top: calc(var(--h-topbar) + var(--h-nav)); z-index: 38; }
@media (max-width: 720px) { :root { --h-nav: 84px; } }

/* ============ Rodapé Institucional SES-MG ============ */
.app-footer {
  background: var(--surface);
  color: var(--tx);
  padding: 2.5rem 1.5rem 1.75rem;
  margin-top: 48px;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  line-height: 1.5;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 28px;
  padding: 0 12px;
}

.footer-col-logo {
  display: flex;
  align-items: center;
  justify-self: start;
}

.footer-logo-img {
  height: 90px;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Brasão original em traço claro; inverte apenas no tema claro */
:root[data-theme="light"] .footer-logo-img {
  filter: invert(1);
}

.footer-col-address {
  text-align: center;
  color: var(--tx-2);
  font-size: 0.85rem;
  line-height: 1.6;
  justify-self: center;
}

.footer-col-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  justify-self: end;
}

.footer-links {
  font-size: 0.825rem;
  line-height: 1.55;
  color: var(--tx-2);
}

.footer-links strong {
  color: var(--tx);
  font-size: 0.775rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-links a {
  color: var(--tx-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 4px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--tx-2);
  text-decoration: none;
  transition: all 0.15s ease;
}

.footer-social a:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  background: var(--surface-3);
  transform: translateY(-2px);
}

.footer-version {
  max-width: 1400px;
  margin: 2rem auto 0;
  padding: 1rem 12px 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-credit {
  margin: 0;
  font-size: 0.785rem;
  font-weight: 500;
  color: var(--tx-3);
  letter-spacing: 0.02em;
}

@media (max-width: 920px) {
  .footer-container {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }
  .footer-col-logo,
  .footer-col-address,
  .footer-col-info {
    justify-self: center;
    align-items: center;
    text-align: center;
  }
}
