.mp-card {
  display: block;
  background: var(--bg-gradient-card);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border-color);
  padding: var(--spacing-4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.mp-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-500) 0%, var(--civic-gold-500) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.mp-card:hover::before {
  transform: scaleX(1);
}

.mp-card:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-300);
}

.mp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-3);
}

.mp-info {
  display: flex;
  gap: var(--spacing-4);
  flex: 1;
  /* Allow flex child (.mp-details) to shrink so text doesn't push layout */
  min-width: 0;
}

.mp-avatar {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-700);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  flex-shrink: 0;
  border: 3px solid var(--primary-300);
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.mp-avatar::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  transform: rotate(45deg) translateX(-100%);
  transition: transform 0.6s ease;
}

.mp-card:hover .mp-avatar::before {
  transform: rotate(45deg) translateX(100%);
}

.mp-card:hover .mp-avatar {
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-400);
}

.mp-card .mp-details {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
}

.mp-name {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0 0 var(--spacing-2) 0;
  line-height: var(--leading-tight);
  font-family: var(--font-primary);
  letter-spacing: -0.01em;
  /* Show full name with wrapping – no truncation */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.mp-constituency {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-bottom: var(--spacing-3);
  font-weight: var(--font-medium);
  padding: var(--spacing-1) var(--spacing-2);
  background: var(--slate-50);
  border-radius: var(--radius-md);
  border: 1px solid var(--slate-200);
  min-width: 0;
}

.mp-constituency span {
  /* Readability over truncation: allow up to 2 lines */
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
  flex: 1;
  min-width: 0;
}

.mp-constituency svg {
  font-size: var(--text-sm);
  color: var(--primary-500);
}

.mp-party-info {
  display: flex;
  gap: var(--spacing-2);
  align-items: center;
}

.party-badge {
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--civic-gold-100) 0%, var(--civic-gold-200) 100%);
  color: var(--civic-gold-800);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--civic-gold-300);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.house-badge {
  padding: var(--spacing-1) var(--spacing-3);
  background: linear-gradient(135deg, var(--slate-100) 0%, var(--slate-200) 100%);
  color: var(--slate-700);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  border: 1px solid var(--slate-300);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.mp-rank {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-100) 100%);
  color: var(--primary-700);
  padding: var(--spacing-3) var(--spacing-4);
  border-radius: var(--radius-xl);
  font-size: var(--text-sm);
  font-weight: var(--font-extrabold);
  text-align: center;
  min-width: 80px;
  border: 2px solid var(--primary-200);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.mp-rank::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
  transition: left 0.5s ease;
}

.mp-card:hover .mp-rank::before {
  left: 100%;
}

.mp-card:hover .mp-rank {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.rank-number {
  display: block;
  font-size: var(--text-lg);
  font-family: var(--font-mono);
  font-weight: var(--font-extrabold);
  letter-spacing: -0.02em;
}

.mp-stats {
  gap: var(--spacing-5);
  display: flex;
  flex-direction: column;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-3);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-1);
  padding: var(--spacing-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  transition: var(--transition-all);
}

.stat-item:hover {
  background: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.75px;
  font-family: var(--font-primary);
}

.stat-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.utilization-section {
  margin-bottom: var(--spacing-4);
  padding: var(--spacing-3);
  background: linear-gradient(135deg, var(--slate-50) 0%, var(--bg-card) 100%);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  transition: all 0.2s ease;
}

.utilization-section:hover {
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--bg-card) 100%);
  border-color: var(--primary-200);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.utilization-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2);
}

.utilization-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.75px;
  font-family: var(--font-primary);
}

.utilization-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-1) var(--spacing-2);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-xs);
}

.utilization-badge.utilization-high {
  background: linear-gradient(135deg, var(--civic-green-100) 0%, var(--civic-green-200) 100%);
  color: var(--civic-green-800);
  border: 1px solid var(--civic-green-300);
}

.utilization-badge.utilization-medium {
  background: linear-gradient(135deg, var(--civic-gold-100) 0%, var(--civic-gold-200) 100%);
  color: var(--civic-gold-800);
  border: 1px solid var(--civic-gold-300);
}

