/* ======================================================
   app.css — GrowthGrid dashboard application styles
   Uses design tokens from theme.css
   ====================================================== */

/* === LAYOUT === */
.app-layout {
  min-height: 100vh;
  background: var(--bg);
}

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* === NAV === */
.app-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  margin-right: 16px;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  transition: all 0.15s;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-home {
  color: var(--fg-dim);
  margin-left: auto;
}

.nav-biz {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg-muted);
  font-family: var(--font-display);
  white-space: nowrap;
}

.biz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* === DASHBOARD HEADER === */
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-top: 8px;
  flex-wrap: wrap;
  gap: 16px;
}

.dash-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.dash-sub {
  font-size: 14px;
  color: var(--fg-muted);
}

.live-badge {
  color: var(--accent);
}

.btn-simulate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-simulate:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.btn-simulate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* === TOAST === */
.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 24px;
  font-size: 14px;
  font-family: var(--font-display);
  z-index: 1000;
  max-width: 380px;
  animation: slideUp 0.3s ease;
}

.toast.hidden { display: none; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* === KPI ROW === */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.kpi-card.kpi-highlight {
  border-color: rgba(34, 197, 94, 0.3);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06), var(--bg-card));
}

.kpi-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-dim);
  margin-bottom: 8px;
}

.kpi-value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-value.accent, .accent { color: var(--accent); }
.red { color: var(--red); }

.kpi-sub {
  font-size: 12px;
  color: var(--fg-muted);
}

/* === PANELS === */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.mt-panel { margin-top: 0; }

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

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.badge-live {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(34,197,94,0.3);
  padding: 2px 8px;
  border-radius: 100px;
  letter-spacing: 0.05em;
}

.badge-auto {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--fg-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 100px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { box-shadow: 0 0 0 4px rgba(34,197,94,0); }
}

/* === PILLS === */
.spill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.spill-green { background: var(--accent-dim); color: var(--accent); border: 1px solid rgba(34,197,94,0.3); }
.spill-blue { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.spill-gray { background: var(--bg-elevated); color: var(--fg-muted); border: 1px solid var(--border); }
.spill-lg { padding: 6px 14px; font-size: 13px; }

/* === CALLS FEED === */
.calls-feed {
  overflow-y: auto;
  max-height: 420px;
}

.call-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.call-row:last-child { border-bottom: none; }
.call-row:hover { background: var(--bg-elevated); }
.call-row.recovered { background: rgba(34,197,94,0.03); }
.call-row.active-row { background: rgba(59,130,246,0.03); }

.call-icon { font-size: 18px; min-width: 24px; margin-top: 2px; }

.call-info { flex: 1; min-width: 0; }
.call-name { font-weight: 500; font-size: 14px; }
.call-phone { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.call-intent { font-size: 12px; color: var(--fg-dim); margin-top: 4px; font-style: italic; }

.call-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 80px; }
.call-time { font-size: 11px; color: var(--fg-dim); }
.call-speed { font-size: 11px; color: var(--accent); font-family: var(--font-display); font-weight: 600; }

/* === LEADS LIST === */
.leads-list {
  overflow-y: auto;
  max-height: 420px;
}

.lead-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  transition: background 0.15s;
}

.lead-row:last-child { border-bottom: none; }
.lead-row:hover { background: var(--bg-elevated); }

.lead-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.lead-info { flex: 1; min-width: 0; }
.lead-name { font-weight: 500; font-size: 14px; }
.lead-stage { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.lead-intent { font-size: 12px; color: var(--fg-dim); margin-top: 4px; font-style: italic; }

.lead-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lead-msgs { font-size: 11px; color: var(--fg-dim); }
.lead-value { font-size: 12px; font-family: var(--font-display); font-weight: 600; color: var(--accent); }

/* === SEQUENCE PANEL === */
.seq-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
}

.seq-steps-sidebar {
  padding: 20px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.seq-step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-bubble {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-muted);
  flex-shrink: 0;
}

.seq-step-row strong {
  font-size: 13px;
  display: block;
  margin-bottom: 3px;
}

.seq-step-row p {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.seq-events {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: flex-start;
}

.seq-event-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 160px;
}

.seq-event-card.sent {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.03);
}

