/* ─── Lead Scraper Integration ─── */

.combined-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.combined-stat {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.combined-stat-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.combined-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.combined-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.tab-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  padding: 0.6rem 1.2rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-btn .tab-badge {
  font-size: 0.7rem;
  background: var(--secondary);
  color: var(--text-muted);
  padding: 0.1rem 0.45rem;
  border-radius: 10px;
  font-weight: 600;
}

.scraper-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.scraper-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.scraper-panel-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.scraper-panel-toggle {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.scraper-panel-toggle.open { transform: rotate(180deg); }
.scraper-panel-body {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.scraper-panel-body.hidden { display: none; }

.scraper-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
.scraper-row label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 60px;
}
.scraper-row select,
.scraper-row input[type="text"],
.scraper-row input[type="number"] {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}
.scraper-row input[type="text"] { flex: 1; min-width: 200px; }
.scraper-row input[type="number"] {
  width: 80px;
  -moz-appearance: textfield;
}
.scraper-row input[type="number"]::-webkit-inner-spin-button,
.scraper-row input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.scraper-row select { min-width: 140px; }

.chip-group {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}
.chip-group-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 0.25rem;
}
.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--secondary);
  border-radius: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
}
.chip:hover {
  background: var(--primary);
  color: #fff;
}

.job-status {
  background: var(--secondary);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.job-status-bar {
  flex: 1;
  min-width: 120px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.job-status-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s;
}
.job-status-msg {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
}
.job-status-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-queued { background: var(--secondary); color: var(--text-muted); }
.badge-running { background: #3b82f6; color: #fff; }
.badge-completed { background: #22c55e; color: #fff; }
.badge-error { background: #ef4444; color: #fff; }

.scraper-section {
  display: block;
}
.scraper-section.hidden { display: none; }

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.loading-overlay.hidden { display: none; }
.loading-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 320px;
}
.loading-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.loading-logo {
  height: 36px;
  display: block;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: loading-spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes loading-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.loading-progress-track {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.loading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 4px;
  transition: width 0.4s ease;
  width: 0%;
}

.loading-percent {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.loading-powered {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-top: 0.25rem;
}
