* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
  padding-top: 70px;
}

/* Header styles */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: white;
  border-bottom: 2px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  z-index: 1000;
}

.header-container {
  max-width: 768px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.header-title a {
  color: #1a1a1a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.header-title a:hover {
  color: #2563eb;
}

.header-nav {
  display: flex;
  gap: 1rem;
}

.nav-link {
  color: #666;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.nav-link:hover {
  background: #f3f4f6;
  color: #2563eb;
}

.container {
  max-width: 100%;
  padding: 1rem;
  margin: 0 auto;
}

.title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
  text-align: center;
}

.subtitle {
  font-size: 1rem;
  color: #666;
  margin-bottom: 1.5rem;
  text-align: center;
}

.regions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.region-button {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

.region-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border-color: #2563eb;
}

.region-button:active {
  transform: translateY(0);
}

.region-button.expandable {
  cursor: pointer;
}

.region-button.expandable.active {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: #2563eb;
}

.region-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 0.5rem;
}

.region-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #666;
}

.distrito {
  font-weight: 500;
}

.cupos {
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.8rem;
}

.arrow {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  color: #666;
  transition: transform 0.2s ease;
}

.region-expandable {
  display: flex;
  flex-direction: column;
}

.distritos-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: white;
  border: 1px solid #e0e0e0;
  border-top: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
}

.distritos-content.expanded {
  max-height: 2000px;
  padding: 0.5rem;
}

.distrito-button {
  display: block;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.875rem;
  margin: 0.5rem 0;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

.distrito-button:hover {
  background: #f3f4f6;
  border-color: #2563eb;
  transform: translateX(4px);
}

.distrito-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.distrito-nombre {
  font-weight: 600;
  color: #1a1a1a;
  font-size: 0.95rem;
}

.distrito-cupos {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
}

.distrito-comunas {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.5;
}

/* Tablet and up */
@media (min-width: 768px) {
  .container {
    max-width: 640px;
    padding: 2rem 1rem;
  }

  .title {
    font-size: 2.25rem;
  }

  .subtitle {
    font-size: 1.125rem;
  }

  .regions-list {
    gap: 1rem;
  }

  .region-button {
    padding: 1.25rem;
  }

  .region-name {
    font-size: 1.125rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    max-width: 768px;
  }
}

/* Candidatos page styles */
.back-link {
  margin-bottom: 1rem;
}

.back-link a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.back-link a:hover {
  text-decoration: underline;
}

.distrito-info {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.distrito-info p {
  margin: 0.5rem 0;
  color: #666;
}

.cupos-info {
  font-weight: 600;
  color: #2563eb;
  margin-top: 0.75rem;
}

.partidos-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.partido-section {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1.25rem;
}

.lista-nombre {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e0e0e0;
}

.candidatos-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.candidato-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.875rem;
  transition: all 0.2s ease;
}

.candidato-card:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.candidato-nombre {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.375rem 0;
}

.partido-individual {
  font-size: 0.875rem;
  color: #666;
  margin: 0;
}

.candidato-stats {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: #2563eb;
  font-weight: 500;
}

.deputy-history {
  font-size: 0.8rem;
  color: #059669;
  font-weight: 500;
  margin: 0 0 0.25rem 0;
  line-height: 1.4;
}

.attendance-info {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: white;
  border-radius: 6px;
  border: 1px solid #e0e0e0;
}

.attendance-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 0.5rem 0;
}

.attendance-period {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0;
  font-size: 0.75rem;
}

.period-label {
  color: #666;
  font-weight: 500;
  min-width: 70px;
}

.period-percentage {
  color: #2563eb;
  font-weight: 700;
  font-size: 0.875rem;
}

.period-details {
  color: #999;
  font-size: 0.7rem;
}

@media (min-width: 768px) {
  .partido-section {
    padding: 1.5rem;
  }

  .candidatos-list {
    gap: 1rem;
  }

  .candidato-card {
    padding: 1rem;
  }

  .distrito-button {
    padding: 1rem;
  }

  .distrito-nombre {
    font-size: 1rem;
  }
}

/* Statistics/Rankings page styles */
.filters-container {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.filters-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  margin: 0 0 1rem 0;
}

.filter-group {
  margin-bottom: 1rem;
}

.filter-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #666;
  margin-bottom: 0.5rem;
}

.filter-select {
  width: 100%;
  padding: 0.5rem;
  font-size: 0.875rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: white;
  color: #333;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-select:hover {
  border-color: #2563eb;
}

.filter-select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stats-ranking {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #2563eb;
}

.ranking-badge {
  background: #2563eb;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 50%;
  font-size: 0.75rem;
  min-width: 28px;
  text-align: center;
  font-weight: 700;
}

.period-absences {
  color: #dc2626;
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 0.25rem;
}

@media (min-width: 768px) {
  .filters-container {
    padding: 1.5rem;
  }

  .filter-group {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
  }

  .filter-group > div {
    flex: 1;
  }
}

.district-info-stats {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  flex-wrap: wrap;
}

.distrito-label,
.region-label {
  background: #f3f4f6;
  color: #666;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

/* ============================================ */
/* VOTING STATS STYLES */
/* ============================================ */

.voting-section,
.featured-projects-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid #e5e7eb;
}

/* Voting Stats Component */
.voting-stats {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.voting-stats-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
}

.voting-summary {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  border-left: 4px solid #3b82f6;
}

