* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f5f5;
  color: #333;
}

/* Header */
.header-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content h1 {
  font-size: 1.5rem;
}

.header-nav {
  display: flex;
  gap: 1rem;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1.5rem;
  border-radius: 6px;
  transition: all 0.3s;
  background: rgba(255,255,255,0.1);
}

.nav-link:hover {
  background: rgba(255,255,255,0.2);
}

.nav-link.active {
  background: rgba(255,255,255,0.3);
  font-weight: bold;
}

/* Vote Status Banner */
.vote-status-banner {
  background: #2ecc71;
  color: white;
  padding: 1rem;
  text-align: center;
  font-weight: bold;
}

.vote-status-banner.already-voted {
  background: #3498db;
}

/* Voting Container */
.voting-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
}

.voting-header {
  text-align: center;
  margin-bottom: 2rem;
}

.voting-header h2 {
  color: #667eea;
  margin-bottom: 0.5rem;
}

.voting-header p {
  color: #666;
}

/* Map Legend */
.map-legend {
  margin-top: 1rem;
  padding: 1rem;
  background: #f9f9f9;
  border-radius: 0 0 12px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.map-legend strong {
  font-size: 1.1rem;
  color: #667eea;
  width: 100%;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
}

.legend-color {
  width: 40px;
  height: 25px;
  border-radius: 6px;
  border: 2px solid #ccc;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s;
}

.modal.show {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: white;
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.3s;
}

.modal-large {
  max-width: 900px;
}

@keyframes slideUp {
  from { transform: translateY(50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 2px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2,
.modal-header h3 {
  color: #667eea;
  margin: 0;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 2px solid #f0f0f0;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.btn-close {
  background: #ff4757;
  color: white;
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.btn-close:hover {
  background: #ff3838;
  transform: rotate(90deg);
}

/* Candidates Grid */
.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.candidate-card {
  border: 3px solid #e0e0e0;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: white;
}

.candidate-card:hover {
  border-color: #667eea;
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
  transform: translateY(-5px);
}

.candidate-card.voted {
  border-color: #2ecc71;
  background: #f0fff4;
  cursor: default;
}

.candidate-card.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.candidate-card.disabled:hover {
  transform: none;
  box-shadow: none;
}

.candidate-number {
  font-size: 3rem;
  font-weight: bold;
  color: white;
  width: 80px;
  height: 80px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.candidate-name {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #333;
}

.candidate-party {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.voted-badge {
  background: #2ecc71;
  color: white;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  display: inline-block;
  margin-top: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.8rem 1.8rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

/* Results Page */
.stats-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  font-size: 3rem;
}

.stat-label {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 0.3rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #667eea;
}

.results-container {
  max-width: 1400px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  gap: 2rem;
}

.results-section {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid #667eea;
}

.section-header h2 {
  color: #667eea;
  font-size: 1.5rem;
}

.btn-refresh {
  background: #667eea;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-refresh:hover {
  background: #5568d3;
  transform: rotate(180deg);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  color: #666;
}

.filter-group select {
  padding: 0.5rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  transition: all 0.3s;
}

.result-item:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.result-rank {
  font-size: 2rem;
  font-weight: bold;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.result-rank.rank-1 {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: white;
}

.result-rank.rank-2 {
  background: linear-gradient(135deg, #C0C0C0, #808080);
  color: white;
}

.result-rank.rank-3 {
  background: linear-gradient(135deg, #CD7F32, #8B4513);
  color: white;
}

.result-rank:not(.rank-1):not(.rank-2):not(.rank-3) {
  background: #f0f0f0;
  color: #667eea;
}

.result-info {
  flex: 1;
}

.result-name {
  font-weight: bold;
  font-size: 1.3rem;
  margin-bottom: 0.3rem;
}

.result-detail {
  font-size: 0.95rem;
  color: #666;
}

.result-bar {
  flex: 2;
  height: 40px;
  background: #f0f0f0;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.result-bar-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s ease-out;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 15px;
  color: white;
  font-weight: bold;
  font-size: 1.1rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: #666;
  font-size: 1.1rem;
}

.loading::after {
  content: '...';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: #999;
}

.empty-state-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }
  
  .header-content h1 {
    font-size: 1.2rem;
  }
  
  .candidates-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .result-item {
    flex-wrap: wrap;
  }
  
  .result-bar {
    width: 100%;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}


/* Loading Spinner */
.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #2196f3;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes scaleIn {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Party Card Styles */
.party-card {
  transition: all 0.2s ease;
  background: white;
}

.party-card:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.party-card:active {
  transform: translateX(5px) scale(0.98);
}

/* Disable pointer events when submitting */
.modal.submitting {
  pointer-events: none;
}

.modal.submitting .modal-content {
  opacity: 0.8;
}

/* Button disabled state */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Success animation */
.success-checkmark {
  animation: scaleIn 0.5s ease-out;
}

/* Dual Maps Layout */
.dual-maps-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.map-section {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.map-title {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1rem;
  text-align: center;
}

.map-title h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.2rem;
}

.map-title p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.9;
}

.map-half {
  width: 100%;
  height: 500px;
}

/* Responsive */
@media (max-width: 1024px) {
  .dual-maps-container {
    grid-template-columns: 1fr;
  }
  
  .map-half {
    height: 400px;
  }
}

@media (max-width: 768px) {
  .map-half {
    height: 300px;
  }
  
  .map-title h3 {
    font-size: 1rem;
  }
  
  .map-title p {
    font-size: 0.8rem;
  }
}
