/* admin.css — Client Tracker styles.
   Owns: all styles for the admin portal page.
   Does NOT own: layout.ejs landing page styles. */

/* ── Reset & base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f6f9;
  color: #1a1a2e;
  line-height: 1.5;
  font-size: 15px;
}

/* ── Layout ──────────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Header ───────────────────────────────────────────── */
.header {
  background: #1a1a2e;
  color: #fff;
  padding: 20px 0;
  margin-bottom: 28px;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.02em;
}

.logo-icon {
  color: #f59e0b;
  font-size: 1.4rem;
  line-height: 1;
}

.header-subtitle {
  color: #94a3b8;
  font-size: 0.875rem;
}

/* ── Toolbar ──────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.client-count {
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
}

/* ── Filter bar ───────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: #c7d2fe;
  color: #4338ca;
}

.filter-btn.active {
  background: #4338ca;
  border-color: #4338ca;
  color: #fff;
}

/* ── Table ─────────────────────────────────────────────── */
.table-wrap {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
  overflow: hidden;
}

.client-table {
  width: 100%;
  border-collapse: collapse;
}

.client-table thead tr {
  background: #f8fafc;
  border-bottom: 1.5px solid #e2e8f0;
}

.client-table th {
  padding: 12px 16px;
  font-size: 0.775rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

.client-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

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

.client-table tbody tr:hover {
  background: #f8fafc;
}

/* Name cell */
.name-cell {
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

/* Contact cell */
.contact-cell {
  min-width: 200px;
}

.contact-link {
  display: block;
  color: #4338ca;
  text-decoration: none;
  font-size: 0.875rem;
}

.contact-link:hover { text-decoration: underline; }

.contact-phone {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: 1px;
}

/* Notes cell */
.notes-cell {
  max-width: 280px;
  color: #64748b;
  font-size: 0.825rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Actions cell */
.actions-col { width: 90px; text-align: right; }

.actions-cell {
  text-align: right;
  white-space: nowrap;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.775rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge-lead         { background: #fef9c3; color: #854d0e; }
.badge-consultation { background: #dbeafe; color: #1e40af; }
.badge-client       { background: #dcfce7; color: #166534; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  border: none;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-primary {
  background: #4338ca;
  color: #fff;
}

.btn-primary:hover { background: #3730a3; }

.btn-ghost {
  background: transparent;
  color: #64748b;
  border: 1.5px solid #e2e8f0;
}

.btn-ghost:hover { background: #f1f5f9; }

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover { background: #b91c1c; }

/* Icon buttons */
.btn-icon {
  background: none;
  border: 1.5px solid #e2e8f0;
  border-radius: 5px;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.9rem;
  line-height: 1;
  transition: all 0.12s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: #4338ca;
  border-color: #c7d2fe;
}

.btn-icon-danger:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  animation: modalIn 0.18s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-sm { max-width: 400px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.12s;
}

.modal-close:hover { color: #1e293b; }

/* Form inside modal */
form { padding: 20px 24px 0; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 0.825rem;
  font-weight: 600;
  color: #475569;
}

.required { color: #dc2626; }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1e293b;
  background: #fff;
  transition: border-color 0.12s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

textarea { resize: vertical; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid #f1f5f9;
  margin-top: 4px;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  padding: 60px 24px;
  text-align: center;
  color: #94a3b8;
}

.empty-state p {
  font-size: 0.9rem;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 700px) {
  .page { padding: 0 12px 40px; }
  .header-inner { padding: 0 12px; }

  .filter-bar { flex-wrap: wrap; }

  /* Stack table into cards on mobile */
  .client-table { display: none; }
  .table-wrap { background: transparent; box-shadow: none; }

  .table-wrap .card {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  }

  /* Mobile card rendering via JS */
  .table-wrap .card .badge { display: inline-block; }
}