/* ============================================================
   DataFiscal – Custom Stylesheet
   Color Palette:
     Navy:   #0d3b6e  (navbar, hero overlay)
     Blue:   #1565c0  (primary actions)
     Accent: #1976d2  (links, badges)
     Light:  #f5f7fa  (page background)
     Card:   #ffffff  (card surfaces)
============================================================ */

/* -------------------------------------------------------
   Base & Typography
------------------------------------------------------- */
:root {
  --navy:       #0d3b6e;
  --blue:       #1565c0;
  --blue-mid:   #1976d2;
  --blue-light: #e3f0ff;
  --accent:     #2196f3;
  --success:    #2e7d32;
  --danger:     #c62828;
  --text:       #1a2233;
  --text-muted: #6b7a8d;
  --bg:         #f5f7fa;
  --card-bg:    #ffffff;
  --border:     #e2e8f0;
  --shadow-sm:  0 1px 4px rgba(13,59,110,.07);
  --shadow-md:  0 4px 16px rgba(13,59,110,.10);
  --shadow-lg:  0 8px 32px rgba(13,59,110,.14);
  --radius:     12px;
  --radius-sm:  8px;
  --transition: .22s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: var(--blue-mid); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue); text-decoration: underline; }

/* -------------------------------------------------------
   Navbar
------------------------------------------------------- */
.navbar-main {
  background: linear-gradient(135deg, var(--navy) 0%, #0e4a8a 100%);
  padding: 0.6rem 0;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
  z-index: 1030;
}

/* Brand */
.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, #42a5f5 100%);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
  box-shadow: 0 2px 8px rgba(33,150,243,.35);
}
.brand-icon-sm { width: 28px; height: 28px; font-size: 0.85rem; }

.brand-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
}
.brand-accent { color: #64b5f6; }

/* Nav links */
.navbar-main .nav-link {
  color: rgba(255,255,255,.82) !important;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 6px;
  padding: 0.4rem 0.85rem !important;
  transition: all var(--transition);
}
.navbar-main .nav-link:hover,
.navbar-main .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.12);
}
.navbar-main .nav-link.active { font-weight: 600; }

/* Navbar search */
.navbar-search-group { width: 200px; }
.navbar-search-input {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: 6px 0 0 6px !important;
  font-size: 0.82rem;
}
.navbar-search-input::placeholder { color: rgba(255,255,255,.55); }
.navbar-search-input:focus {
  background: rgba(255,255,255,.18);
  border-color: rgba(255,255,255,.5);
  color: #fff;
  box-shadow: none;
}
.btn-accent {
  background: var(--accent);
  border: none; color: #fff;
  transition: background var(--transition);
}
.btn-accent:hover { background: var(--blue); color: #fff; }

/* -------------------------------------------------------
   Hero Section
------------------------------------------------------- */
.hero-section {
  position: relative;
  min-height: 300px;
  display: flex; align-items: center; justify-content: center;
  background-image: url('../img/hero_background.png');
  background-size: cover;
  background-position: center 40%;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(
    160deg,
    rgba(9,30,66,.82) 0%,
    rgba(13,59,110,.72) 50%,
    rgba(21,101,192,.62) 100%
  );
}
.hero-content { position: relative; z-index: 1; text-align: center; width: 100%; }

.hero-title {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.4);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}
.hero-title span { color: #64b5f6; }

/* Hero Search Bar */
.hero-search-wrapper {
  max-width: 620px;
  margin: 0 auto;
  position: relative;
}
.hero-search-input {
  border: none;
  border-radius: 10px 0 0 10px !important;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.2);
}
.hero-search-input:focus { box-shadow: 0 4px 24px rgba(0,0,0,.2); outline: none; }
.hero-search-btn {
  border-radius: 0 10px 10px 0 !important;
  padding: 0.85rem 1.6rem;
  font-weight: 600;
  font-size: 1rem;
  background: var(--blue-mid);
  border-color: var(--blue-mid);
}
.hero-search-btn:hover { background: var(--blue); border-color: var(--blue); }

/* Autocomplete dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  overflow: hidden;
  border: 1px solid var(--border);
  display: none;
}
.autocomplete-dropdown.show { display: block; }
.autocomplete-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  padding: 0.55rem 1rem 0.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}
.autocomplete-item:hover { background: var(--blue-light); color: var(--blue); }
.autocomplete-item i { color: var(--blue-mid); font-size: 0.9rem; }

/* -------------------------------------------------------
   Statistics Cards
------------------------------------------------------- */
.stats-section { margin-top: -24px; position: relative; z-index: 10; }

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.25rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--border);
  height: 100%;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  background: var(--blue-light);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: var(--blue-mid);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.15rem;
  line-height: 1.3;
}
.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