.utilization-badge.utilization-low {
  background: linear-gradient(135deg, var(--civic-red-100) 0%, var(--civic-red-200) 100%);
  color: var(--civic-red-800);
  border: 1px solid var(--civic-red-300);
}

.utilization-badge svg {
  font-size: var(--text-xs);
}

.utilization-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--slate-200) 0%, var(--slate-300) 100%);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: var(--shadow-inner);
  border: 1px solid var(--border-color);
}

.utilization-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.utilization-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
  animation: shimmer 2s infinite;
}

.utilization-fill.utilization-high {
  background: linear-gradient(90deg, var(--civic-green-500) 0%, var(--civic-green-600) 100%);
}

.utilization-fill.utilization-medium {
  background: linear-gradient(90deg, var(--civic-gold-500) 0%, var(--civic-gold-600) 100%);
}

.utilization-fill.utilization-low {
  background: linear-gradient(90deg, var(--civic-red-500) 0%, var(--civic-red-600) 100%);
}

.works-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-2);
  margin-bottom: var(--spacing-3);
}

.works-stat {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
  transition: var(--transition-all);
}

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

.works-icon {
  font-size: var(--text-base);
  flex-shrink: 0;
}

.works-icon.completed {
  color: var(--civic-green-600);
}

.works-icon.recommended {
  color: var(--primary-600);
}

.works-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.works-count {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-left: auto;
  font-family: var(--font-mono);
}

.completion-rate {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-2);
  background: linear-gradient(135deg, var(--slate-50) 0%, var(--slate-100) 100%);
  border-radius: var(--radius-lg);
  margin-top: var(--spacing-2);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.completion-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.75px;
}

.completion-value {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  font-family: var(--font-mono);
}

.completion-value.high {
  color: var(--civic-green-700);
}

.completion-value.medium {
  color: var(--civic-gold-700);
}

.completion-value.low {
  color: var(--civic-red-700);
}

.utilization-rate {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-2);
  background: linear-gradient(135deg, var(--blue-50) 0%, var(--blue-100) 100%);
  border-radius: var(--radius-lg);
  margin-top: var(--spacing-1);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-xs);
}

.utilization-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.75px;
}

.utilization-value {
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  font-family: var(--font-mono);
}

.utilization-value.high {
  color: var(--civic-green-700);
}

.utilization-value.medium {
  color: var(--civic-gold-700);
}

.utilization-value.low {
  color: var(--civic-red-700);
}

/* New Efficiency Score Section */
.efficiency-section {
  margin-bottom: var(--spacing-4);
  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.3s ease;
  position: relative;
  overflow: hidden;
}

.efficiency-section::before {
  content: none;
  display: none;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.1);
    opacity: 0.3;
  }
}

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

.efficiency-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-3);
  position: relative;
  z-index: 1;
}

.efficiency-label {
  font-size: var(--text-sm);
  color: #1e293b;
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.efficiency-badge {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-3);
  border-radius: var(--radius-full);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.efficiency-badge.efficiency-high {
  background: var(--civic-green-50);
  color: var(--civic-green-700);
  border: 1px solid var(--civic-green-200);
}

.efficiency-badge.efficiency-medium {
  background: var(--civic-gold-50);
  color: var(--civic-gold-700);
  border: 1px solid var(--civic-gold-200);
}

.efficiency-badge.efficiency-low {
  background: var(--civic-red-50);
  color: var(--civic-red-700);
  border: 1px solid var(--civic-red-200);
}

.efficiency-badge svg {
  font-size: var(--text-lg);
  animation: none;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.efficiency-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-3);
  margin-bottom: var(--spacing-3);
  position: relative;
  z-index: 1;
}

.breakdown-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  transition: all 0.2s ease;
}

.breakdown-item:hover {
  background: var(--bg-card);
  border-color: var(--border-color-hover);
  transform: translateX(1px);
  box-shadow: var(--shadow-xs);
}

