/* ══════════════════════════════════════════════════════════════════════════════
   Lead Finder Tool — Stylesheet
   Aesthetic: Refined dark intelligence terminal — precise, data-dense, elegant
   Font: Space Mono + DM Sans
   ══════════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

/* ── CSS Variables ─────────────────────────────────────────────────────────── */
:root {
  /* Core palette */
  --bg-base:        #0a0c10;
  --bg-surface:     #111318;
  --bg-raised:      #181c23;
  --bg-hover:       #1e2330;
  --border:         rgba(255,255,255,0.06);
  --border-accent:  rgba(99,179,237,0.25);

  /* Text */
  --text-primary:   #e8eaf0;
  --text-secondary: #8892a4;
  --text-muted:     #4d5568;
  --text-code:      #a8d8ff;

  /* Accent */
  --accent:         #3b82f6;
  --accent-bright:  #60a5fa;
  --accent-glow:    rgba(59,130,246,0.15);
  --accent-dim:     rgba(59,130,246,0.08);
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;

  /* Sizing */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  16px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);

  /* Fonts */
  --font-sans:  'DM Sans', system-ui, sans-serif;
  --font-mono:  'Space Mono', 'Courier New', monospace;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%, rgba(59,130,246,0.08) 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 80px, rgba(255,255,255,0.012) 80px, rgba(255,255,255,0.012) 81px),
    repeating-linear-gradient(90deg, transparent, transparent 80px, rgba(255,255,255,0.012) 80px, rgba(255,255,255,0.012) 81px);
}

/* ── Header / Wordmark ─────────────────────────────────────────────────────── */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  background: rgba(10,12,16,0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  height: 60px;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.wordmark-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 0 16px rgba(59,130,246,0.4);
}

.wordmark-text {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.wordmark-text span {
  color: var(--accent-bright);
}

.header-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.25rem;
}

.header-tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.4); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 4px rgba(16,185,129,0); }
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

/* ── Hero / Title ──────────────────────────────────────────────────────────── */
.hero {
  margin-bottom: 2.5rem;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: var(--accent);
}

.hero-title {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.hero-title em {
  font-style: normal;
  color: var(--accent-bright);
}

.hero-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 520px;
}

/* ── Search Panel ──────────────────────────────────────────────────────────── */
.search-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.search-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent-bright) 50%, var(--accent) 70%, transparent 100%);
  opacity: 0.5;
}

.search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

/* ── Form Elements ─────────────────────────────────────────────────────────── */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.field-label .label-icon {
  opacity: 0.7;
  font-size: 0.75rem;
}

.field-input {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.7rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  outline: none;
  width: 100%;
}

.field-input::placeholder {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.field-input:focus {
  border-color: var(--accent);
  background: var(--bg-raised);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ── Platform Checkboxes ───────────────────────────────────────────────────── */
.platforms-section {
  margin-bottom: 1.75rem;
}

.platforms-label {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.75rem;
  display: block;
}

.platforms-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.platform-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.45rem 0.9rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.18s ease;
  user-select: none;
}

.platform-chip:hover {
  border-color: rgba(255,255,255,0.15);
  background: var(--bg-raised);
}

.platform-chip input[type="checkbox"] {
  display: none;
}

.platform-chip input[type="checkbox"]:checked + .chip-inner {
  color: var(--text-primary);
}

.platform-chip:has(input:checked) {
  background: var(--accent-dim);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.chip-inner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.18s;
}

.chip-inner .chip-icon {
  font-size: 0.85rem;
}

.chip-check {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  font-size: 0.65rem;
  color: transparent;
  background: transparent;
}

.platform-chip:has(input:checked) .chip-check {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Action Bar ────────────────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 3px rgba(59,130,246,0.4), 0 0 20px rgba(59,130,246,0.2);
}

.btn-primary:hover {
  background: var(--accent-bright);
  box-shadow: 0 2px 8px rgba(59,130,246,0.5), 0 0 24px rgba(59,130,246,0.3);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
}

.btn-icon {
  font-size: 1rem;
  line-height: 1;
}

/* ── Loading State ─────────────────────────────────────────────────────────── */
.loading-overlay {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.loading-overlay.active {
  display: block;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.25rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.loader-status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  animation: blink-text 1.5s ease-in-out infinite;
}

@keyframes blink-text {
  0%, 100% { opacity: 0.6; }
  50%       { opacity: 1; }
}

.loader-steps {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.loader-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.loader-step .step-icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  transition: all 0.3s;
}

.loader-step.active .step-icon {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent-bright);
  box-shadow: 0 0 8px var(--accent-glow);
}

.loader-step.done .step-icon {
  border-color: var(--success);
  background: rgba(16,185,129,0.1);
  color: var(--success);
}

/* ── Results Section ───────────────────────────────────────────────────────── */
#results-section {
  display: none;
}

