/* App-specific styles (dashboard, lead detail).
   Inherits design tokens from theme.css. */

/* ============ NAV ============ */
.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-brand::before {
  content: '⚡ ';
  color: var(--speed-yellow);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
  color: var(--fg);
}

/* ============ MAIN LAYOUT ============ */
.app-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* ============ DASH STATS ============ */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.dash-stat {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.dash-stat--hot { border-color: rgba(251, 191, 36, 0.3); }
.dash-stat--warm { border-color: rgba(59, 130, 246, 0.25); }
.dash-stat--cold { border-color: rgba(148, 163, 184, 0.2); }

.dash-stat-value {
  display: block;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 0.4rem;
}

.dash-stat-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 500;
}

/* ============ CARD ============ */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
}

/* ============ LEADS TABLE ============ */
.leads-table {
  width: 100%;
  border-collapse: collapse;
}

.leads-table th {
  text-align: left;
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.leads-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}

.lead-row:last-child td { border-bottom: none; }
.lead-row:hover td { background: rgba(255,255,255,0.02); }

.lead-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.lead-email {
  font-size: 0.8rem;
  color: var(--accent-bright);
}

.lead-company {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 0.1rem;
}

.lead-time {
  font-size: 0.8rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.msg-count {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  color: var(--accent-bright);
}

/* ============ STATUS BADGES ============ */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-lg {
  padding: 8px 18px;
  font-size: 0.9rem;
}

.status-hot { background: rgba(251, 191, 36, 0.12); color: var(--speed-yellow); border: 1px solid rgba(251,191,36,0.3); }
.status-warm { background: rgba(59, 130, 246, 0.1); color: var(--accent-bright); border: 1px solid rgba(59,130,246,0.25); }
.status-cold { background: rgba(148, 163, 184, 0.08); color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }
.status-new { background: rgba(52, 211, 153, 0.1); color: var(--success); border: 1px solid rgba(52,211,153,0.25); }

/* ============ SCORE BAR ============ */
.score-bar {
  width: 80px;
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.score-bar--lg {
  width: 100%;
  height: 8px;
  display: block;
  margin: 0.75rem 0 1rem;
}

.score-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-radius: 100px;
  transition: width 0.5s ease;
}

.score-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-bright);
  vertical-align: middle;
}

/* ============ BUTTON ============ */
.btn-view {
  display: inline-block;
  padding: 6px 14px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  color: var(--accent-bright);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.btn-view:hover {
  background: rgba(59,130,246,0.1);
  border-color: var(--accent);
}

.btn-primary {
  display: inline-block;
  padding: 10px 22px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  font-family: inherit;
}

.btn-primary:hover { background: var(--accent-bright); transform: translateY(-1px); }

/* ============ DETAIL VIEW ============ */
.detail-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.qual-score-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 0.25rem;
}

.qual-score-num {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--accent-bright);
  line-height: 1;
}

.qual-score-label {
  font-size: 1rem;
  color: var(--fg-muted);
}

.qual-summary {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.lead-meta { margin-top: 1rem; }

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  gap: 1rem;
}

.meta-row:last-child { border-bottom: none; }

.meta-label {
  font-size: 0.8rem;
  color: var(--fg-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.meta-value {
  font-size: 0.85rem;
  color: var(--fg);
  text-align: right;
}

/* ============ MESSAGES ============ */
.messages {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 600px;
  overflow-y: auto;
}

.message {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  max-width: 85%;
}

.message--inbound {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  align-self: flex-start;
}

.message--outbound {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  align-self: flex-end;
}

.msg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 1rem;
}

.msg-direction {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
}

.msg-time {
  font-size: 0.72rem;
  color: var(--fg-muted);
}

.msg-body {
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-messages {
  color: var(--fg-muted);
  font-size: 0.9rem;
  padding: 2rem;
  text-align: center;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state p { color: var(--fg-muted); font-size: 0.95rem; }
.empty-state a { color: var(--accent-bright); }

/* ============ DEMO PAGE ============ */
.demo-form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.demo-form input, .demo-form textarea {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  transition: border-color 0.2s;
  outline: none;
  resize: vertical;
}

.demo-form input:focus, .demo-form textarea:focus {
  border-color: var(--accent);
}

.demo-result {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: 10px;
  font-size: 0.9rem;
  color: var(--success);
  display: none;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .app-main { padding: 1.5rem 1rem; }
  .leads-table th:nth-child(4),
  .leads-table td:nth-child(4) { display: none; }
}
