/**
 * Import Merge Modal Styles
 *
 * Three-tier review UI for family tree import merge
 */

/* Modal Overlay */
.import-merge-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

/* Modal Container */
.import-merge-modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.import-merge-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.import-merge-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1e293b;
}

.import-merge-header .close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 4px;
}

.import-merge-header .close-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
}

/* Summary Stats */
.import-merge-summary {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  background: white;
  border-radius: 8px;
  min-width: 80px;
}

.summary-stat .stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}

.summary-stat .stat-label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
}

.summary-stat.matches .stat-number {
  color: #16a34a;
}

.summary-stat.conflicts .stat-number {
  color: #ea580c;
}

.summary-stat.new .stat-number {
  color: #2563eb;
}

/* Tabs */
.import-merge-tabs {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background: white;
}

.tab-btn {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  color: #1e293b;
  background: #f8fafc;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}

/* Content Area */
.import-merge-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: #f8fafc;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: #64748b;
  font-size: 0.9375rem;
}

/* Merge Card */
.merge-card {
  background: white;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  margin-bottom: 1rem;
  overflow: hidden;
}

.merge-card:last-child {
  margin-bottom: 0;
}

/* Card Header */
.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

/* Confidence Badges */
.confidence-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.confidence-badge.high {
  background: #dcfce7;
  color: #16a34a;
}

.confidence-badge.medium {
  background: #ffedd5;
  color: #ea580c;
}

.confidence-badge.low {
  background: #fee2e2;
  color: #dc2626;
}

.match-indicator {
  font-size: 0.8125rem;
  color: #16a34a;
  font-weight: 500;
}

.conflict-indicator {
  font-size: 0.8125rem;
  color: #ea580c;
  font-weight: 500;
}

.new-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #dbeafe;
  color: #2563eb;
}

/* Comparison Grid */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
}

.comparison-col {
  padding: 1rem;
  border-radius: 8px;
  background: #f8fafc;
}

.comparison-col.extracted {
  border-left: 3px solid #2563eb;
}

.comparison-col.existing {
  border-left: 3px solid #16a34a;
}

.comparison-col h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
}

/* Person Details */
.person-details {
  padding: 1rem;
}

.person-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 0.25rem;
}

.person-dates {
  font-size: 0.875rem;
  color: #64748b;
}

.person-notes {
  font-size: 0.8125rem;
  color: #94a3b8;
  margin-top: 0.5rem;
  font-style: italic;
}

.info-text {
  padding: 0 1rem;
  margin: 0 0 1rem 0;
  font-size: 0.875rem;
  color: #64748b;
}

/* Merge Preview */
.merge-preview {
  padding: 0.75rem 1rem;
  background: #f0fdf4;
  border-top: 1px solid #dcfce7;
}

.merge-preview h4 {
  margin: 0 0 0.5rem 0;
  font-size: 0.8125rem;
  color: #16a34a;
  font-weight: 600;
}

.changes-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changes-list li {
  font-size: 0.8125rem;
  color: #1e293b;
  padding: 0.25rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.change-tag {
  font-size: 0.625rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-weight: 600;
}

.change-added .change-tag {
  background: #dcfce7;
  color: #16a34a;
}

.change-confirmed .change-tag {
  background: #dbeafe;
  color: #2563eb;
}

/* Conflicts Section */
.conflicts-section {
  padding: 1rem;
  background: #fffbeb;
  border-top: 1px solid #fef3c7;
}

.conflicts-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.8125rem;
  color: #b45309;
  font-weight: 600;
}

.conflict-field {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #fef3c7;
}

.conflict-field:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.field-name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.5rem;
}

/* Action Row */
.action-row {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

/* Radio Options */
.radio-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  color: #475569;
}

.radio-option input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #2563eb;
}

.radio-option:hover span {
  color: #1e293b;
}

/* Footer */
.import-merge-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  background: white;
}

.import-merge-footer .btn {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.import-merge-footer .btn-secondary {
  background: #e2e8f0;
  border: none;
  color: #475569;
}

.import-merge-footer .btn-secondary:hover {
  background: #cbd5e1;
}

.import-merge-footer .btn-primary {
  background: #2563eb;
  border: none;
  color: white;
}

.import-merge-footer .btn-primary:hover {
  background: #1d4ed8;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 3rem 2rem;
  color: #64748b;
  font-size: 0.9375rem;
}

/* Success Empty State */
.empty-state.success {
  color: #16a34a;
}

.empty-state.success::before {
  content: '✓';
  display: block;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

/* Anomalies Tab Button */
.tab-btn.has-errors {
  color: #dc2626;
}

.tab-btn.has-errors::after {
  content: '!';
  display: inline-block;
  width: 16px;
  height: 16px;
  background: #dc2626;
  color: white;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: bold;
  line-height: 16px;
  text-align: center;
  margin-left: 0.5rem;
}

/* Anomalies Panel */
.anomalies-panel {
  padding: 0;
}

.anomalies-summary {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.anomaly-count {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8125rem;
  font-weight: 500;
}

.anomaly-count.error {
  background: #fee2e2;
  color: #dc2626;
}

.anomaly-count.warning {
  background: #fef3c7;
  color: #b45309;
}

.anomaly-count.info {
  background: #dbeafe;
  color: #2563eb;
}

/* Anomaly Sections */
.anomaly-section {
  background: white;
  border-radius: 8px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.anomaly-section h4 {
  margin: 0;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.anomaly-section.error h4 {
  background: #fee2e2;
  color: #dc2626;
}

.anomaly-section.warning h4 {
  background: #fef3c7;
  color: #b45309;
}

.anomaly-section.info h4 {
  background: #dbeafe;
  color: #2563eb;
}

/* Anomaly Items */
.anomaly-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}

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

.anomaly-icon {
  flex-shrink: 0;
  font-size: 1rem;
  line-height: 1.5;
}

.anomaly-content {
  flex: 1;
  min-width: 0;
}

.anomaly-message {
  font-size: 0.875rem;
  color: #1e293b;
  line-height: 1.5;
}

.anomaly-message strong {
  color: inherit;
}

.anomaly-suggestion {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.25rem;
  font-style: italic;
}

.anomaly-details {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 640px) {
  .import-merge-modal {
    max-height: 95vh;
    border-radius: 12px 12px 0 0;
    margin-top: auto;
  }

  .comparison-grid {
    grid-template-columns: 1fr;
  }

  .import-merge-summary {
    justify-content: center;
  }

  .action-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .import-merge-tabs {
    padding: 0 0.5rem;
    overflow-x: auto;
  }

  .tab-btn {
    padding: 0.75rem 1rem;
    white-space: nowrap;
  }
}
