/* ============================================================
   CâmaraSim — Design Institucional Republicano
   Paleta: Verde bandeira + dourado + branco
   Tipografia: Playfair Display (títulos) + Source Sans 3 (corpo)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,500;0,700;0,900;1,500&family=Source+Sans+3:wght@300;400;600;700&family=IM+Fell+English:ital@0;1&display=swap');

/* === VARIÁVEIS === */
:root {
  --verde:        #1a5c2a;
  --verde-medio:  #247a38;
  --verde-claro:  #2e9e48;
  --verde-bg:     #f0f7f2;
  --dourado:      #b8962e;
  --dourado-claro:#d4b44a;
  --dourado-bg:   #fdf8ee;
  --azul-band:    #002776;
  --branco:       #ffffff;
  --creme:        #faf8f3;
  --cinza-1:      #f4f4f2;
  --cinza-2:      #e8e6e0;
  --cinza-3:      #c4c0b5;
  --cinza-4:      #8a8680;
  --cinza-5:      #4a4640;
  --preto:        #1a1814;
  --vermelho:     #c0392b;
  --vermelho-bg:  #fdf0ef;
  --sombra-sm:    0 1px 3px rgba(26,92,42,.12);
  --sombra-md:    0 4px 12px rgba(26,92,42,.15);
  --sombra-lg:    0 8px 30px rgba(26,92,42,.2);
  --radius:       6px;
  --radius-lg:    12px;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Source Sans 3', sans-serif;
  background: var(--creme);
  color: var(--preto);
  min-height: 100vh;
  line-height: 1.6;
}

/* === TOPO INSTITUCIONAL === */
.topo-brasao {
  background: linear-gradient(135deg, var(--verde) 0%, var(--azul-band) 100%);
  color: white;
  padding: 0;
  border-bottom: 3px solid var(--dourado);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--sombra-md);
}
.topo-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 64px;
}
.logo-camara {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: white;
}
.logo-brasao {
  width: 44px;
  height: 44px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--dourado);
}
.logo-texto h1 {
  font-family: 'Playfair Display', serif;
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: .03em;
}
.logo-texto span {
  font-size: .7rem;
  opacity: .75;
  font-weight: 300;
  display: block;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-principal {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.nav-principal a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
  padding: .45rem .85rem;
  border-radius: 4px;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  transition: all .2s;
  white-space: nowrap;
}
.nav-principal a:hover,
.nav-principal a.ativo {
  background: rgba(255,255,255,.15);
  color: white;
}
.nav-principal a.ativo {
  background: rgba(184,150,46,.3);
  color: var(--dourado-claro);
}

.nav-usuario {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-left: 1rem;
  border-left: 1px solid rgba(255,255,255,.2);
  margin-left: .5rem;
}
.avatar-mini {
  width: 34px; height: 34px;
  background: var(--dourado);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: var(--verde);
  flex-shrink: 0;
}
.usuario-info { font-size: .78rem; line-height: 1.2; }
.usuario-info strong { display: block; color: white; font-size: .82rem; }
.usuario-info span { color: rgba(255,255,255,.6); }

/* === LAYOUT PRINCIPAL === */
.layout-principal {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.5rem;
  min-height: calc(100vh - 52px - 60px);
}

/* === SIDEBAR === */
.sidebar {
  position: sticky;
  top: 68px;
  height: fit-content;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.card-camara {
  background: white;
  border: 1px solid var(--cinza-2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--sombra-sm);
  margin-bottom: 1rem;
}
.card-camara-header {
  background: linear-gradient(135deg, var(--verde), var(--verde-medio));
  color: white;
  padding: .75rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card-camara-header .dot {
  width: 8px; height: 8px;
  background: var(--dourado);
  border-radius: 50%;
}
.sidebar-nav { padding: .5rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .85rem;
  border-radius: var(--radius);
  color: var(--cinza-5);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 600;
  transition: all .2s;
  border: 1px solid transparent;
}
.sidebar-nav a:hover {
  background: var(--verde-bg);
  color: var(--verde);
  border-color: var(--cinza-2);
}
.sidebar-nav a.ativo {
  background: var(--verde);
  color: white;
}
.sidebar-nav a .icone { font-size: 1rem; width: 20px; text-align: center; }
.sidebar-nav .badge {
  margin-left: auto;
  background: var(--vermelho);
  color: white;
  font-size: .7rem;
  padding: .15rem .4rem;
  border-radius: 10px;
  font-weight: 700;
}

/* === CONTEÚDO PRINCIPAL === */
.conteudo { min-width: 0; }

/* === CARDS === */
.card {
  background: white;
  border: 1px solid var(--cinza-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--sombra-sm);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--cinza-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.card-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--verde);
  font-weight: 700;
}
.card-body { padding: 1.25rem; }

/* === ESTATÍSTICAS RÁPIDAS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: white;
  border: 1px solid var(--cinza-2);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--sombra-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); }
.stat-icone {
  width: 46px; height: 46px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icone.verde  { background: var(--verde-bg); }
.stat-icone.dourado { background: var(--dourado-bg); }
.stat-icone.azul   { background: #eef2ff; }
.stat-icone.roxo   { background: #f5f0ff; }
.stat-valor { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: .78rem; color: var(--cinza-4); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: .15rem; }

/* === TABELA === */
.tabela-institucional {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.tabela-institucional th {
  background: var(--cinza-1);
  color: var(--cinza-5);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--cinza-2);
}
.tabela-institucional td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--cinza-2);
  vertical-align: middle;
}
.tabela-institucional tr:last-child td { border-bottom: none; }
.tabela-institucional tr:hover td { background: var(--verde-bg); }