.seq-event-step {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.seq-event-name { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.seq-event-phone { font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }

/* === CONVERSATION VIEW === */
.convo-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

.convo-sidebar {
  position: sticky;
  top: 80px;
}

.back-link {
  display: inline-block;
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.15s;
}

.back-link:hover { color: var(--fg); }

.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.lead-card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid rgba(34,197,94,0.3);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.lead-card-name { font-size: 18px; font-weight: 600; font-family: var(--font-display); margin-bottom: 4px; }
.lead-card-phone { font-size: 13px; color: var(--fg-muted); margin-bottom: 16px; }

.detail-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.detail-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.detail-value { font-size: 14px; }

.ai-note {
  display: flex;
  gap: 12px;
  background: var(--accent-dim);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 16px;
}

.ai-note-icon { font-size: 20px; }
.ai-note strong { font-size: 13px; display: block; margin-bottom: 4px; }
.ai-note p { font-size: 12px; color: var(--fg-muted); line-height: 1.5; }

.convo-main {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.convo-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.convo-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; }
.convo-meta { font-size: 12px; color: var(--fg-muted); }

.sms-thread {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 520px;
  overflow-y: auto;
}

.sms-empty { font-size: 14px; color: var(--fg-muted); text-align: center; padding: 40px 0; }

.sms-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 75%;
}

.sms-bubble-wrap.out { align-self: flex-end; align-items: flex-end; }
.sms-bubble-wrap.in { align-self: flex-start; align-items: flex-start; }

.sms-sender {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.sms-ai-badge {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(34,197,94,0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
}

.sms-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
}

.sms-out {
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}

.sms-in {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--fg);
  border-bottom-left-radius: 4px;
}

.sms-time {
  font-size: 11px;
  color: var(--fg-dim);
  margin-top: 4px;
}

.convo-status-bar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.convo-status-bar.booked {
  background: rgba(34,197,94,0.05);
  border-top-color: rgba(34,197,94,0.2);
}

.status-bar-icon { font-size: 20px; }
.convo-status-bar strong { font-size: 13px; display: block; margin-bottom: 4px; }
.convo-status-bar p { font-size: 12px; color: var(--fg-muted); line-height: 1.5; }

/* === ROI CALCULATOR === */
.roi-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

.roi-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}

.roi-panel-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

.roi-field { margin-bottom: 18px; }

.roi-label {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.roi-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  transition: border-color 0.15s;
}

.roi-input:focus {
  outline: none;
  border-color: var(--accent);
}

.roi-industry { margin-bottom: 24px; }

.roi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: transparent;
  color: var(--fg-muted);
  font-family: var(--font-display);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.btn-calculate {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-calculate:hover { background: #16a34a; }

.roi-baseline {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.roi-baseline-title {
  font-size: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  margin-bottom: 14px;
}

.roi-baseline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.roi-baseline-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rbi-label { font-size: 11px; color: var(--fg-muted); }
.rbi-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; }

/* ROI Results */
.roi-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.roi-result-hero {
  padding: 36px 32px;
  text-align: center;
  background: linear-gradient(135deg, var(--accent-dim), transparent);
  border-bottom: 1px solid var(--border);
}

.roi-result-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

.roi-result-big {
  font-family: var(--font-display);
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -0.03em;
}

.roi-result-sub { font-size: 14px; color: var(--fg-muted); }

.roi-result-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border);
}

.roi-result-card {
  padding: 20px 24px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.roi-result-card:last-child { border-right: none; }

.rrc-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  font-family: var(--font-display);
  font-weight: 600;
  margin-bottom: 8px;
}

.rrc-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
}

.roi-breakdown {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
}

.roi-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 15px;
}

.roi-breakdown-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

.roi-breakdown-total {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
}

.roi-multiple {
  padding: 28px 32px;
  text-align: center;
}

.roi-multiple-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.roi-multiple-value {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.roi-multiple-sub { font-size: 13px; color: var(--fg-muted); }

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .roi-layout { grid-template-columns: 1fr; }
  .convo-layout { grid-template-columns: 1fr; }
  .convo-sidebar { position: static; }
  .seq-layout { grid-template-columns: 1fr; }
  .seq-steps-sidebar { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 640px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .app-main { padding: 20px 16px 60px; }
  .roi-result-big { font-size: 48px; }
  .roi-result-row { grid-template-columns: 1fr; }
  .roi-result-card { border-right: none; border-bottom: 1px solid var(--border); }
  .nav-links { gap: 0; }
  .nav-biz { display: none; }
}

/* === LANDING PAGE ADDITIONS === */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
  margin-top: 8px;
}

.hero-cta:hover {
  background: #16a34a;
  transform: translateY(-1px);
}

.hero-cta-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 56px;
}

.hero-cta-sub {
  font-size: 13px;
  color: var(--fg-dim);
}
