/* MP List Page Styles */
.mps-page {
  padding: 24px;
  width: 100%;
  box-sizing: border-box;
}

.mps-header {
  margin-bottom: 32px;
}

.header-content {
  margin-bottom: 24px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.mps-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--civic-gold-600) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin: 0 0 var(--spacing-2) 0;
}

.mps-header p {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

.national-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--spacing-4);
  padding: var(--spacing-6);
  background: linear-gradient(135deg, var(--slate-50) 0%, var(--primary-50) 100%);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--spacing-6);
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--spacing-4);
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.stat-box:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-color-hover);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-2);
}

.stat-label-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: var(--spacing-2);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.stat-period {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--spacing-1);
  font-weight: var(--font-medium);
  opacity: 0.8;
}

/* Controls */
.mps-controls {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
  padding: var(--spacing-6);
  background: var(--bg-gradient-card);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

.search-section {
  width: 100%;
}

.search-box {
  position: relative;
  max-width: 500px;
}

.search-box svg {
  position: absolute;
  left: var(--spacing-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 20px;
  transition: color 0.2s ease;
}

.search-box input:focus + svg {
  color: var(--primary-500);
}

.search-box input {
  width: 100%;
  padding: var(--spacing-4) var(--spacing-4) var(--spacing-4) 52px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-xl);
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  background: var(--bg-card);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  transform: translateY(-1px);
}

.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.filter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.mps-controls .filter-group {
  margin-bottom: 0;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-select,
.sort-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  min-width: 120px;
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-controls label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.view-controls {
  display: flex;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}

.view-btn {
  padding: 8px 16px;
  border: none;
  background: white;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover {
  background: #f3f4f6;
}

.view-btn.active {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #9ca3af;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  cursor: not-allowed;
  opacity: 0.6;
}

/* Performance Insights */
.performance-insights {
  margin-bottom: 32px;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.insight-card {
  display: flex;
  align-items: center;
  gap: var(--spacing-4);
  padding: var(--spacing-5);
  background: var(--bg-gradient-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.insight-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-color-hover);
}

.insight-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, var(--slate-100) 0%, var(--slate-200) 100%);
  color: var(--slate-600);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.insight-card:hover .insight-icon {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

.insight-icon.high {
  background: #f3f4f6;
  color: #374151;
}

.insight-icon.medium {
  background: #f3f4f6;
  color: #374151;
}

.insight-icon.low {
  background: #f3f4f6;
  color: #374151;
}

.insight-icon.neutral {
  background: #f3f4f6;
  color: #374151;
}

.insight-content h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.insight-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px 0;
}

.insight-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

/* Chart Section */
.chart-section {
  margin-bottom: 32px;
  padding: 24px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.chart-section h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 24px 0;
}

/* MPs Content */
.mps-content {
  margin-bottom: 32px;
}

.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.content-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  margin: 0;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  background: #f9fafb;
  color: #374151;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  font-size: 12px;
  font-weight: 500;
}

.filter-tag button {
  background: none;
  border: none;
  color: #1d4ed8;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* MPs Grid */
.mps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 16px;
}

/* Full-width load more row inside grid */
.grid-load-more {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
}

/* MPs List */
.mps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
  padding: 24px;
}

.page-btn {
  padding: 8px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 14px;
  font-weight: 500;
  color: #1f2937; /* ensure text is visible against white */
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: none; /* override global button shadow */
}

.page-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: #6b7280;
}

.total-info {
  font-size: 12px;
  color: #9ca3af;
}

/* No MPs State */
.no-mps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 48px;
  text-align: center;
  color: #6b7280;
}

.no-mps svg {
  color: #d1d5db;
}

.clear-filters-btn {
  padding: 10px 20px;
  background: #f9fafb;
  color: #374151;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-filters-btn:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}

/* Loading and Error States */
.mps-loading,
.mps-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px;
  text-align: center;
}

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

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .mps-page {
    padding: 16px;
  }
  
  .national-stats {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    padding: 16px;
  }
  
  .mps-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 768px) {
  .mps-header h1 {
    font-size: 24px;
  }
  
  .control-buttons {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-controls {
    justify-content: space-between;
  }
  
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  
  .content-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .mps-grid {
    grid-template-columns: 1fr;
  }
  
  .pagination {
    flex-direction: column;
    gap: 16px;
  }
  
  .insights-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .national-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
  }
  
  .stat-value {
    font-size: 20px;
  }
  
  .mps-controls {
    padding: 16px;
  }
}