/* ─── Base & Glass morphism ─────────────────────────────────────────── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

.glass-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
}

/* ─── Navigation ─────────────────────────────────────────────────────── */
.nav-blur {
  background: rgba(13, 27, 62, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.nav-blur.scrolled {
  background: rgba(13, 27, 62, 0.95);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.2s;
}

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

.nav-link.active {
  color: #ffca28;
  background: rgba(255, 202, 40, 0.1);
}

.mobile-nav-link {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s;
}

.mobile-nav-link:hover {
  color: #ffca28;
  background: rgba(255, 202, 40, 0.05);
}

/* ─── Section titles ─────────────────────────────────────────────────── */
.section-title {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(255, 202, 40, 0.2);
}

.subsection-title {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  padding-left: 0.75rem;
  border-left: 3px solid #ffca28;
}

/* ─── Hero photo background ──────────────────────────────────────────── */
.hero-photo-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 52%;
  z-index: 1;
}

.hero-photo-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(to right, #071a3a 0%, rgba(7,26,58,0.85) 30%, rgba(7,26,58,0.4) 60%, rgba(7,26,58,0.15) 100%);
}

.hero-photo-bg::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 35%;
  z-index: 2;
  background: linear-gradient(to top, #071a3a, transparent);
}

.hero-stars {
  z-index: 1;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,202,40,0.25) 1px, transparent 0),
    radial-gradient(1px 1px at 30% 70%, rgba(255,202,40,0.15) 1px, transparent 0),
    radial-gradient(1px 1px at 50% 30%, rgba(255,255,255,0.2) 1px, transparent 0),
    radial-gradient(1px 1px at 70% 80%, rgba(255,202,40,0.2) 1px, transparent 0),
    radial-gradient(1px 1px at 85% 15%, rgba(255,255,255,0.15) 1px, transparent 0),
    radial-gradient(1.5px 1.5px at 20% 50%, rgba(255,202,40,0.3) 1px, transparent 0),
    radial-gradient(1px 1px at 60% 50%, rgba(255,255,255,0.2) 1px, transparent 0);
}

.senator-badge {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  z-index: 10;
  background: rgba(7,26,58,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,202,40,0.2);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

/* ─── Emendas ────────────────────────────────────────────────────────── */
.emenda-status {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.emenda-status-pago { background: rgba(16,185,129,0.15); color: #34d399; }
.emenda-status-execucao { background: rgba(59,130,246,0.15); color: #60a5fa; }
.emenda-status-empenhado { background: rgba(255,202,40,0.15); color: #ffd54f; }
.emenda-status-default { background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.5); }

.emenda-expand-row td { padding: 0.75rem 1rem; }
.emenda-expand-row .detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}
.emenda-expand-row .detail-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.emenda-expand-row .detail-value {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

#emendas-tbody tr { cursor: pointer; transition: background 0.15s; }
#emendas-tbody tr:hover { background: rgba(255,255,255,0.03); }

.emenda-kpi-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 0.75rem;
  padding: 1rem;
  text-align: center;
}
.emenda-kpi-value {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1;
  color: #ffca28;
  margin-bottom: 0.25rem;
}
.emenda-kpi-label {
  font-size: 0.65rem;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── KPI cards ──────────────────────────────────────────────────────── */
.kpi-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 202, 40, 0.3);
}

.kpi-big {
  background: linear-gradient(135deg, rgba(255, 202, 40, 0.08), rgba(255, 255, 255, 0.04));
  border-color: rgba(255, 202, 40, 0.15);
}

.kpi-big .kpi-value {
  font-size: 2rem;
}

.kpi-value {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1;
  color: #ffca28;
  margin-bottom: 0.25rem;
  white-space: nowrap;
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Project cards ──────────────────────────────────────────────────── */
.project-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 202, 40, 0.3);
}

.project-sigla {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 202, 40, 0.15);
  color: #ffd54f;
  margin-bottom: 0.5rem;
}

.house-senado { border-left: 3px solid #3b82f6; }
.house-camara { border-left: 3px solid #10b981; }
.house-congresso { border-left: 3px solid #8b5cf6; }

.badge-house {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-senado { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-camara { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-congresso { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* ─── Filter buttons ─────────────────────────────────────────────────── */
.filter-btn {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.375rem 1rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.filter-btn.active {
  background: rgba(255, 202, 40, 0.15);
  color: #ffca28;
  border-color: rgba(255, 202, 40, 0.3);
}

/* ─── Charts ─────────────────────────────────────────────────────────── */
.chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.chart-container {
  position: relative;
  width: 100%;
  max-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-container canvas {
  max-height: 280px;
}

.chart-container-wide {
  position: relative;
  width: 100%;
  max-height: 320px;
}

.chart-container-wide canvas {
  max-height: 320px;
}

/* ─── Comissao cards ─────────────────────────────────────────────────── */
.comissao-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  padding: 1rem;
  transition: border-color 0.2s;
}

.comissao-card:hover {
  border-color: rgba(255, 202, 40, 0.2);
}

.comissao-card.inactive {
  opacity: 0.5;
}

.comissao-sigla {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 0.25rem;
  background: rgba(255, 202, 40, 0.12);
  color: #ffd54f;
}

.comissao-house-sf { border-left: 3px solid #3b82f6; }
.comissao-house-cn { border-left: 3px solid #8b5cf6; }

/* ─── Profile ────────────────────────────────────────────────────────── */
.profile-dt {
  color: rgba(255, 255, 255, 0.4);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.profile-dd {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ─── Animations ─────────────────────────────────────────────────────── */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in { animation: fade-in-up 0.4s ease-out both; }
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }
.animate-delay-6 { animation-delay: 0.6s; }
.animate-delay-7 { animation-delay: 0.7s; }

/* ─── Leaflet map overrides ───────────────────────────────────────────── */
#sp-map {
  background: #0a1628;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.leaflet-popup-content-wrapper {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.leaflet-popup-tip { background: #fff; }

.leaflet-control-zoom a {
  background: rgba(13, 27, 62, 0.9) !important;
  color: rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.leaflet-control-zoom a:hover {
  background: rgba(13, 27, 62, 1) !important;
  color: #ffca28 !important;
}

.leaflet-control-attribution {
  background: rgba(13, 27, 62, 0.7) !important;
  color: rgba(255, 255, 255, 0.3) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a { color: rgba(255, 202, 40, 0.5) !important; }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .kpi-value { font-size: 1.75rem; }
  .kpi-card { padding: 0.75rem; }
  .section-title { font-size: 1.25rem; }
  #sp-map { height: 320px !important; }
}

@media (max-width: 768px) {
  .hero-photo-bg {
    width: 100%;
    opacity: 0.25;
  }
  .senator-badge { display: none !important; }
  .chart-container { max-height: 220px; }
  .chart-container canvas { max-height: 220px; }
  .chart-container-wide { max-height: 250px; }
  .chart-container-wide canvas { max-height: 250px; }
}
