/* === CRM Styles — BeatVault dark studio aesthetic === */

.crm-body { display: flex; flex-direction: column; min-height: 100vh; }

.crm-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 70px);
  margin-top: 70px;
}

/* SIDEBAR */
.crm-sidebar {
  background: #111;
  border-right: 1px solid var(--border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: sticky;
  top: 70px;
  height: calc(100vh - 70px);
  overflow-y: auto;
}

.sidebar-header { border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.sidebar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.sidebar-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.sidebar-stats { display: flex; flex-direction: column; gap: 8px; }
.stat-total {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--teal-border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 4px;
}
.stat-num { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--teal); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.stat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.stat-name { font-size: 13px; color: var(--text-dim); flex: 1; }
.stat-count { font-size: 12px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border); padding: 1px 8px; border-radius: 100px; }

.sidebar-filters { display: flex; flex-direction: column; gap: 4px; }
.filter-btn {
  background: none; border: 1px solid transparent; color: var(--text-dim);
  font-size: 13px; font-family: var(--font-body); font-weight: 500;
  padding: 8px 12px; border-radius: 6px; cursor: pointer; text-align: left;
  transition: all 0.15s;
}
.filter-btn:hover { background: var(--surface); color: var(--text); }
.filter-btn.active { background: var(--teal-dim); border-color: var(--teal-border); color: var(--teal); }
.filter-btn.not-fit { color: #ef4444; }
.filter-btn.not-fit.active { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); }

.add-contact-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--teal); color: #0a0a0f; border: none;
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  padding: 11px 16px; border-radius: 8px; cursor: pointer; width: 100%;
  transition: opacity 0.15s;
  box-shadow: 0 0 12px rgba(0,245,255,0.12);
}
.add-contact-btn:hover { opacity: 0.85; }

/* MAIN */
.crm-main {
  padding: 28px 32px;
  background: var(--bg);
  overflow-x: auto;
}

.crm-toolbar {
  display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.search-wrap { position: relative; flex: 1; max-width: 400px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input {
  width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 12px 9px 36px; color: var(--text); font-size: 14px; font-family: var(--font-body);
  transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--teal-border); }
.search-input::placeholder { color: var(--text-muted); }
.toolbar-meta { margin-left: auto; }
.contact-count { font-size: 13px; color: var(--text-muted); }

/* TABLE */
.contact-table-wrap { overflow-x: auto; }
.contact-table { width: 100%; border-collapse: collapse; }
.contact-table th {
  font-size: 11px; font-family: var(--font-display); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); padding: 0 12px 12px;
  text-align: left; border-bottom: 1px solid var(--border);
}
.contact-row {
  cursor: pointer; transition: background 0.1s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.contact-row:hover { background: var(--surface); }
.contact-row td { padding: 14px 12px; vertical-align: middle; }
.artist-name { font-size: 14px; font-weight: 600; color: var(--text); }
.artist-handle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.contact-link { font-size: 13px; color: var(--text-dim); text-decoration: none; transition: color 0.1s; }
.contact-link:hover { color: var(--teal); }
.contact-phone { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.source-badge {
  font-size: 11px; font-family: var(--font-display); font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
  padding: 3px 8px; color: var(--text-dim);
}
.status-pill {
  display: inline-block; font-size: 11px; font-family: var(--font-display); font-weight: 600;
  padding: 3px 10px; border-radius: 100px; border-width: 1px; border-style: solid;
  letter-spacing: 0.03em;
}
.tag-chip {
  display: inline-block; font-size: 11px;
  background: var(--teal-dim); color: var(--teal); border: 1px solid var(--teal-border);
  border-radius: 4px; padding: 2px 7px; margin: 1px 2px;
}
.no-tags { color: var(--text-muted); font-size: 13px; }
.date-cell { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.row-btn {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 12px; padding: 4px 8px; border-radius: 5px; cursor: pointer; margin-right: 4px;
  transition: all 0.1s;
}
.row-btn:hover { border-color: var(--teal-border); color: var(--teal); }

/* EMPTY STATE */
.empty-state {
  flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 20px; gap: 12px; text-align: center;
}
.empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-dim); }
.empty-sub { font-size: 14px; color: var(--text-muted); }

/* MODAL */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
}
.modal-panel {
  position: relative; z-index: 1;
  background: var(--surface); border: 1px solid var(--teal-border);
  border-radius: 16px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 20px rgba(0,245,255,0.05);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 20px; border-bottom: 1px solid var(--border);
}
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--text); }
.modal-close {
  background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text); }
.modal-form { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-family: var(--font-display); font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.07em; }
.required { color: var(--teal); }
.form-hint { font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; }
.form-input, .form-textarea {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; color: var(--text); font-size: 14px; font-family: var(--font-body);
  transition: border-color 0.15s; width: 100%;
}
.form-input:focus, .form-textarea:focus { outline: none; border-color: var(--teal-border); }
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.modal-footer {
  display: flex; align-items: center; gap: 10px; padding: 20px 28px 24px;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.btn-cancel {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 14px; font-family: var(--font-body); padding: 9px 20px; border-radius: 8px; cursor: pointer;
}
.btn-cancel:hover { border-color: var(--text-muted); color: var(--text); }
.btn-delete {
  background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #ef4444;
  font-size: 14px; font-family: var(--font-body); padding: 9px 20px; border-radius: 8px; cursor: pointer; margin-right: auto;
}
.btn-delete:hover { background: rgba(239,68,68,0.25); }
.btn-save {
  background: var(--teal); border: none; color: #0a0a0f;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; padding: 9px 24px; border-radius: 8px; cursor: pointer;
}
.btn-save:hover { opacity: 0.85; }

/* NOTES PANEL */
.notes-panel {
  position: fixed; inset: 0; z-index: 300; display: flex;
}
.notes-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.6);
}
.notes-body {
  position: relative; z-index: 1;
  background: var(--surface); border-left: 1px solid var(--teal-border);
  width: 400px; height: 100%; margin-left: auto;
  display: flex; flex-direction: column; padding: 28px;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
}
.notes-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.notes-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--text); }
.notes-close { background: none; border: none; color: var(--text-muted); font-size: 16px; cursor: pointer; }
.notes-contact-meta { margin-bottom: 20px; }
.notes-meta-row { display: flex; align-items: center; gap: 12px; }
.notes-meta-status { font-size: 13px; font-weight: 600; }
.notes-meta-date { font-size: 12px; color: var(--text-muted); }
.notes-textarea {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px; font-family: var(--font-body); line-height: 1.6;
  padding: 14px; resize: none; width: 100%; min-height: 300px;
}
.notes-textarea:focus { outline: none; border-color: var(--teal-border); }
.notes-save {
  margin-top: 16px; background: var(--teal); border: none; color: #0a0a0f;
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  padding: 11px; border-radius: 8px; cursor: pointer; width: 100%;
  box-shadow: 0 0 12px rgba(0,245,255,0.12);
}
.notes-save:hover { opacity: 0.85; }

/* RESPONSIVE */
@media (max-width: 900px) {
  .crm-layout { grid-template-columns: 1fr; }
  .crm-sidebar {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-direction: row; flex-wrap: wrap; gap: 12px;
  }
  .sidebar-filters { flex-direction: row; flex-wrap: wrap; }
  .form-row { grid-template-columns: 1fr; }
  .notes-body { width: 100%; }
}