/* -------------------------------------------------------
   Section Headers
------------------------------------------------------- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  display: flex; align-items: center; gap: 0.5rem;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px; height: 22px;
  background: linear-gradient(180deg, var(--accent), var(--blue));
  border-radius: 2px;
}
.section-link {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--blue-mid);
  display: flex; align-items: center; gap: 0.3rem;
}
.section-link:hover { color: var(--blue); text-decoration: none; }

/* -------------------------------------------------------
   Data Cards (wraps tables, rankings, chart)
------------------------------------------------------- */
.data-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.data-card-body { padding: 1.4rem 1.5rem; }
.data-card-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
}

/* -------------------------------------------------------
   Tables
------------------------------------------------------- */
.df-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.df-table thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.df-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.df-table tbody tr:last-child { border-bottom: none; }
.df-table tbody tr:hover { background: #f8fafc; }
.df-table tbody td { padding: 0.75rem 1rem; vertical-align: middle; }

/* Person avatar in table */
.person-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.person-initials {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-mid), var(--accent));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.person-link {
  font-weight: 600;
  color: var(--blue-mid);
}
.person-link:hover { color: var(--blue); }

/* Value/amount styling */
.valor-cell {
  font-weight: 700;
  color: var(--navy);
  font-size: 0.9rem;
  white-space: nowrap;
}
.valor-cell.negative { color: var(--danger); }

/* -------------------------------------------------------
   Rankings
------------------------------------------------------- */
.ranking-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  height: 100%;
}
.ranking-card-header {
  background: linear-gradient(135deg, var(--navy) 0%, #1252a3 100%);
  color: #fff;
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.ranking-list { list-style: none; padding: 0; margin: 0; }
.ranking-item {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.ranking-item:last-child { border-bottom: none; }
.ranking-item:hover { background: var(--blue-light); }

.rank-badge {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 800;
  flex-shrink: 0;
}
.rank-badge.rank-1 { background: #ffd700; color: #7a5200; }
.rank-badge.rank-2 { background: #c0c0c0; color: #444; }
.rank-badge.rank-3 { background: #cd7f32; color: #fff; }
.rank-badge.rank-other { background: var(--blue-light); color: var(--blue); }

.ranking-name {
  font-weight: 600; font-size: 0.875rem;
  color: var(--text); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ranking-amount {
  font-size: 0.78rem; font-weight: 700;
  color: var(--blue-mid); white-space: nowrap;
}

/* -------------------------------------------------------
   Chart Section
------------------------------------------------------- */
.chart-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.5rem;
}
.chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.chart-container { position: relative; height: 260px; }
.chart-filters {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center;
}
.chart-filters label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0;
}
.chart-filters .form-select {
  font-size: 0.82rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  border-color: var(--border);
  min-width: 110px;
}

/* -------------------------------------------------------
   Transparency Info Box
------------------------------------------------------- */
.transparency-box {
  background: linear-gradient(150deg, var(--navy) 0%, #1252a3 60%);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex; flex-direction: column; justify-content: space-between;
}
.transparency-box::before {
  content: '';
  position: absolute; inset: 0;
  background-image: url('../img/hero_background.png');
  background-size: cover; background-position: center;
  opacity: 0.18;
}
.transparency-box-content { position: relative; }
.transparency-box h4 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}
.transparency-box p { font-size: 0.88rem; color: rgba(255,255,255,.85); }
.btn-transparency {
  background: #fff;
  color: var(--blue);
  font-weight: 700;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: all var(--transition);
  align-self: flex-start;
  margin-top: 1rem;
}
.btn-transparency:hover { background: var(--blue-light); color: var(--navy); }

/* -------------------------------------------------------
   Page Header (inner pages)
------------------------------------------------------- */
.page-header {
  background: linear-gradient(135deg, var(--navy) 0%, #1252a3 100%);
  color: #fff;
  padding: 2.5rem 0 2rem;
  margin-bottom: 2rem;
}
.page-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}
.page-header .breadcrumb { margin-bottom: 0.5rem; }
.page-header .breadcrumb-item,
.page-header .breadcrumb-item a {
  color: rgba(255,255,255,.7); font-size: 0.83rem;
}
.page-header .breadcrumb-item.active { color: #fff; }
.page-header .breadcrumb-item + .breadcrumb-item::before { color: rgba(255,255,255,.4); }

/* -------------------------------------------------------
   Person / Org Detail Cards
------------------------------------------------------- */
.detail-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}
.detail-card-body { padding: 1.75rem; }

.person-photo-lg {
  width: 90px; height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--blue-light);
  box-shadow: var(--shadow-sm);
}
.person-initials-lg {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-mid), var(--accent));
  color: #fff; font-size: 1.5rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid var(--blue-light);
}

.detail-name { font-size: 1.4rem; font-weight: 800; color: var(--navy); }
.detail-role { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.15rem; }
.detail-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  margin-top: 0.5rem;
}

.kpi-box {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
}
.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.03em;
}
.kpi-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; margin-top: 0.15rem; }

