/* LiftWatch Leads v2 — Professional Sales Tool */

:root {
  --status-new: #3b82f6;
  --status-contacted: #f59e0b;
  --status-quoted: #8b5cf6;
  --status-won: #22c55e;
  --status-lost: #ef4444;
  --status-not-interested: #64748b;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---- Panels & Cards ---- */

.panel {
  background: #1e293b;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(51,65,85,0.5);
}

.panel-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}

.kpi-card {
  background: #1e293b;
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid rgba(51,65,85,0.5);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.kpi-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

/* ---- Navigation ---- */

.tab-btn {
  color: #64748b;
  border-bottom-color: transparent;
}

.tab-btn.active {
  color: #22c55e;
  border-bottom-color: #22c55e;
}

.nav-tab {
  color: #64748b;
  border-bottom: 2px solid transparent;
}

.nav-tab.active {
  color: #e2e8f0;
  border-bottom-color: #e2e8f0;
}

/* ---- State Pills ---- */

.state-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 999px;
  background: #1e293b;
  color: #64748b;
  border: 1px solid #334155;
  transition: all 0.12s ease;
  cursor: pointer;
}

.state-pill:hover {
  background: #334155;
  color: #e2e8f0;
}

.state-pill.active {
  background: #22c55e;
  color: white;
  border-color: #22c55e;
}

/* ---- Filters ---- */

.filter-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

.filter-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  color: white;
  transition: border-color 0.12s;
}

.filter-input:focus {
  outline: none;
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
}

.filter-input::placeholder { color: #475569; }

/* ---- Buttons ---- */

.btn-primary {
  background: #22c55e;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.12s;
  border: none;
  cursor: pointer;
}

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

.btn-secondary {
  background: #334155;
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.12s;
  border: none;
  cursor: pointer;
}

.btn-secondary:hover { background: #475569; }

.page-btn {
  background: #1e293b;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #334155;
  cursor: pointer;
  transition: all 0.12s;
}

.page-btn:hover:not(:disabled) { background: #334155; color: white; }
.page-btn:disabled { opacity: 0.3; cursor: default; }

/* ---- Table ---- */

.tbl-th {
  padding: 10px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  user-select: none;
}

.tbl-th:hover { color: #e2e8f0; }

#table-body tr {
  cursor: pointer;
  transition: background 0.1s;
}

#table-body tr:hover {
  background: rgba(34,197,94,0.04);
}

/* ---- Status Badges ---- */

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-new { background: rgba(59,130,246,0.12); color: #60a5fa; }
.status-contacted { background: rgba(245,158,11,0.12); color: #fbbf24; }
.status-quoted { background: rgba(139,92,246,0.12); color: #a78bfa; }
.status-won { background: rgba(34,197,94,0.12); color: #4ade80; }
.status-lost { background: rgba(239,68,68,0.12); color: #f87171; }
.status-not_interested { background: rgba(100,116,139,0.15); color: #94a3b8; }

.source-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 500;
  background: rgba(100,116,139,0.15);
  color: #94a3b8;
}

/* ---- Bar Charts ---- */

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  min-width: 90px;
  text-align: right;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.bar-track {
  flex: 1;
  height: 24px;
  background: #0f172a;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  min-width: fit-content;
}

.bar-count {
  min-width: 32px;
  text-align: right;
  font-size: 0.75rem;
  font-weight: 600;
  color: #cbd5e1;
}

/* Bar colours */
.bar-nsw { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.bar-vic { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.bar-qld { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-wa { background: linear-gradient(90deg, #22c55e, #4ade80); }

.bar-new { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.bar-contacted { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-quoted { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.bar-won { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-lost { background: linear-gradient(90deg, #ef4444, #f87171); }
.bar-not_interested { background: linear-gradient(90deg, #475569, #64748b); }

.bar-5-7 { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-7-10 { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-10 { background: linear-gradient(90deg, #ef4444, #f87171); }
.bar-under-5 { background: linear-gradient(90deg, #64748b, #94a3b8); }

.bar-under-1m { background: linear-gradient(90deg, #64748b, #94a3b8); }
.bar-1-2m { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-2-5m { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.bar-5m { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* Storey bars (Tab 2) */
.bar-2st { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-3st { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.bar-4st { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* Generic value bars (dynamic keys) */
[class*="bar-val-"] { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.bar-val-under1m, .bar-val-under2m { background: linear-gradient(90deg, #64748b, #94a3b8); }
.bar-val-mid12m, .bar-val-mid23m { background: linear-gradient(90deg, #22c55e, #4ade80); }
.bar-val-high25m, .bar-val-high35m { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.bar-val-premium5m { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-container {
  background: #1e293b;
  border-radius: 16px;
  border: 1px solid rgba(51,65,85,0.5);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* ---- Comments ---- */

.comment-item {
  background: #0f172a;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid #1e293b;
}

.comment-author {
  font-size: 0.75rem;
  font-weight: 600;
  color: #22c55e;
}

.comment-time {
  font-size: 0.65rem;
  color: #475569;
}

.comment-text {
  font-size: 0.8rem;
  color: #cbd5e1;
  margin-top: 4px;
  line-height: 1.5;
}

/* ---- Activity Timeline ---- */

.timeline-item {
  display: flex;
  gap: 10px;
  padding: 6px 0;
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #334155;
  margin-top: 5px;
  flex-shrink: 0;
}

.timeline-dot.status_change { background: #3b82f6; }
.timeline-dot.note_added { background: #f59e0b; }
.timeline-dot.comment_added { background: #22c55e; }
.timeline-dot.exported { background: #8b5cf6; }

.timeline-text {
  font-size: 0.75rem;
  color: #94a3b8;
}

.timeline-time {
  font-size: 0.65rem;
  color: #475569;
}

/* ---- Leaflet Dark ---- */

.leaflet-container { background: #0f172a; }

.leaflet-tile {
  filter: brightness(0.65) invert(1) contrast(2.8) hue-rotate(200deg) saturate(0.25) brightness(0.75);
}

.leaflet-popup-content-wrapper {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.leaflet-popup-tip { background: #1e293b; }
.leaflet-popup-content a { color: #4ade80; }

/* ---- Scrollbar ---- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ---- Responsive ---- */

@media (max-width: 640px) {
  #map { height: 400px !important; }
  .kpi-value { font-size: 1.4rem; }
  .modal-container { padding: 16px; }
}

/* ---- Checkbox ---- */
input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Info Banners */
.info-banner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(30, 41, 59, 0.6));
  border: 1px solid rgba(71, 85, 105, 0.4);
  border-radius: 12px;
  padding: 14px 16px;
}
.info-banner:hover {
  border-color: rgba(71, 85, 105, 0.6);
}