#results-section.visible {
  display: block;
  animation: fade-in 0.4s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.results-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.results-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.results-count {
  font-size: 0.72rem;
  background: var(--accent-dim);
  color: var(--accent-bright);
  border: 1px solid var(--accent-border, rgba(59,130,246,0.2));
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-weight: 700;
}

.results-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: auto;
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  overflow-x: auto;
  background: var(--bg-surface);
}

.leads-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 720px;
}

.leads-table thead tr {
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
}

.leads-table thead th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.leads-table thead th:first-child { padding-left: 1.25rem; }

.leads-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.leads-table tbody tr:last-child {
  border-bottom: none;
}

.leads-table tbody tr:hover {
  background: var(--bg-hover);
}

.leads-table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  color: var(--text-secondary);
}

.leads-table td:first-child { padding-left: 1.25rem; }

/* ── Table Cell: Name ──────────────────────────────────────────────────────── */
.lead-name {
  font-weight: 500;
  color: var(--text-primary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Table Cell: URL ───────────────────────────────────────────────────────── */
.lead-url-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 220px;
}

.lead-url {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
  max-width: 170px;
  display: block;
}

.lead-url:hover { text-decoration: underline; }

.btn-open {
  flex-shrink: 0;
  padding: 0.2rem 0.45rem;
  font-size: 0.65rem;
  border-radius: 4px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
}

.btn-open:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
}

/* ── Platform Badge ─────────────────────────────────────────────────────────── */
.platform-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-wix        { background: rgba(251,187,0,0.1);   color: #fbbf24; border: 1px solid rgba(251,187,0,0.2); }
.badge-squarespace{ background: rgba(16,185,129,0.1);  color: #34d399; border: 1px solid rgba(16,185,129,0.2); }
.badge-shopify    { background: rgba(149,216,104,0.1); color: #86efac; border: 1px solid rgba(149,216,104,0.2); }
.badge-wordpress  { background: rgba(59,130,246,0.1);  color: #93c5fd; border: 1px solid rgba(59,130,246,0.2); }
.badge-godaddy    { background: rgba(249,115,22,0.1);  color: #fb923c; border: 1px solid rgba(249,115,22,0.2); }
.badge-webflow    { background: rgba(139,92,246,0.1);  color: #c4b5fd; border: 1px solid rgba(139,92,246,0.2); }
.badge-unknown    { background: rgba(255,255,255,0.04); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Email Cell ─────────────────────────────────────────────────────────────── */
.lead-email-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lead-email {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--success);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-empty {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.btn-copy {
  flex-shrink: 0;
  padding: 0.15rem 0.4rem;
  font-size: 0.6rem;
  border-radius: 3px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.4;
}

.btn-copy:hover {
  border-color: var(--success);
  color: var(--success);
}

.btn-copy.copied {
  border-color: var(--success);
  color: var(--success);
  background: rgba(16,185,129,0.08);
}

/* ── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
}

.empty-icon {
  font-size: 2.5rem;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.empty-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Error Banner ───────────────────────────────────────────────────────────── */
.error-banner {
  display: none;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  color: #fca5a5;
  font-size: 0.82rem;
  align-items: flex-start;
  gap: 0.75rem;
}

.error-banner.visible {
  display: flex;
}

.error-icon {
  font-size: 1rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

/* ── Row index ──────────────────────────────────────────────────────────────── */
.row-idx {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  width: 30px;
  text-align: right;
  padding-right: 0.5rem !important;
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 2rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-wrapper { padding: 1.5rem 1rem 3rem; }
  .search-grid { grid-template-columns: 1fr; gap: 1rem; }
  .hero-title { font-size: 1.5rem; }
  .results-header { gap: 0.75rem; }
  .results-meta { display: none; }
  .action-bar { gap: 0.6rem; }
  .header-status { display: none; }
  .search-panel { padding: 1.5rem; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 1.25rem; }
  .platforms-grid { gap: 0.4rem; }
  .platform-chip { padding: 0.35rem 0.7rem; }
}

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
