/* GetCarLeads Dialer Styles */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #242836;
  --border: #2d3140;
  --text: #e4e6ed;
  --text-dim: #8b8fa3;
  --accent: #4f8cff;
  --accent-hover: #6fa1ff;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --orange: #fb923c;
  --purple: #a78bfa;
  --radius: 8px;
  --radius-sm: 4px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- Top Bar ---- */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 20px; }
.logo-text { font-size: 16px; font-weight: 600; }

.top-right { display: flex; align-items: center; gap: 16px; }

.connection-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim);
}

.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--red);
  display: inline-block;
  animation: pulse 2s infinite;
}
.status-dot.green { background: var(--green); animation: none; }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); animation: pulse 1s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.recording-toggle label {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; cursor: pointer; color: var(--text-dim);
}
.recording-toggle input { cursor: pointer; }

/* ---- Main Grid ---- */
.main-grid {
  display: grid;
  grid-template-columns: 320px 1fr 380px;
  flex: 1;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.panel:last-child { border-right: none; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-header h2 { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- Queue Panel ---- */
.queue-controls {
  display: flex; gap: 6px; align-items: center;
}

.input-sm {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 12px; width: 140px;
  outline: none;
}
.input-sm:focus { border-color: var(--accent); }

.queue-list {
  flex: 1; overflow-y: auto; padding: 4px;
}

.queue-item {
  padding: 10px 12px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid transparent; margin-bottom: 2px; transition: all 0.15s;
}
.queue-item:hover { background: var(--surface-2); }
.queue-item.active { background: var(--surface-2); border-color: var(--accent); }
.queue-item .name { font-size: 14px; font-weight: 500; }
.queue-item .phone { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.queue-item .domain { font-size: 11px; color: var(--accent); margin-top: 2px; }

/* Recent calls collapsible */
.recent-calls-section { border-top: 1px solid var(--border); flex-shrink: 0; }
.collapsible-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px; background: none; border: none; color: var(--text-dim);
  font-size: 12px; font-weight: 600; cursor: pointer; width: 100%;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.collapsible-header:hover { color: var(--text); }
.chevron { transition: transform 0.2s; }
.chevron.open { transform: rotate(90deg); }

.recent-list {
  max-height: 200px; overflow-y: auto; padding: 4px;
}

.recent-item {
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12px; margin-bottom: 2px; display: flex; justify-content: space-between;
}
.recent-item:hover { background: var(--surface-2); }
.recent-item .disp-badge {
  padding: 1px 6px; border-radius: 10px; font-size: 10px; font-weight: 600;
}
.disp-no_answer { background: #374151; color: #9ca3af; }
.disp-voicemail { background: #1e3a5f; color: #60a5fa; }
.disp-gatekeeper { background: #3b2f63; color: #a78bfa; }
.disp-manager_identified { background: #14532d; color: #4ade80; }
.disp-not_interested { background: #7f1d1d; color: #fca5a5; }
.disp-callback { background: #713f12; color: #fbbf24; }
.disp-appointment { background: #064e3b; color: #34d399; }

/* ---- Dossier Panel ---- */
.dossier-content {
  flex: 1; overflow-y: auto; padding: 16px;
}

.dossier-header { margin-bottom: 16px; }
.dossier-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.dossier-header .company-domain { color: var(--accent); font-size: 13px; }
.dossier-header .company-phone { color: var(--text-dim); font-size: 13px; }

.dossier-section { margin-bottom: 20px; }
.dossier-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 8px; }

.opportunity-card {
  background: var(--surface-2); border-radius: var(--radius); padding: 12px;
  margin-bottom: 8px;
}
.opportunity-card .stage {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; background: var(--accent); color: white;
}

.note-card {
  background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px;
  margin-bottom: 6px; font-size: 13px;
}
.note-card .note-time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.load-more-btn {
  background: none; border: 1px solid var(--border); color: var(--text-dim);
  padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
  width: 100%; margin-top: 4px;
}
.load-more-btn:hover { color: var(--text); border-color: var(--accent); }

/* ---- Call Panel ---- */
.call-status {
  text-align: center; padding: 20px 16px; font-size: 18px; font-weight: 600;
}
.call-status.ringing { color: var(--yellow); }
.call-status.connected { color: var(--green); }
.call-status.ended { color: var(--text-dim); }

.call-timer {
  font-family: var(--mono); font-size: 18px; font-weight: 600; color: var(--green);
}

.call-info {
  padding: 0 16px 12px; font-size: 13px; color: var(--text-dim);
}
.call-detail { margin-bottom: 4px; }

.call-actions {
  display: flex; flex-direction: column; gap: 8px; padding: 16px;
}

.btn {
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; cursor: pointer;
  transition: all 0.15s; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { border-color: var(--accent); background: var(--surface); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

kbd {
  display: inline-block; padding: 1px 6px; border-radius: 3px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 11px; font-family: var(--mono); color: var(--text-dim);
  margin-left: 4px;
}

.btn-call {
  background: #065f46; border-color: #059669; color: white; font-size: 16px; font-weight: 600;
}
.btn-call:hover:not(:disabled) { background: #047857; }
.btn-call:disabled { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }

.btn-hangup {
  background: #7f1d1d; border-color: #dc2626; color: white; font-size: 16px; font-weight: 600;
}
.btn-hangup:hover { background: #991b1b; }

.btn-mute { font-size: 14px; }
.btn-mute.muted { background: var(--red); border-color: var(--red); color: white; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Notes */
.notes-section {
  padding: 0 16px; margin-top: 8px;
}
.notes-section label { font-size: 12px; color: var(--text-dim); display: block; margin-bottom: 4px; }
.notes-section textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 13px; font-family: var(--font); resize: vertical;
  outline: none;
}
.notes-section textarea:focus { border-color: var(--accent); }

/* Disposition */
.disposition-section {
  padding: 16px; border-top: 1px solid var(--border);
}
.disposition-section h3 {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-dim); margin-bottom: 8px;
}

.disposition-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}

.disp-btn { font-size: 12px; padding: 8px 10px; }
.disp-appt { grid-column: 1 / -1; background: #065f46; border-color: #059669; }
.disp-appt:hover { background: #047857; }

.btn-skip {
  margin-top: 8px; width: 100%; color: var(--text-dim); font-size: 12px;
}

/* ---- Bottom Bar ---- */
.bottom-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--surface); border-top: 1px solid var(--border);
  flex-shrink: 0; font-size: 13px;
}

.stats { display: flex; gap: 20px; color: var(--text-dim); }
.stats strong { color: var(--text); }

.number-pool { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.number-item {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 12px; font-size: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.number-item.flagged { opacity: 0.5; text-decoration: line-through; }
.number-item .flag-btn {
  background: none; border: none; color: var(--red); cursor: pointer; font-size: 12px;
  padding: 0 2px;
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}

.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  width: 480px; max-height: 90vh; overflow-y: auto;
}
.modal-sm { width: 360px; }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border);
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
.form-group input, .form-group textarea {
  width: 100%; padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); font-size: 14px; font-family: var(--font); outline: none;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); }

.btn-primary { background: var(--accent); border-color: var(--accent); color: white; font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border); }

/* ---- Toasts ---- */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}

.toast {
  padding: 10px 16px; border-radius: var(--radius); font-size: 13px;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3); max-width: 320px;
  animation: slideIn 0.2s ease-out;
}
.toast.error { border-color: var(--red); color: var(--red); }
.toast.success { border-color: var(--green); color: var(--green); }
.toast.info { border-color: var(--accent); color: var(--accent); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- Empty State ---- */
.empty-state {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text-dim); font-size: 14px;
  text-align: center; padding: 32px;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
