/* ========== RESULTS PAGE — Dashboard ========== */
.results-page {
  background: #f1f5f9;
  min-height: 100vh;
}

/* ---------- TOPBAR ---------- */
.topbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: white;
  padding: 1.25rem 0 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
  background: rgba(255,255,255,0.1);
  padding: 4px;
}

.brand-text h1 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand-text p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 2px;
}

.stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-box {
  text-align: right;
  padding-right: 0.5rem;
}

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: #4ade80;
}

.stat-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-refresh {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #cbd5e1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-refresh:hover {
  background: rgba(255,255,255,0.15);
  color: white;
  transform: rotate(90deg);
}

.btn-refresh.spinning svg {
  animation: spin 0.6s ease;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.topbar-update {
  max-width: 1000px;
  margin: 0.75rem auto 0;
  padding: 0.5rem 1.5rem 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  50% { opacity: 0.6; box-shadow: 0 0 0 4px rgba(74,222,128,0); }
}

/* ---------- CONTAINER ---------- */
.results-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.5rem;
}

.loading {
  text-align: center;
  padding: 4rem 1rem;
  color: #64748b;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- GRID DE CARDS ---------- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 1.25rem;
}

@media (max-width: 520px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- CARD DE CARGO ---------- */
.cargo-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
  overflow: hidden;
  animation: fadeUp 0.5s ease backwards;
}

.cargo-card:nth-child(1) { animation-delay: 0.05s; }
.cargo-card:nth-child(2) { animation-delay: 0.1s; }
.cargo-card:nth-child(3) { animation-delay: 0.15s; }
.cargo-card:nth-child(4) { animation-delay: 0.2s; }
.cargo-card:nth-child(5) { animation-delay: 0.25s; }
.cargo-card:nth-child(6) { animation-delay: 0.3s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.cargo-header {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(to right, #f8fafc, white);
}

.cargo-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cargo-badge svg {
  width: 20px;
  height: 20px;
}

.cargo-badge.pres { background: #dbeafe; color: #1d4ed8; }
.cargo-badge.gov  { background: #dcfce7; color: #15803d; }
.cargo-badge.fed  { background: #fef3c7; color: #b45309; }
.cargo-badge.est  { background: #fce7f3; color: #be185d; }
.cargo-badge.pref { background: #e0e7ff; color: #4338ca; }
.cargo-badge.ver  { background: #f3e8ff; color: #7e22ce; }

.cargo-info {
  flex: 1;
  min-width: 0;
}

.cargo-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.cargo-sub {
  font-size: 0.75rem;
  color: #64748b;
}

.cargo-votes {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  white-space: nowrap;
}

.cargo-body {
  padding: 1rem 1.25rem 1.25rem;
}

/* ---------- CANDIDATO ---------- */
.candidate {
  margin-bottom: 0.9rem;
}

.candidate:last-child {
  margin-bottom: 0;
}

.candidate-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.rank {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.candidate.pos-1 .rank {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: white;
  box-shadow: 0 2px 6px rgba(245,158,11,0.35);
}

.candidate.pos-2 .rank {
  background: linear-gradient(135deg, #94a3b8, #cbd5e1);
  color: white;
}

.candidate.pos-3 .rank {
  background: linear-gradient(135deg, #b45309, #d97706);
  color: white;
}

.candidate-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.candidate.pos-1 .candidate-name {
  color: #0f172a;
  font-weight: 700;
}

.candidate-stats {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  flex-shrink: 0;
}

.candidate-count {
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f172a;
}

.candidate-pct {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

/* ---------- BARRA ---------- */
.bar-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
  margin-left: 30px;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #93c5fd, #3b82f6);
  width: 0;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.candidate.pos-1 .bar-fill {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

/* ---------- SEM VOTOS ---------- */
.no-votes {
  text-align: center;
  padding: 4rem 2rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.no-votes-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.no-votes h3 {
  font-size: 1.25rem;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.no-votes p {
  color: #64748b;
  font-size: 0.9rem;
}

/* ---------- FOOTER ---------- */
.results-footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  color: #64748b;
  font-size: 0.8rem;
}

.btn-footer {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  background: #0f172a;
  color: white;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  transition: all 0.2s;
}

.btn-footer:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

/* ---------- MOBILE ---------- */
@media (max-width: 600px) {
  .topbar-inner { padding: 0 1rem; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-text h1 { font-size: 1.05rem; }
  .brand-text p { font-size: 0.7rem; }
  .stat-number { font-size: 1.3rem; }
  .results-container { padding: 1rem; }
  .results-footer { padding: 1.5rem 1rem 2.5rem; }
}