.voting-summary-text {
  font-size: 1rem;
  color: #374151;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.voting-trend,
.voting-consistency {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.trend-label,
.consistency-label {
  font-weight: 600;
  color: #6b7280;
}

.trend-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trend-green {
  background: #d1fae5;
  color: #065f46;
}

.trend-lightgreen {
  background: #d9f99d;
  color: #365314;
}

.trend-yellow {
  background: #fef3c7;
  color: #92400e;
}

.trend-red {
  background: #fee2e2;
  color: #991b1b;
}

.trend-gray {
  background: #f3f4f6;
  color: #4b5563;
}

.consistency-value {
  font-weight: 700;
  color: #1f2937;
}

/* General Stats */
.voting-general-stats {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.general-stats-title {
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.vote-distribution {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vote-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.vote-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.vote-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.vote-bar {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.vote-bar-fill {
  height: 100%;
  transition: width 0.3s ease;
  border-radius: 4px;
}

.vote-bar-favor {
  background: linear-gradient(90deg, #10b981, #059669);
}

.vote-bar-contra {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.vote-bar-abstencion {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* Period Stats */
.voting-by-period {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.period-stats-title {
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.voting-period {
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.voting-period:last-child {
  margin-bottom: 0;
}

.period-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.period-label {
  font-weight: 700;
  color: #1f2937;
  font-size: 0.875rem;
}

.period-total {
  font-size: 0.75rem;
  color: #6b7280;
}

.period-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.period-favor {
  color: #059669;
  font-weight: 600;
}

.period-contra {
  color: #dc2626;
  font-weight: 600;
}

.period-percentage {
  font-weight: 700;
  color: #1f2937;
}

.period-bar {
  width: 100%;
  height: 6px;
  background: #fee2e2;
  border-radius: 3px;
  overflow: hidden;
}

.period-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Matter Stats */
.voting-by-matter {
  background: white;
  padding: 1rem;
  border-radius: 6px;
}

.matter-stats-title {
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.matter-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.matter-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.matter-name {
  flex: 1;
  font-weight: 600;
  color: #1f2937;
  font-size: 0.875rem;
  min-width: 150px;
}

.matter-count {
  font-size: 0.75rem;
  color: #6b7280;
}

.matter-percentage {
  font-weight: 700;
  color: #059669;
  font-size: 0.875rem;
}

/* ============================================ */
/* FEATURED PROJECTS STYLES */
/* ============================================ */

.proyectos-destacados {
  background: #f9fafb;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.proyectos-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
}

.proyectos-summary {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  border-left: 4px solid #8b5cf6;
  font-size: 0.875rem;
  color: #4b5563;
}

.proyectos-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.relevance-filter {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  color: #1f2937;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.relevance-filter:hover {
  border-color: #9ca3af;
}

.relevance-filter:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.no-projects {
  text-align: center;
  padding: 2rem;
  color: #9ca3af;
  font-style: italic;
}

.proyectos-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.proyecto-item {
  background: white;
  padding: 1.25rem;
  border-radius: 8px;
  border-left: 4px solid #e5e7eb;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.proyecto-item:hover {
  border-left-color: #3b82f6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.proyecto-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.relevance-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.625rem;
  letter-spacing: 0.5px;
}

.badge-red {
  background: #fee2e2;
  color: #991b1b;
}

.badge-orange {
  background: #fed7aa;
  color: #9a3412;
}

.badge-gray {
  background: #f3f4f6;
  color: #4b5563;
}

.proyecto-boletin {
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 600;
}

.proyecto-date {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-left: auto;
}

.proyecto-titulo {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.proyecto-materia {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.75rem;
}

.proyecto-vote-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}

.vote-label,
.resultado-label {
  font-weight: 600;
  color: #6b7280;
}

.vote-badge,
.resultado-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.75rem;
}

.vote-green {
  background: #d1fae5;
  color: #065f46;
}

.vote-red {
  background: #fee2e2;
  color: #991b1b;
}

.vote-yellow {
  background: #fef3c7;
  color: #92400e;
}

.vote-gray {
  background: #f3f4f6;
  color: #4b5563;
}

.resultado-aprobado {
  background: #dbeafe;
  color: #1e40af;
}

.resultado-rechazado {
  background: #fce7f3;
  color: #9f1239;
}

.proyecto-votacion-resultado {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: #6b7280;
  flex-wrap: wrap;
}

.resultado-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.resultado-favor {
  color: #059669;
  font-weight: 600;
}

.resultado-contra {
  color: #dc2626;
  font-weight: 600;
}

.resultado-abstencion {
  color: #d97706;
  font-weight: 600;
}

.show-more-button {
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 6px;
  font-weight: 600;
  color: #3b82f6;
  cursor: pointer;
  transition: all 0.2s ease;
}

.show-more-button:hover {
  background: #eff6ff;
  border-color: #3b82f6;
}

.show-more-button:active {
  transform: scale(0.98);
}

/* Metodología section */
.proyectos-metodologia {
  margin: 1rem 0;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.proyectos-metodologia details {
  cursor: pointer;
}

.proyectos-metodologia summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  padding: 0.5rem;
  border-radius: 4px;
  user-select: none;
  transition: background-color 0.2s ease;
}

.proyectos-metodologia summary:hover {
  background: #f3f4f6;
}

.proyectos-metodologia details[open] summary {
  margin-bottom: 0.75rem;
  color: #1f2937;
}

.metodologia-content {
  font-size: 0.85rem;
  color: #4b5563;
  line-height: 1.6;
  padding: 0 0.5rem;
}

.metodologia-content p {
  margin: 0.5rem 0;
}

.metodologia-content ul {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}

.metodologia-content li {
  margin: 0.5rem 0;
}

.metodologia-content strong {
  color: #1f2937;
  font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .voting-section,
  .featured-projects-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
  }

  .voting-stats,
  .proyectos-destacados {
    padding: 1rem;
  }

  .proyecto-item {
    padding: 1rem;
  }

  .period-stats,
  .proyecto-vote-info {
    font-size: 0.7rem;
  }

  .matter-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .matter-name {
    min-width: 100%;
  }
}
