/* css/style.css */

:root {
  --amber:       #E8890C;
  --amber-light: #FFC04A;
  --amber-dim:   #7A480A;
  --bg:          #141412;
  --bg2:         #1e1e1a;
  --bg3:         #272722;
  --bg4:         #2f2f29;
  --text:        #f0ede4;
  --text2:       #a09c8e;
  --text3:       #6a6660;
  --border:      #38362e;
  --border2:     #4a4840;
  --green:       #3a8c4e;
  --green-light: #5ab96e;
  --red:         #c0392b;
  --red-light:   #e05a4b;
  --blue:        #2d6fa8;
  --blue-light:  #4a90d4;
  --radius:      6px;
  --radius-lg:   10px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: 80px;
}

/* ── HEADER ────────────────────────────────────────────────────────────── */
header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span { color: var(--amber); }

.logo-badge {
  background: var(--amber);
  color: var(--bg);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 1px;
}

#install-btn {
  background: var(--amber);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 6px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: none;
}

/* ── BOTTOM NAV ─────────────────────────────────────────────────────────── */
nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}

nav button {
  flex: 1;
  background: none;
  border: none;
  color: var(--text3);
  padding: 10px 4px 12px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}

nav button.active { color: var(--amber); }
nav button svg { width: 22px; height: 22px; }

/* ── MAIN / TABS ────────────────────────────────────────────────────────── */
main { max-width: 680px; margin: 0 auto; padding: 16px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── CARD ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 12px;
}

/* ── STATS ──────────────────────────────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.stat {
  background: var(--bg3);
  border-radius: var(--radius);
  padding: 12px 10px;
  text-align: center;
}

.stat-num {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: var(--amber);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ── LABELS ─────────────────────────────────────────────────────────────── */
.section-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 10px;
  margin-top: 4px;
}

/* ── PILLS ──────────────────────────────────────────────────────────────── */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pill {
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
  background: none;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.15s;
}

.pill.active {
  background: var(--amber);
  color: var(--bg);
  border-color: var(--amber);
  font-weight: 500;
}

.pill:hover:not(.active) {
  border-color: var(--amber-dim);
  color: var(--text);
}

/* ── SEARCH LINK BUTTONS ─────────────────────────────────────────────────── */
.search-link-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}

.search-link-btn:hover {
  border-color: var(--amber-dim);
  background: var(--bg4);
}

.icon-box {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--bg4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-info { flex: 1; text-align: left; }
.link-title { font-size: 14px; color: var(--text); }
.link-sub   { font-size: 12px; color: var(--text3); margin-top: 1px; }
.arrow      { color: var(--text3); font-size: 14px; }

/* ── FORM ELEMENTS ──────────────────────────────────────────────────────── */
input[type="text"],
select,
textarea {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--text);
  padding: 9px 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  width: 100%;
  outline: none;
}

input[type="text"]:focus,
select:focus,
textarea:focus { border-color: var(--amber-dim); }

select option { background: var(--bg3); }
textarea { resize: vertical; min-height: 70px; }

.query-preview {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--amber-light);
  font-family: monospace;
}

/* ── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  background: var(--amber);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 9px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.9; }

.btn-secondary {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
}

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

/* ── LEADS ──────────────────────────────────────────────────────────────── */
.lead-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.lead-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.lead-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.lead-cat {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  flex-shrink: 0;
}

.cat-contractor { background: #2a3f5f; color: #6aadee; }
.cat-carpenter  { background: #3a2e1a; color: #d4953a; }
.cat-flooring   { background: #1e3a2a; color: #5ab96e; }
.cat-handyman   { background: #3a1e3a; color: #c47bde; }
.cat-other      { background: var(--bg3); color: var(--text2); }

.lead-desc {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 8px;
  line-height: 1.5;
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--text3);
  align-items: center;
}

.lead-meta span { display: flex; align-items: center; gap: 4px; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-new       { background: var(--amber); }
.status-contacted { background: var(--blue-light); }
.status-quoted    { background: #9b59b6; }
.status-won       { background: var(--green-light); }
.status-lost      { background: var(--red-light); }

.lead-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.status-select {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
}

/* ── FORMS ──────────────────────────────────────────────────────────────── */
.form-row   { margin-bottom: 12px; }
.form-label {
  font-size: 12px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 5px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── MISC ───────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text3);
}

.empty-state .big-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

.loading {
  text-align: center;
  color: var(--text3);
  font-size: 13px;
  padding: 20px 0;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.group-scroll { max-height: 340px; overflow-y: auto; }

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter-bar select { width: auto; flex: 1; min-width: 120px; }

.count-badge {
  background: var(--bg3);
  color: var(--text2);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
}

.tips-body {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.8;
}

.tips-body p { margin-bottom: 10px; }
.tips-body p:last-child { margin-bottom: 0; }
.tips-body strong { color: var(--amber); font-weight: 500; }

/* ── TOAST ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg4);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
}

#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid  { grid-template-columns: 1fr; }
  .stat-num   { font-size: 22px; }
}
