/* =========================================================
   dashboard.css — CallCatchr demo dashboard styles
   Extends theme.css — never redefines CSS custom properties.
   ========================================================= */

/* ── RESET / BASE ────────────────────────────────────────── */
.dashboard-body {
  background: var(--bg-dark);
  color: var(--fg);
  font-family: var(--font-body);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── NAV ─────────────────────────────────────────────────── */
.dash-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-dark);
  flex-shrink: 0;
  z-index: 10;
}

.dash-nav-brand {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.dash-nav-brand:hover { color: var(--accent); }

.dash-nav-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.demo-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  padding: 3px 12px;
  border-radius: 100px;
}

.dash-nav-actions {
  display: flex;
  gap: 8px;
}

.btn-business {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-business:hover,
.btn-business.active {
  border-color: var(--accent-dim);
  color: var(--accent);
  background: var(--accent-glow);
}

/* ── STATS BAR ───────────────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 18px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 90px;
}
.stat-pill.accent { border-color: var(--border-accent); background: var(--bg-highlight); }

.stat-pill-val {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
}
.stat-pill.accent .stat-pill-val { color: var(--accent); }

.stat-pill-lbl {
  font-size: 0.72rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.stats-bar-spacer { flex: 1; }

.btn-simulate {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: #0a0a0b;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-simulate:hover { background: var(--accent-dim); transform: translateY(-1px); }
.btn-simulate:active { transform: translateY(0); }
.btn-simulate:disabled { opacity: 0.5; cursor: not-allowed; }

.simulate-dot {
  width: 8px; height: 8px;
  background: #0a0a0b;
  border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* ── MAIN GRID ───────────────────────────────────────────── */
.dash-main {
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  flex: 1;
  overflow: hidden;
}

/* ── SHARED PANEL ────────────────────────────────────────── */
.call-list-panel,
.thread-panel,
.activity-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.call-list-panel,
.activity-panel {
  border-right: 1px solid var(--border);
  background: var(--bg-card);
}

.activity-panel { border-right: none; border-left: 1px solid var(--border); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-muted);
}

.panel-subtitle {
  font-size: 0.78rem;
  color: var(--fg-dim);
}

.live-dot-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--accent);
}

.live-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── CALL LIST ───────────────────────────────────────────── */
.call-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.call-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  position: relative;
}
.call-item:hover { background: var(--bg-card-hover); }
.call-item.selected { background: var(--bg-highlight); border-left: 2px solid var(--accent); }

.call-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.call-item-name {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-item-time {
  font-size: 0.74rem;
  color: var(--fg-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.call-item-phone {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.call-item-preview {
  font-size: 0.8rem;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.call-status-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.badge-texted    { background: rgba(74,222,128,0.12); color: #4ade80; }
.badge-responding{ background: rgba(251,191,36,0.12); color: #fbbf24; }
.badge-converted { background: rgba(74,222,128,0.2);  color: #4ade80; border: 1px solid var(--border-accent); }
.badge-missed    { background: rgba(239,68,68,0.1);   color: #ef4444; }

.loading-row {
  padding: 24px 18px;
  font-size: 0.85rem;
  color: var(--fg-dim);
  text-align: center;
}

/* ── THREAD PANEL ────────────────────────────────────────── */
.thread-panel { background: var(--bg-dark); }

.thread-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  text-align: center;
}
.thread-empty-icon { font-size: 2.5rem; }
.thread-empty-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-muted);
}
.thread-empty-sub {
  font-size: 0.85rem;
  color: var(--fg-dim);
  max-width: 300px;
  line-height: 1.6;
}

.thread-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.thread-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-card);
}

.thread-header-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}
.thread-header-phone {
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-top: 2px;
}
.thread-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.thread-header-time {
  font-size: 0.78rem;
  color: var(--fg-dim);
}

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.msg-bubble-wrap.outbound { align-items: flex-start; }
.msg-bubble-wrap.inbound  { align-items: flex-end; }

.msg-role {
  font-size: 0.72rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 4px;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}
.outbound .msg-bubble {
  background: var(--bg-highlight);
  border: 1px solid var(--border-accent);
  color: var(--fg);
  border-radius: 12px 12px 12px 2px;
}
.inbound .msg-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  border-radius: 12px 12px 2px 12px;
}

.msg-time {
  font-size: 0.7rem;
  color: var(--fg-dim);
  padding: 0 4px;
}

.msg-bubble.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
}
.typing-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-5px); opacity: 1; }
}

/* Reply bar */
.thread-reply-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.thread-reply-input {
  flex: 1;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 8px 14px;
  outline: none;
  transition: border-color 0.15s;
}
.thread-reply-input:focus { border-color: var(--accent-dim); }

.btn-send {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: #0a0a0b;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-send:hover { background: var(--accent-dim); }

.thread-reply-hint {
  padding: 6px 16px 10px;
  font-size: 0.74rem;
  color: var(--fg-dim);
  text-align: center;
  background: var(--bg-card);
  border-top: 1px solid transparent;
}

/* ── ACTIVITY FEED ───────────────────────────────────────── */
.activity-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.activity-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.activity-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.activity-icon { font-size: 0.9rem; }

.activity-text {
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.4;
  flex: 1;
}
.activity-text strong { color: var(--fg); font-weight: 600; }

.activity-time {
  font-size: 0.72rem;
  color: var(--fg-dim);
  white-space: nowrap;
}

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 0.88rem;
  color: var(--fg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  transform: translateY(20px);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  max-width: 320px;
  z-index: 100;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-headline {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

/* Scrollbars */
.call-list::-webkit-scrollbar,
.thread-messages::-webkit-scrollbar,
.activity-feed::-webkit-scrollbar { width: 4px; }
.call-list::-webkit-scrollbar-track,
.thread-messages::-webkit-scrollbar-track,
.activity-feed::-webkit-scrollbar-track { background: transparent; }
.call-list::-webkit-scrollbar-thumb,
.thread-messages::-webkit-scrollbar-thumb,
.activity-feed::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .dash-main { grid-template-columns: 260px 1fr; }
  .activity-panel { display: none; }
}
@media (max-width: 640px) {
  .dash-main { grid-template-columns: 1fr; }
  .call-list-panel { max-height: 40vh; }
  .dashboard-body { height: auto; overflow: auto; }
  .dash-nav-actions { gap: 4px; }
  .btn-business { font-size: 0.75rem; padding: 5px 10px; }
}
