/* MP Detail Page Styles */
.mp-detail-page {
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.mp-detail-header {
  margin-bottom: 32px;
  background: var(--bg-gradient-primary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 16px 16px 20px;
  box-shadow: var(--shadow-sm);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 24px;
  transition: color 0.2s;
}

.back-link:hover {
  color: #1d4ed8;
}

.mp-title-section {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.mp-avatar-large {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  flex-shrink: 0;
}

.mp-title-info {
  flex: 1;
}

.mp-title-info h1 {
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.mp-basic-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 16px;
}

.info-item svg {
  font-size: 16px;
}

.party-badge-large {
  padding: 6px 12px;
  border-radius: 6px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 12px;
}

.house-badge-large {
  padding: 6px 12px;
  background: #f3f4f6;
  color: #374151;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}

/* Header actions */
.mp-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  color: #1e40af;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  background: linear-gradient(135deg, #e0edff 0%, #eef2f7 100%);
}

.action-btn.secondary {
  border-color: #e5e7eb;
  background: #ffffff;
  color: #334155;
}

.mp-summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 24px;
  padding: 32px;
  background: white;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-stat-card {
  position: relative;
  padding: 24px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  display: grid;
  grid-template-columns: 64px 1fr;
  column-gap: 16px;
  row-gap: 8px;
  align-items: start;
}

.summary-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  border-color: #d1d5db;
}

.summary-stat-card.allocated {
  border-left: 4px solid #0ea5e9;
}

.summary-stat-card.utilization {
  border-left: 4px solid #22c55e;
}

.summary-stat-card.works {
  border-left: 4px solid #eab308;
}

.summary-stat-card.success {
  border-left: 4px solid #8b5cf6;
}

.stat-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 0;
  color: inherit;
  /* Removed default gray background - will be set by specific card classes */
}

.summary-stat-card.allocated .stat-icon-wrapper {
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
  border: 1px solid rgba(14, 165, 233, 0.25);
}

.summary-stat-card.utilization .stat-icon-wrapper {
  background: rgba(34, 197, 94, 0.1);
  color: #166534;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.summary-stat-card.works .stat-icon-wrapper {
  background: rgba(234, 179, 8, 0.12);
  color: #92400e;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.summary-stat-card.success .stat-icon-wrapper {
  background: rgba(139, 92, 246, 0.12);
  color: #5b21b6;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.summary-stat-icon {
  background: transparent !important;
  width: 24px;
  height: 24px;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.stat-value {
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.stat-value.utilization-high {
  color: #059669;
}

.stat-value.utilization-medium {
  color: #d97706;
}

.stat-value.utilization-low {
  color: #dc2626;
}

.stat-value.high {
  color: #059669;
}

.stat-value.medium {
  color: #d97706;
}

.stat-value.low {
  color: #dc2626;
}

.stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0;
  white-space: normal;
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stat-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 500;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.utilization-bar {
  margin-top: 12px;
  height: 8px;
  background: #f3f4f6;
  border-radius: 9999px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  grid-column: 1 / -1;
}

.utilization-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s ease;
}

.utilization-fill.utilization-high {
  background: #16a34a;
}

.utilization-fill.utilization-medium {
  background: #d97706;
}

.utilization-fill.utilization-low {
  background: #dc2626;
}

.success-indicator {
  margin-top: 12px;
  grid-column: 1 / -1;
}

.indicator-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.4);
  transition: background-color 0.25s ease;
}

.dot.active {
  background: #0ea5e9;
}

/* Tabs */
.mp-tabs {
  display: flex;
  position: sticky;
  top: 72px; /* below sticky nav (64px) */
  z-index: var(--z-sticky);
  border-bottom: 2px solid #f3f4f6;
  margin-bottom: 32px;
  background: #ffffff;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

.mp-tabs::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.tab-btn {
  padding: 16px 24px;
  border: none;
  background: none;
  font-size: 16px;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: #3b82f6;
}

.tab-btn.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
}

/* Content Sections */
.mp-content {
  margin-bottom: 32px;
}

.overview-section {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
  gap: 32px;
  align-items: start;
}

