/* ImportContacts.css */

/* ── Trigger Button ──────────────────────────────────────────────────────── */
.btn-import {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1.5px solid var(--border-color, #d1d5db);
  border-radius: 8px;
  background: var(--bg-secondary, #f9fafb);
  color: var(--text-primary, #1f2937);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-import:hover:not(:disabled) {
  background: var(--bg-hover, #f3f4f6);
  border-color: var(--accent, #6366f1);
}
.btn-import:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Modal Overlay ───────────────────────────────────────────────────────── */
.import-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 16px;
}

.import-modal {
  background: var(--bg-primary, #fff);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.import-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
}
.import-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary, #111827);
  margin: 0;
}
.import-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}
.import-close:hover { background: var(--bg-hover, #f3f4f6); }

/* ── Body ────────────────────────────────────────────────────────────────── */
.import-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Drop Zone ───────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-color, #d1d5db);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-secondary, #fafafa);
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--accent, #6366f1);
  background: #eff0fe;
}
.drop-zone.has-file {
  border-style: solid;
  border-color: #10b981;
  background: #ecfdf5;
}
.drop-icon  { font-size: 2rem; display: block; margin-bottom: 8px; }
.drop-text  { font-size: 1rem; font-weight: 600; margin: 0 0 4px; color: var(--text-primary, #111827); }
.drop-filename { font-size: 0.95rem; font-weight: 600; color: #10b981; margin: 0 0 4px; }
.drop-hint  { font-size: 0.8rem; color: var(--text-secondary, #6b7280); margin: 0; }

/* ── Format Hint ─────────────────────────────────────────────────────────── */
.import-hint details {
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-secondary, #6b7280);
}
.import-hint summary { cursor: pointer; font-weight: 600; }
.hint-body { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.hint-body code {
  background: var(--bg-secondary, #f3f4f6);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  display: block;
  word-break: break-all;
}

/* ── Dry Run Toggle ──────────────────────────────────────────────────────── */
.dry-run-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-primary, #374151);
  cursor: pointer;
}
.dry-run-toggle input { width: 16px; height: 16px; cursor: pointer; }

/* ── Error ───────────────────────────────────────────────────────────────── */
.import-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.875rem;
  color: #dc2626;
}

/* ── Upload Button ───────────────────────────────────────────────────────── */
.btn-upload {
  width: 100%;
  padding: 12px;
  background: var(--accent, #6366f1);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-upload:hover:not(:disabled) { opacity: 0.9; }
.btn-upload:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Results ─────────────────────────────────────────────────────────────── */
.import-results { display: flex; flex-direction: column; gap: 14px; }

.results-banner {
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
}
.results-banner.dry  { background: #fffbeb; color: #d97706; border: 1px solid #fcd34d; }
.results-banner.live { background: #ecfdf5; color: #059669; border: 1px solid #6ee7b7; }

.results-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.stat {
  flex: 1;
  min-width: 64px;
  text-align: center;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 10px;
  padding: 10px 8px;
  border: 1px solid var(--border-color, #e5e7eb);
}
.stat span { display: block; font-size: 1.5rem; font-weight: 800; color: var(--text-primary, #111827); }
.stat small { font-size: 0.75rem; color: var(--text-secondary, #6b7280); }
.stat.created span { color: #10b981; }
.stat.updated span { color: #3b82f6; }
.stat.skipped span { color: #9ca3af; }
.stat.errors  span { color: #ef4444; }

/* ── Rows table ──────────────────────────────────────────────────────────── */
.results-table-wrap {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 8px;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.results-table th {
  background: var(--bg-secondary, #f3f4f6);
  padding: 7px 10px;
  text-align: right;
  font-weight: 600;
  color: var(--text-secondary, #6b7280);
  position: sticky;
  top: 0;
}
.results-table td {
  padding: 6px 10px;
  border-top: 1px solid var(--border-color, #f3f4f6);
  color: var(--text-primary, #374151);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-error td { background: #fef2f2; }
.row-skipped td { color: var(--text-secondary, #9ca3af); }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-created { background: #d1fae5; color: #065f46; }
.badge-updated { background: #dbeafe; color: #1e40af; }
.badge-skipped { background: #f3f4f6; color: #6b7280; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-dry     { background: #fef3c7; color: #92400e; }

/* ── Post-result actions ─────────────────────────────────────────────────── */
.results-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-reset {
  padding: 9px 18px;
  background: none;
  border: 1.5px solid var(--border-color, #d1d5db);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary, #374151);
  font-weight: 500;
}
.btn-reset:hover { background: var(--bg-hover, #f9fafb); }
.btn-close-after {
  padding: 9px 18px;
  background: none;
  border: 1.5px solid var(--border-color, #d1d5db);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
}
.btn-close-after:hover { background: var(--bg-hover, #f9fafb); }