/* -------------------------------------------------------
   Filters Bar (Despesas & Pessoas pages)
------------------------------------------------------- */
.filters-bar {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.filters-bar .form-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.filters-bar .form-control,
.filters-bar .form-select {
  font-size: 0.875rem;
  border-radius: 8px;
  border-color: var(--border);
}
.filters-bar .form-control:focus,
.filters-bar .form-select:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(25,118,210,.12);
}

/* -------------------------------------------------------
   Badges & Tags
------------------------------------------------------- */
.badge-categoria {
  background: #e8f4fd;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  white-space: nowrap;
}
.badge-partido {
  background: #fff3e0;
  color: #e65100;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}
.badge-uf {
  background: #e8f5e9;
  color: #2e7d32;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
}
.badge-situacao-ativo  { background: #e8f5e9; color: #2e7d32; }
.badge-situacao-outro  { background: #fff8e1; color: #f57f17; }

/* -------------------------------------------------------
   Search Results
------------------------------------------------------- */
.search-result-group { margin-bottom: 2rem; }
.search-result-group-title {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--blue);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--blue-light);
}
.search-result-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.6rem;
  transition: all var(--transition);
  text-decoration: none; color: var(--text);
}
.search-result-item:hover {
  background: var(--blue-light);
  border-color: var(--accent);
  color: var(--navy); transform: translateX(3px);
}
.search-result-icon {
  width: 38px; height: 38px;
  border-radius: 10px; background: var(--blue-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-mid); font-size: 1rem; flex-shrink: 0;
}
.search-result-name { font-weight: 600; font-size: 0.9rem; }
.search-result-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }

/* -------------------------------------------------------
   Admin Area
------------------------------------------------------- */
.admin-sidebar {
  background: var(--navy);
  min-height: 100vh;
  padding: 0;
  width: 240px;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.admin-main { margin-left: 240px; }

/* -------------------------------------------------------
   Footer
------------------------------------------------------- */
.site-footer {
  background: var(--navy);
  color: rgba(255,255,255,.8);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}
.footer-brand .brand-text { font-size: 1.2rem; }
.footer-heading {
  color: #fff; font-size: 0.82rem;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; margin-bottom: 0.85rem;
}
.footer-desc { color: rgba(255,255,255,.65); font-size: 0.85rem; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 0.45rem; }
.footer-links a {
  color: rgba(255,255,255,.7);
  font-size: 0.85rem;
  transition: color var(--transition);
}
.footer-links a:hover { color: #fff; text-decoration: none; }
.footer-divider { border-color: rgba(255,255,255,.1); margin: 1.5rem 0 1rem; }
.footer-copy { color: rgba(255,255,255,.5); font-size: 0.82rem; }
.footer-copy-link { color: rgba(255,255,255,.55); font-size: 0.82rem; }
.footer-copy-link:hover { color: #fff; }

/* -------------------------------------------------------
   Utility Classes
------------------------------------------------------- */
.text-navy  { color: var(--navy) !important; }
.text-blue  { color: var(--blue-mid) !important; }
.bg-page    { background-color: var(--bg) !important; }
.fw-800     { font-weight: 800 !important; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; color: var(--border); }

/* Loading spinner */
.df-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}

/* -------------------------------------------------------
   Responsive Tweaks
------------------------------------------------------- */
@media (max-width: 991.98px) {
  .navbar-search-group { width: 100%; margin-top: 0.75rem; }
  .hero-section { min-height: 220px; }
  .hero-title { font-size: 1.4rem; }
  .stats-section { margin-top: 0; }
}
@media (max-width: 575.98px) {
  .stat-card { padding: 1rem; }
  .stat-value { font-size: 1.35rem; }
  .data-card-body { padding: 1rem; }
  .chart-filters { flex-direction: column; }
}

/* -------------------------------------------------------
   Animations
------------------------------------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up { animation: fadeInUp .4s ease both; }

.stat-card { animation: fadeInUp .35s ease both; }
.stat-card:nth-child(1) { animation-delay: .05s; }
.stat-card:nth-child(2) { animation-delay: .1s;  }
.stat-card:nth-child(3) { animation-delay: .15s; }
.stat-card:nth-child(4) { animation-delay: .2s;  }
