/* Outreach CRM — admin page styles */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-2: #64748b;
  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --accent: #1d4ed8;
  --success: #059669;
  --success-bg: #d1fae5;
  --error: #dc2626;
  --error-bg: #fee2e2;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --info-bg: #dbeafe;
  --info: #1d4ed8;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.page-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h1 { font-size: 22px; font-weight: 800; color: var(--text); }
.header-actions { display: flex; gap: 10px; align-items: center; }

/* Pipeline cards */
.pipeline-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.pipeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.pipeline-card .card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-2);
  margin-bottom: 6px;
}
.pipeline-card .card-count {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
}
.pipeline-card.total { border-left: 4px solid var(--primary); }
.pipeline-card.not_contacted { border-left: 4px solid #94a3b8; }
.pipeline-card.contacted { border-left: 4px solid #3b82f6; }
.pipeline-card.responded { border-left: 4px solid #f59e0b; }
.pipeline-card.waitlist { border-left: 4px solid #8b5cf6; }
.pipeline-card.converted { border-left: 4px solid var(--success); }
.pipeline-card.declined { border-left: 4px solid var(--error); }

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.filter-tab {
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  border: none;
  background: none;
  transition: all .15s;
  white-space: nowrap;
}
.filter-tab:hover { background: #f1f5f9; color: var(--text); }
.filter-tab.active { background: var(--primary); color: white; }
.filter-tab .tab-count {
  display: inline-block;
  margin-left: 6px;
  background: rgba(255,255,255,.2);
  border-radius: 100px;
  padding: 0 6px;
  font-size: 11px;
}

/* Table */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.prospects-table {
  width: 100%;
  border-collapse: collapse;
}
.prospects-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-2);
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.prospects-table th:hover { color: var(--text); }
.prospects-table th.sorted { color: var(--primary); }
.sort-icon { margin-left: 4px; opacity: .5; }
.prospects-table th.sorted .sort-icon { opacity: 1; }

.prospects-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 14px;
}
.prospects-table tr:last-child td { border-bottom: none; }
.prospects-table tr:hover td { background: #f8fafc; }

.venue-name { font-weight: 600; color: var(--text); }
.venue-name .venue-type { font-size: 11px; font-weight: 500; color: var(--text-2); display: block; margin-top: 2px; }
.contact-cell .name { font-weight: 500; }
.contact-cell .detail { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge.not_contacted { background: #f1f5f9; color: #475569; }
.status-badge.contacted { background: var(--info-bg); color: #1d4ed8; }
.status-badge.responded { background: var(--warning-bg); color: #92400e; }
.status-badge.waitlist { background: #f3e8ff; color: #6d28d9; }
.status-badge.converted { background: var(--success-bg); color: #065f46; }
.status-badge.declined { background: var(--error-bg); color: #991b1b; }

.notes-cell { max-width: 220px; font-size: 13px; color: var(--text-2); }
.notes-cell .notes-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.follow-up { font-size: 13px; color: var(--text-2); }
.follow-up.overdue { color: var(--error); font-weight: 600; }
.follow-up.soon { color: var(--warning); }

.date-cell { font-size: 13px; color: var(--text-2); }

.row-actions { display: flex; gap: 6px; }
.action-btn {
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all .15s;
}
.action-btn.edit {
  background: var(--info-bg);
  color: var(--info);
}
.action-btn.edit:hover { background: #bfdbfe; }
.action-btn.delete {
  background: var(--error-bg);
  color: var(--error);
}
.action-btn.delete:hover { background: #fecaca; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
  gap: 8px;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--primary); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-danger { background: var(--error); color: white; }
.btn-danger:hover { background: #b91c1c; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 24px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h2 { font-size: 20px; font-weight: 800; }
.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }

.form-grid { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.form-group input, .form-group select, .form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 72px; }

.modal-actions { display: flex; gap: 10px; margin-top: 20px; justify-content: flex-end; }

/* Confirm delete */
.confirm-delete-modal .modal { max-width: 420px; }
.confirm-delete-modal p { font-size: 15px; color: var(--text-2); margin: 12px 0 20px; line-height: 1.6; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-2);
}
.empty-state svg { opacity: .3; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* Loading state */
.loading-row td { opacity: .5; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  z-index: 9999;
  display: none;
  animation: toastIn .2s ease;
}
.toast.show { display: block; }
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Responsive */
@media (max-width: 640px) {
  .pipeline-row { grid-template-columns: repeat(3, 1fr); }
  .prospects-table { font-size: 13px; }
  .prospects-table td, .prospects-table th { padding: 10px 12px; }
  .modal { padding: 24px; }
  .form-row { flex-direction: column; }
}