.relationship-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}

.relationship-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  z-index: 10000;
}

.relationship-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 30px;
  border-bottom: 1px solid #e1e4e8;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.relationship-header h3 {
  margin: 0;
  font-size: 22px;
  color: #2c3e50;
}

.relationship-close {
  background: none;
  border: none;
  font-size: 32px;
  color: #95a5a6;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.relationship-close:hover {
  color: #2c3e50;
}

.relationship-body {
  padding: 30px;
}

.relationship-body h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: #2c3e50;
  font-weight: 600;
}

.source-selection-section,
.relationships-section,
.merge-preview-section {
  margin-bottom: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #e1e4e8;
}

.merge-preview-section {
  border-bottom: none;
}

.source-selection-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: end;
}

.source-select-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #2c3e50;
  font-size: 14px;
}

.source-select-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dfe4e8;
  border-radius: 6px;
  font-size: 14px;
  background: white;
}

.source-connector-icon {
  font-size: 24px;
  color: #3498db;
  margin-bottom: 10px;
}

.info-box {
  padding: 16px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #3498db;
  font-size: 14px;
  color: #7f8c8d;
}

.info-box p {
  margin: 8px 0;
}

.info-box p:first-child {
  margin-top: 0;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.info-box.warning {
  background: #fff9e6;
  border-left-color: #f39c12;
  color: #8b7200;
}

.info-box.success {
  background: #eafaf1;
  border-left-color: #2ecc71;
  color: #1e7e34;
}

.relationships-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.relationship-card {
  background: white;
  border: 2px solid #e1e4e8;
  border-radius: 8px;
  padding: 20px;
  transition: all 0.2s;
}

.relationship-card.high-confidence {
  border-color: #2ecc71;
  background: #f9fefb;
}

.relationship-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.relationship-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.confidence-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.confidence-badge.confidence-high {
  background: #d4edda;
  color: #1e7e34;
}

.confidence-badge.confidence-medium {
  background: #fff3cd;
  color: #856404;
}

.confidence-badge.confidence-low {
  background: #f8d7da;
  color: #721c24;
}

.relationship-match-type {
  font-size: 13px;
  color: #7f8c8d;
}

.relationship-columns {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.column-name {
  flex: 1;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  text-align: center;
}

.column-connector {
  color: #3498db;
  font-size: 18px;
  font-weight: bold;
}

.relationship-types {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.type-badge {
  padding: 4px 10px;
  background: #ecf0f1;
  border-radius: 12px;
  font-size: 11px;
  color: #7f8c8d;
  font-weight: 500;
}

.relationship-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small.btn-primary {
  background: #3498db;
  color: white;
}

.btn-small.btn-primary:hover {
  background: #2980b9;
}

.btn-small.btn-secondary {
  background: #ecf0f1;
  color: #7f8c8d;
}

.btn-small.btn-secondary:hover {
  background: #dfe4e8;
  color: #2c3e50;
}

.merge-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}

.merge-stat {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.merge-stat-label {
  font-size: 14px;
  color: #7f8c8d;
}

.merge-stat-value {
  font-size: 20px;
  font-weight: 600;
  color: #2c3e50;
}

.preview-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.preview-table th,
.preview-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e1e4e8;
}

.preview-table th {
  background: #f8f9fa;
  font-weight: 600;
  color: #2c3e50;
  position: sticky;
  top: 0;
}

.preview-table tbody tr:last-child td {
  border-bottom: none;
}

.preview-table tbody tr:hover {
  background: #f8f9fa;
}

.relationship-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 30px;
  border-top: 1px solid #e1e4e8;
  position: sticky;
  bottom: 0;
  background: white;
}

@media (max-width: 768px) {
  .source-selection-grid {
    grid-template-columns: 1fr;
  }
  
  .source-connector-icon {
    display: none;
  }
  
  .relationship-actions {
    flex-direction: column;
  }
  
  .relationship-footer {
    flex-direction: column;
  }
}