/* === BADGES DE STATUS === */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.badge-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-ativo     { background: #e8f5e9; color: #2e7d32; }
.badge-aprovado  { background: #e8f5e9; color: #1b5e20; }
.badge-plenario  { background: #e3f2fd; color: #1565c0; }
.badge-protocolo { background: #fff8e1; color: #f57f17; }
.badge-rejeitado { background: #ffebee; color: #c62828; }
.badge-encerrada { background: var(--cinza-1); color: var(--cinza-4); }
.badge-andamento { background: #e3f2fd; color: #1565c0; }
.badge-suspenso  { background: #fff3e0; color: #e65100; }

/* === BOTÕES === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1.25rem;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  text-decoration: none;
  font-family: 'Source Sans 3', sans-serif;
  white-space: nowrap;
}
.btn-primario {
  background: var(--verde);
  color: white;
  border-color: var(--verde);
}
.btn-primario:hover {
  background: var(--verde-medio);
  border-color: var(--verde-medio);
  transform: translateY(-1px);
}
.btn-dourado {
  background: var(--dourado);
  color: white;
  border-color: var(--dourado);
}
.btn-dourado:hover { background: #9a7c24; border-color: #9a7c24; }
.btn-outline {
  background: transparent;
  color: var(--verde);
  border-color: var(--verde);
}
.btn-outline:hover { background: var(--verde-bg); }
.btn-perigo {
  background: var(--vermelho);
  color: white;
  border-color: var(--vermelho);
}
.btn-perigo:hover { background: #a93226; }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.75rem; font-size: 1rem; }

/* === FORMULÁRIOS === */
.form-grupo { margin-bottom: 1.1rem; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--cinza-5);
  margin-bottom: .4rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-control {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid var(--cinza-2);
  border-radius: var(--radius);
  font-family: 'Source Sans 3', sans-serif;
  font-size: .9rem;
  color: var(--preto);
  background: white;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(26,92,42,.12);
}
.form-control::placeholder { color: var(--cinza-3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* === PLENÁRIO / VOTAÇÃO === */
.votacao-card {
  border: 2px solid var(--dourado);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.votacao-header {
  background: linear-gradient(135deg, var(--azul-band), #003d99);
  color: white;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.votacao-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
}
.urgente-tag {
  background: var(--vermelho);
  color: white;
  padding: .2rem .6rem;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  animation: pulsar 1.5s infinite;
}
@keyframes pulsar {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

.barra-votos {
  margin: 1rem 0;
}
.barra-votos-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .35rem;
}
.barra-favor   { color: var(--verde); }
.barra-contra  { color: var(--vermelho); }
.barra-visual {
  height: 14px;
  border-radius: 7px;
  background: var(--cinza-2);
  overflow: hidden;
  display: flex;
}
.barra-segmento-favor  { background: var(--verde-claro); transition: width .5s; }
.barra-segmento-contra { background: var(--vermelho); transition: width .5s; }
.barra-segmento-abs    { background: var(--cinza-3); transition: width .5s; }

.botoes-voto {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .75rem;
  margin-top: 1rem;
}
.btn-voto {
  padding: .85rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid;
  transition: all .2s;
  text-align: center;
}
.btn-voto-favor     { background: var(--verde-bg); color: var(--verde); border-color: var(--verde); }
.btn-voto-contra    { background: var(--vermelho-bg); color: var(--vermelho); border-color: var(--vermelho); }
.btn-voto-abstencao { background: var(--cinza-1); color: var(--cinza-4); border-color: var(--cinza-3); }
.btn-voto:hover { transform: translateY(-2px); box-shadow: var(--sombra-md); filter: brightness(.95); }

/* === MANDATO / TIMER === */
.mandato-bar {
  background: white;
  border: 1px solid var(--cinza-2);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
}
.mandato-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: .78rem;
  margin-bottom: .4rem;
}
.mandato-progress {
  height: 8px;
  border-radius: 4px;
  background: var(--cinza-2);
  overflow: hidden;
}
.mandato-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--verde), var(--dourado));
  border-radius: 4px;
  transition: width 1s;
}

/* === ALERTA DE INATIVIDADE === */
.alerta-inatividade {
  background: linear-gradient(135deg, #7f1d1d, var(--vermelho));
  color: white;
  padding: .75rem 1.25rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
  font-size: .875rem;
  animation: pulsar 2s infinite;
}

/* === PAGINAÇÃO === */
.paginacao {
  display: flex;
  gap: .35rem;
  justify-content: center;
  padding: 1rem 0 0;
  flex-wrap: wrap;
}
.paginacao a, .paginacao span {
  padding: .4rem .75rem;
  border-radius: var(--radius);
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--verde);
  border: 1px solid var(--cinza-2);
  transition: all .15s;
}
.paginacao a:hover { background: var(--verde-bg); }
.paginacao .atual { background: var(--verde); color: white; border-color: var(--verde); }

/* === ALERTAS === */
.alerta {
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .875rem;
  font-weight: 600;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alerta-sucesso { background: #e8f5e9; color: #1b5e20; border-left: 4px solid var(--verde); }
.alerta-erro    { background: #ffebee; color: #b71c1c; border-left: 4px solid var(--vermelho); }
.alerta-aviso   { background: #fffde7; color: #f57f17; border-left: 4px solid #fbc02d; }
.alerta-info    { background: #e3f2fd; color: #0d47a1; border-left: 4px solid #1976d2; }

/* === CHAT / TRIBUNA === */
.tribuna-mensagens {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.mensagem-tribuna {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.mensagem-tribuna .avatar {
  width: 36px; height: 36px;
  background: var(--verde);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
}
.mensagem-tribuna .bubble {
  background: var(--cinza-1);
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
  padding: .65rem .9rem;
  max-width: 80%;
}
.mensagem-tribuna .bubble .autor {
  font-size: .75rem;
  font-weight: 700;
  color: var(--verde);
  margin-bottom: .2rem;
}
.mensagem-tribuna .bubble .texto { font-size: .875rem; }
.mensagem-tribuna .bubble .hora  { font-size: .7rem; color: var(--cinza-3); margin-top: .25rem; text-align: right; }
.mensagem-tribuna.propria .bubble {
  background: var(--verde-bg);
  border-radius: var(--radius-lg) 0 var(--radius-lg) var(--radius-lg);
}
.mensagem-tribuna.propria { flex-direction: row-reverse; }

/* === BUSCA DE MUNICÍPIO === */
.busca-municipio {
  position: relative;
}
.busca-municipio .resultados {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: white;
  border: 1px solid var(--cinza-2);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--sombra-md);
  display: none;
}
.busca-municipio .resultados.aberto { display: block; }
.busca-municipio .resultado-item {
  padding: .6rem 1rem;
  cursor: pointer;
  font-size: .875rem;
  border-bottom: 1px solid var(--cinza-1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.busca-municipio .resultado-item:hover { background: var(--verde-bg); }
.busca-municipio .resultado-item .estado { font-size: .75rem; color: var(--cinza-4); }
.busca-municipio .resultado-item .vagas  { font-size: .75rem; }
.vagas-ok    { color: var(--verde); font-weight: 700; }
.vagas-cheio { color: var(--vermelho); }

/* === PÁGINA PÚBLICA === */
.mapa-brasil {
  background: linear-gradient(160deg, var(--verde) 0%, var(--azul-band) 100%);
  color: white;
  padding: 4rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.mapa-brasil::before {
  content: '🇧🇷';
  position: absolute;
  font-size: 20rem;
  opacity: .04;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.mapa-brasil h1 {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: .5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,.3);
}
.mapa-brasil p {
  font-size: 1.15rem;
  opacity: .85;
  max-width: 600px;
  margin: 0 auto 2rem;
}
.mapa-brasil .contadores {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
  margin-top: 2.5rem;
}
.mapa-brasil .contador-item h3 {
  font-family: 'Playfair Display', serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--dourado-claro);
}
.mapa-brasil .contador-item p {
  font-size: .85rem;
  opacity: .75;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* === LOGIN === */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--verde) 0%, var(--azul-band) 100%);
  padding: 2rem;
}
.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-card .brasao {
  text-align: center;
  margin-bottom: 1.5rem;
}
.login-card .brasao .icone {
  font-size: 3rem;
  display: block;
  margin-bottom: .5rem;
}
.login-card .brasao h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  color: var(--verde);
  font-weight: 700;
}
.login-card .brasao p {
  font-size: .82rem;
  color: var(--cinza-4);
}

/* === RESPONSIVO === */
@media (max-width: 900px) {
  .layout-principal { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .topo-inner { padding: 0 1rem; }
  .nav-principal { display: none; }
  .mapa-brasil h1 { font-size: 2rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .botoes-voto { grid-template-columns: 1fr; }
}

/* === ANIMAÇÕES === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .35s ease forwards; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cinza-1); }
::-webkit-scrollbar-thumb { background: var(--cinza-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--verde); }

/* === FOOTER === */
.footer-institucional {
  background: var(--preto);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 1.25rem;
  font-size: .78rem;
  margin-top: 2rem;
}
.footer-institucional strong { color: var(--dourado-claro); }
