/* Lead Finder — Design System & Styles
   Mobile-first, clean, Apple/Stripe-level aesthetic
   Accent: Crisp Teal / Emerald (#0d9488)
*/

:root {
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --primary-border: #99f6e4;
  --primary-text: #115e59;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --text-inverse: #ffffff;

  --border-light: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-focus: #0d9488;

  --success-bg: #ecfdf5;
  --success-text: #047857;
  --success-border: #a7f3d0;

  --warning-bg: #fffbeb;
  --warning-text: #b45309;
  --warning-border: #fde68a;

  --danger-bg: #fef2f2;
  --danger-text: #b91c1c;
  --danger-border: #fecaca;

  --info-bg: #eff6ff;
  --info-text: #1d4ed8;
  --info-border: #bfdbfe;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container */
.app-container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

/* Header */
.app-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-identity {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), #047857);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 20px;
  box-shadow: var(--shadow-sm);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-text p {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Demo Banner */
.demo-banner {
  display: none;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  color: #92400e;
  box-shadow: var(--shadow-sm);
  align-items: flex-start;
  gap: 12px;
}

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

.demo-banner-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.demo-banner-content {
  flex: 1;
}

.demo-banner-title {
  font-weight: 600;
  margin-bottom: 2px;
  color: #78350f;
}

.demo-banner-text {
  font-size: 0.8125rem;
  color: #92400e;
}

/* Tab Navigation */
.nav-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  min-height: 42px;
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}

.tab-count {
  background: var(--primary-light);
  color: var(--primary-text);
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  font-weight: 700;
}

/* Card Surface */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}

/* Search Form */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label-hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-subtle);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-subtle);
  pointer-events: none;
  font-size: 1rem;
}

.input-field {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px 10px 38px;
  font-size: 0.9375rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
}

.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

/* Quick Chips */
.quick-chips-wrapper {
  margin-top: 4px;
}

.chips-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
  margin-bottom: 6px;
}

.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.chip-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.chip-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary-text);
  font-weight: 600;
}

/* City suggestions */
.city-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.city-suggestion-btn {
  background: transparent;
  border: 1px dashed var(--border-light);
  color: var(--text-subtle);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.city-suggestion-btn:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-light);
}

/* Filter Grid */
.filters-section {
  padding-top: 10px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review-slider-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.review-number-input {
  width: 80px;
  min-height: 38px;
  padding: 6px 8px;
  font-size: 0.875rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 600;
}

/* Toggle Switch */
.toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  min-height: 38px;
}

.toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.2s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 44px;
  font-family: inherit;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hover);
}

.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary-light);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

/* History Bar */
.history-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.history-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-subtle);
  white-space: nowrap;
}

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.history-item:hover {
  border-color: var(--primary);
  color: var(--primary-text);
}

/* Results Toolbar */
.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding: 8px 0;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.results-badge {
  background: var(--primary-light);
  color: var(--primary-text);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.results-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Lead Cards Grid */
.leads-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .leads-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Lead Card */
.lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.lead-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.lead-business-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.lead-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary-text);
  border: 1px solid var(--primary-border);
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-open {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.status-closed {
  background: var(--bg-subtle);
  color: var(--text-subtle);
  border: 1px solid var(--border-light);
}

.bookmark-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--text-subtle);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.bookmark-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.bookmark-btn.saved {
  color: #f59e0b;
}

/* Card Body Details */
.lead-info-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.84375rem;
  color: var(--text-muted);
}

.lead-info-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.lead-info-icon {
  font-size: 0.9375rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.lead-rating-stars {
  color: #f59e0b;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.lead-review-count {
  color: var(--text-subtle);
  font-weight: 500;
}

/* Verification Badges Section */
.verification-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.verification-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.verification-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.verification-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.badge-ok {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-down {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-none {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.badge-checking {
  background: var(--info-bg);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.badge-unverified {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

/* Instagram section */
.ig-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.ig-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ig-handle-link {
  font-weight: 600;
  color: #db2777;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8125rem;
}

.ig-handle-link:hover {
  text-decoration: underline;
}

.manual-ig-row {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.manual-ig-input {
  flex: 1;
  min-height: 32px;
  padding: 4px 8px;
  font-size: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
}

.manual-ig-input:focus {
  border-color: var(--primary);
}

/* Card Actions Grid (Thumb friendly) */
.lead-card-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.action-btn {
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.12s ease;
}

.action-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-hover);
}

.action-whatsapp {
  background: #25d366;
  color: white;
  border-color: #22c55e;
}

.action-whatsapp:hover {
  background: #1eb855;
  color: white;
}

.action-call {
  background: var(--primary-light);
  color: var(--primary-text);
  border-color: var(--primary-border);
}

.action-call:hover {
  background: #ccfbf1;
}

.action-full {
  grid-column: span 2;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-subtle);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto 16px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

.toast-success {
  border-left: 4px solid #10b981;
}

.toast-error {
  border-left: 4px solid #ef4444;
}

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

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner-primary {
  border-color: rgba(13, 148, 136, 0.2);
  border-top-color: var(--primary);
}

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

/* Settings Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-subtle);
  cursor: pointer;
}

/* Footer */
.app-footer {
  margin-top: 32px;
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
  font-size: 0.8125rem;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  cursor: pointer;
}

.demo-badge{background:#fef3c7;color:#92400e;border:1px solid #f59e0b;border-radius:999px;padding:2px 8px;font-size:0.7rem;font-weight:700;white-space:nowrap}