.chart-container {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chart-container h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.projects-overview {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.projects-overview h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 20px 0;
}

.project-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.project-stat-card.completed {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
}

.project-stat-card.ongoing {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.project-stat-card.recommended {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.project-stat-card.total {
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.stat-icon-container {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.project-stat-card.completed .stat-icon-container {
  background: #059669;
  color: white;
}

.project-stat-card.ongoing .stat-icon-container {
  background: #d97706;
  color: white;
}

.project-stat-card.recommended .stat-icon-container {
  background: #0891b2;
  color: white;
}

.project-stat-card.total .stat-icon-container {
  background: #4b5563;
  color: white;
}

.stat-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-description {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Performance Summary */
.performance-summary {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.performance-summary h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 24px 0;
}

.performance-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 24px;
}

.performance-card {
  padding: 20px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.performance-card h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 16px 0;
}

.performance-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-row.highlight {
  font-weight: 600;
  background: white;
  padding: 12px;
  border-radius: 6px;
  border-bottom: none;
  margin-top: 8px;
}

.detail-row span:first-child {
  color: var(--text-secondary);
  font-size: 14px;
}

.amount, .count {
  font-weight: 600;
  color: var(--text-primary);
}

.count.completed {
  color: #059669;
}

.count.ongoing {
  color: #d97706;
}

.percentage {
  font-weight: 700;
}

.percentage.high, .percentage.utilization-high {
  color: #059669;
}

.percentage.medium, .percentage.utilization-medium {
  color: #d97706;
}

.percentage.low, .percentage.utilization-low {
  color: #dc2626;
}

/* Financial Section */
.financial-section {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.financial-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 24px 0;
}

.financial-details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 24px;
}

.financial-card {
  padding: 20px;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.financial-card.full-width {
  grid-column: 1 / -1;
}

.financial-card h4 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 16px 0;
}

.financial-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.financial-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
}

.financial-item:last-child {
  border-bottom: none;
}

.financial-item.total {
  background: white;
  padding: 16px;
  border-radius: 6px;
  font-weight: 600;
  border-bottom: none;
  margin-top: 8px;
}

.item-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.item-value {
  font-weight: 600;
  color: var(--text-primary);
}

.item-value.utilization-high {
  color: #059669;
}

.item-value.utilization-medium {
  color: #d97706;
}

.item-value.utilization-low {
  color: #dc2626;
}

.item-value.high {
  color: #059669;
}

.item-value.medium {
  color: #d97706;
}

.item-value.low {
  color: #dc2626;
}

/* Performance Indicators */
.indicators-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.indicator {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.indicator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.indicator-header span:first-child {
  font-weight: 500;
  color: var(--text-secondary);
}

.indicator-status {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.indicator-status.utilization-high,
.indicator-status.high {
  background: #dcfce7;
  color: #166534;
}

.indicator-status.utilization-medium,
.indicator-status.medium {
  background: #fef3c7;
  color: #92400e;
}

.indicator-status.utilization-low,
.indicator-status.low {
  background: #fee2e2;
  color: #991b1b;
}

.indicator-bar {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

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

.indicator-fill.utilization-high {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.indicator-fill.utilization-medium {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.indicator-fill.utilization-low {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

/* Projects Section */
.projects-section {
  background: white;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.projects-section h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 24px 0;
}

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

.mp-detail-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}

.error-content h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.error-content p {
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}

.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); }
}

.loading, .no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: var(--text-secondary);
  text-align: center;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .mp-detail-page {
    padding: 16px;
  }
  
  .mp-title-section {
    gap: 16px;
  }
  
  .mp-title-info h1 {
    font-size: 32px;
  }
  
  .mp-summary-stats {
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: 20px;
    padding: 24px;
  }
  
  .overview-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  
  .performance-cards {
    grid-template-columns: 1fr;
  }
  
  .financial-details-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .mp-title-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .mp-header-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .mp-title-section { gap: 16px; }
  
  .mp-title-info h1 {
    font-size: 28px;
  }
  
  .mp-summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    padding: 20px;
  }
  
  .summary-stat-card {
    padding: 20px;
  }
  
  .stat-value {
    font-size: 22px;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    line-height: 1.2;
  }
  
  .project-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .financial-details-grid {
    grid-template-columns: 1fr;
  }
  
  .mp-tabs {
    justify-content: flex-start;
  }
  
  .tab-btn {
    padding: 12px 16px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .mp-summary-stats {
    /* Stack stats for very small screens to avoid cramped layout */
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .summary-stat-card {
    padding: 16px;
    grid-template-columns: 40px 1fr;
  }

  .stat-icon-wrapper {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .stat-label {
    font-size: 10px;
    letter-spacing: 0.4px;
  }
  .stat-subtitle {
    font-size: 10px;
  }
  .stat-value {
    font-size: 16px;
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
    line-height: 1.25;
    letter-spacing: 0;
    font-family: var(--font-primary);
  }
  .mp-title-info h1 {
    font-size: 24px;
  }
  
  .mp-avatar-large {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
  
  /* removed duplicate larger font-size to avoid truncation */
  
  /* icon size already reduced above for mobile */
  
  .chart-container,
  .projects-overview,
  .performance-summary,
  .financial-section,
  .projects-section {
    padding: 16px;
  }

  .mp-payment-warning {
    margin: 16px 0;
    padding: 12px 14px;
  }
  
  .warning-content {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
  }

  .warning-icon {
    font-size: 20px;
  }

  .warning-text {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
  }

  .warning-amount {
    font-size: 16px;
  }

  .warning-message {
    font-size: 12px;
    color: #856404; /* match icon/border for consistency */
    text-transform: none; /* reduce width on small screens */
    letter-spacing: 0.3px;
  }

  /* Keep tooltip aligned neatly after the text */
  .warning-content .tooltip-wrapper {
    margin-left: 4px;
  }
}

/* Payment Warning Styles */
.mp-payment-warning {
  margin: 24px 0;
  padding: 16px 20px;
  background: linear-gradient(135deg, #fff3cd, #fdf6e3);
  border: 1px solid #ffc107;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(255, 193, 7, 0.1);
}

.warning-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.warning-icon {
  color: #856404;
  font-size: 24px;
  flex-shrink: 0;
}

.warning-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.warning-amount {
  font-size: 18px;
  font-weight: 700;
  color: #856404;
  font-family: var(--font-mono);
}

.warning-message {
  font-size: 14px;
  color: #6c5ce7;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