.breakdown-item svg {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.efficiency-bar {
  height: 8px;
  background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
  position: relative;
  z-index: 1;
}

.efficiency-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.efficiency-fill::after {
  content: none;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.efficiency-fill.efficiency-high {
  background: var(--civic-green-500);
}

.efficiency-fill.efficiency-medium {
  background: var(--civic-gold-500);
}

.efficiency-fill.efficiency-low {
  background: var(--civic-red-500);
}

/* Payment Warning Section */
.payment-warning {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3);
  background: linear-gradient(135deg, #fef3c7 0%, #fed7aa 100%);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-3);
  font-size: var(--text-xs);
  color: #92400e;
  font-weight: var(--font-medium);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.1);
  animation: slideIn 0.5s ease-out;
  position: relative;
  overflow: hidden;
}

.payment-warning::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
}

@keyframes slideIn {
  from {
    transform: translateX(-10px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.payment-warning svg {
  color: #f59e0b;
  font-size: var(--text-base);
  flex-shrink: 0;
  animation: pulse-icon 2s infinite;
}

@keyframes pulse-icon {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.payment-warning span {
  flex: 1;
  line-height: 1.4;
}

.payment-warning:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%);
  border-color: #d97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(245, 158, 11, 0.15);
}

.utilization-value.low {
  color: var(--civic-red-700);
}

.mp-card-footer {
  margin-top: var(--spacing-4);
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.view-details {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-2) var(--spacing-4);
  border-radius: var(--radius-lg);
  transition: var(--transition-all);
  border: 1px solid transparent;
}

.mp-card:hover .view-details {
  color: var(--primary-600);
  background: var(--primary-50);
  border-color: var(--primary-200);
  transform: translateY(-1px);
}

/* List view adjustments */
.mps-list .mp-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  padding: 16px 20px;
  gap: 20px;
}

.mps-list .mp-card-header {
  margin-bottom: 0;
}

.mps-list .mp-stats {
  display: flex;
  gap: 24px;
  align-items: center;
}

.mps-list .stat-row {
  display: flex;
  gap: 24px;
  margin-bottom: 0;
}

.mps-list .utilization-section,
.mps-list .works-section {
  margin-bottom: 0;
}

.mps-list .utilization-section {
  min-width: 200px;
}

.mps-list .works-section {
  display: flex;
  gap: 16px;
}

.mps-list .completion-rate {
  grid-column: auto;
  margin-top: 0;
  min-width: 120px;
}

.mps-list .mp-card-footer {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
  .mp-card {
    padding: var(--spacing-4);
    border-radius: var(--radius-xl);
  }

  .mp-name {
    font-size: var(--text-lg);
  }

  .mp-avatar {
    width: 48px;
    height: 48px;
    font-size: var(--text-xl);
  }

  .stat-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-3);
    margin-bottom: var(--spacing-4);
  }

  .works-section {
    grid-template-columns: 1fr;
    gap: var(--spacing-2);
  }

  .utilization-section {
    padding: var(--spacing-3);
  }

  .efficiency-section {
    padding: var(--spacing-3);
  }

  .efficiency-breakdown {
    grid-template-columns: 1fr;
    gap: var(--spacing-2);
  }

  .payment-warning {
    padding: var(--spacing-2);
    font-size: var(--text-xs);
  }

  .mps-list .mp-card {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }

  .mps-list .mp-stats {
    flex-direction: column;
    gap: var(--spacing-4);
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .mp-card {
    padding: var(--spacing-3);
    border-radius: var(--radius-lg);
  }

  .mp-card-header {
    flex-direction: column;
    gap: var(--spacing-3);
    align-items: stretch;
  }

  .mp-info {
    gap: var(--spacing-3);
  }

  .mp-rank {
    align-self: flex-end;
    min-width: 64px;
  }

  .mp-name {
    font-size: var(--text-base);
  }

  .mp-avatar {
    width: 44px;
    height: 44px;
    font-size: var(--text-lg);
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {

  .mp-card:hover,
  .mp-card:hover .mp-avatar,
  .mp-card:hover .mp-rank,
  .mp-card:hover .view-details,
  .stat-item:hover,
  .works-stat:hover {
    transform: none;
  }

  .utilization-fill::after {
    animation: none;
  }
}