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

:root {
  --bg: #FAFAFA;
  --surface: rgba(255, 255, 255, 0.85);
  --surface2: #F3F4F6;
  --border: #E5E7EB;
  --accent: #E63B2E;
  --accent2: #c92c21;
  --green: #10b981;
  --green2: #059669;
  --blue: #3b82f6;
  --blue2: #2563eb;
  --text: #111827;
  --text2: #6B7280;
  --radius: 20px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  opacity: 0.015;
  z-index: 9999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 16px 80px;
}

/* ── Header ─────────────────────────────────────────── */
header { text-align: center; margin-bottom: 32px; }
.logo {
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}
.logo::first-letter { color: var(--accent); }
.subtitle {
  margin-top: 8px;
  color: var(--text2);
  font-size: 0.9rem;
  font-weight: 500;
}
.status-badge {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.status-badge.google { background: rgba(16, 185, 129, 0.08); color: #059669; border: 1px solid rgba(16, 185, 129, 0.25); }
.status-badge.osm    { background: rgba(230, 59, 46, 0.08); color: #E63B2E; border: 1px solid rgba(230, 59, 46, 0.25); }
.status-badge.demo   { background: rgba(245, 158, 11, 0.08); color: #fb923c; border: 1px solid rgba(245, 158, 11, 0.25); }

/* ── Search panel ────────────────────────────────────── */
.search-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

/* ── Seletor de categoria ─────────────────────────────── */
.category-section { margin-bottom: 20px; }
.field-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 10px;
}
.category-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cat-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 16px;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.18s;
  font-family: 'Plus Jakarta Sans', sans-serif;
  white-space: nowrap;
}
.cat-pill:hover { border-color: var(--accent); color: var(--accent); }
.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(230, 59, 46, 0.25);
}
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Tabs ────────────────────────────────────────────── */
.search-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--surface2);
  border-radius: 12px;
  padding: 4px;
  width: fit-content;
}
.tab-btn {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(230, 59, 46, 0.25);
}
.tab-btn:not(.active):hover { color: var(--text); }

/* ── Input row ───────────────────────────────────────── */
.input-row {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.field input[type="text"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1.05rem;
  padding: 11px 16px;
  width: 165px;
  outline: none;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 59, 46, 0.15);
}
.field input[type="range"] {
  -webkit-appearance: none;
  width: 200px; height: 5px;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  margin-top: 8px;
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}
.input-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  padding: 11px 12px;
  width: 85px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}
.input-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 59, 46, 0.15);
}
.field-city input[type="text"] { width: 220px; }
.address-display {
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--surface2);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--text2);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px 22px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.2s;
  white-space: nowrap;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 24px -5px rgba(230, 59, 46, 0.4);
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-success {
  background: var(--green); color: #fff; border: none;
  border-radius: 12px; padding: 11px 22px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: background 0.18s, transform 0.2s, box-shadow 0.2s;
  white-space: nowrap; font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-success:hover { background: var(--green2); transform: translateY(-1px); box-shadow: 0 8px 20px -5px rgba(16, 185, 129, 0.4); }
.btn-success:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-excel {
  background: var(--blue); color: #fff; border: none;
  border-radius: 12px; padding: 11px 22px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: background 0.18s, transform 0.2s, box-shadow 0.2s;
  white-space: nowrap; font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-excel:hover { background: var(--blue2); transform: translateY(-1px); box-shadow: 0 8px 20px -5px rgba(59, 130, 246, 0.4); }
.btn-excel:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-outline {
  background: transparent; color: var(--text2);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 20px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
}
.btn-outline:hover {
  border-color: var(--accent); color: var(--accent);
  background: rgba(230, 59, 46, 0.05); transform: translateY(-1px);
}

.btn-wa-dispatch {
  background: #25d366; color: #fff; border: none;
  border-radius: 12px; padding: 11px 22px; font-size: 0.88rem; font-weight: 700;
  cursor: pointer; transition: background 0.18s, transform 0.2s, box-shadow 0.2s;
  white-space: nowrap; font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-wa-dispatch:hover { background: #1ebe5a; transform: translateY(-1px); box-shadow: 0 8px 20px -5px rgba(37, 211, 102, 0.4); }
.btn-wa-dispatch:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Status bar ──────────────────────────────────────── */
.status-bar {
  padding: 12px 18px; border-radius: 12px; font-size: 0.88rem;
  margin-bottom: 16px; font-weight: 600;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.status-bar.error   { background: rgba(127, 29, 29, 0.08); border: 1px solid rgba(127, 29, 29, 0.25); color: #991b1b; }
.status-bar.info    { background: rgba(230, 59, 46, 0.08); border: 1px solid rgba(230, 59, 46, 0.25); color: #7c3aed; }
.status-bar.loading { background: rgba(133, 77, 14, 0.08); border: 1px solid rgba(133, 77, 14, 0.25); color: #b45309; }

/* ── Results ─────────────────────────────────────────── */
.results-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  gap: 12px; flex-wrap: wrap;
}
.results-info { display: flex; align-items: center; gap: 20px; }
#resultsCount { color: var(--accent); font-weight: 700; font-size: 1rem; }
.check-all-label {
  display: flex; align-items: center; gap: 6px;
  color: var(--text2); cursor: pointer; font-size: 0.83rem;
}
.check-all-label input { cursor: pointer; accent-color: var(--accent); }
.export-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Table ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
thead th {
  background: #F3F4F6; padding: 11px 14px; text-align: left;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.col-check { width: 44px; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:hover { background: var(--surface2); }
tbody tr.selected { background: #FEF2F2; }
tbody td { padding: 11px 14px; vertical-align: middle; }
tbody td input[type="checkbox"] { cursor: pointer; accent-color: var(--accent); width: 15px; height: 15px; }

.td-name { font-weight: 600; }
.td-addr { color: var(--text2); max-width: 250px; }
.td-phone { color: #059669; font-size: 0.83rem; white-space: nowrap; }
.td-phone.none { color: #9ca3af; }
.stars { color: #f59e0b; }
.no-rating { color: #9ca3af; font-size: 0.78rem; }

.badge-tipo {
  background: rgba(230, 59, 46, 0.1);
  color: var(--accent);
  border: 1px solid rgba(230, 59, 46, 0.2);
  padding: 2px 8px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-osm    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; padding: 2px 7px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }
.badge-google { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; padding: 2px 7px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }

.btn-wa {
  display: inline-block; background: #25d366; color: #fff;
  font-size: 0.75rem; font-weight: 700; padding: 4px 10px;
  border-radius: 6px; text-decoration: none; white-space: nowrap;
  transition: background 0.15s;
}
.btn-wa:hover { background: #1ebe5a; }
.wa-cell { white-space: nowrap; }

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: #ffffff; border: 1px solid var(--border); color: var(--text);
  padding: 11px 22px; border-radius: 50px; font-size: 0.88rem; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12); z-index: 9999; white-space: nowrap;
}

/* ── Progress bar ────────────────────────────────────── */
.progress-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px; margin-bottom: 14px;
}
.progress-label { font-size: 0.82rem; color: var(--text2); margin-bottom: 8px; font-weight: 500; }
.progress-track { background: var(--surface2); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar {
  height: 100%; width: 0%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.4s ease;
  box-shadow: 0 0 8px rgba(230, 59, 46, 0.4);
}

/* ── Spinner ─────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 13px; height: 13px;
  border: 2px solid rgba(0,0,0,0.15); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.65s linear infinite;
  vertical-align: middle; margin-right: 5px;
}

/* ── Botão teste WA ──────────────────────────────────── */
.test-wa-row { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.btn-test-wa {
  background: transparent; color: var(--text2);
  border: 1px dashed #d1d5db; border-radius: 8px;
  padding: 7px 16px; font-size: 0.8rem; cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.btn-test-wa:hover { border-color: #25d366; color: #25d366; }

/* ── Limite diário WA ────────────────────────────────── */
.wa-daily-info {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-size: 0.82rem;
  color: var(--text2); margin-bottom: 12px;
}
.wa-daily-info .day-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 0.8rem; }
.wa-daily-info .day-today  { color: #059669; font-weight: 600; }
.wa-daily-info .day-future { color: #9ca3af; }

/* ── Teste numbers ───────────────────────────────────── */
.test-numbers-grid { display: flex; flex-direction: column; gap: 6px; }
.test-number-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.9rem;
  padding: 8px 12px; outline: none; transition: border-color 0.2s; width: 100%;
}
.test-number-input:focus { border-color: #25d366; }
.test-number-input.filled { border-color: #059669; }

/* ── Modal ───────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-box {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 40px 32px; max-width: 420px; width: 100%; text-align: center;
}
.modal-icon { font-size: 3rem; margin-bottom: 12px; }
.modal-box h2 { margin-bottom: 8px; font-size: 1.25rem; }
.modal-box p { color: var(--text2); font-size: 0.88rem; margin-bottom: 24px; }
.modal-btn { display: block; width: 100%; margin-top: 10px; text-align: center; text-decoration: none; }

/* ── Modal WhatsApp ──────────────────────────────────── */
.wa-modal-box {
  max-width: 520px; max-height: 90vh; overflow-y: auto;
  text-align: left; padding: 32px; border-radius: 28px !important;
}
.wa-modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.wa-modal-header h2 { flex: 1; font-size: 1.25rem; margin: 0; }
.modal-close {
  background: transparent; border: none; color: var(--text2);
  font-size: 1rem; cursor: pointer; padding: 6px 10px;
  border-radius: 8px; transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }

.wa-status-bar {
  padding: 9px 14px; border-radius: 8px; font-size: 0.84rem;
  font-weight: 600; margin-bottom: 16px;
}
.wa-status-bar.connected    { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.wa-status-bar.disconnected { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.wa-status-bar.loading      { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }

.wa-section { margin-bottom: 14px; }
.wa-section-label {
  display: block; font-size: 0.75rem; font-weight: 700;
  color: var(--text2); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px;
}
.wa-image-area { display: flex; flex-direction: column; gap: 8px; }
.wa-image-preview { display: flex; align-items: center; gap: 10px; }
.wa-image-preview img { max-height: 80px; max-width: 120px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); }
.wa-image-remove {
  background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA;
  border-radius: 6px; padding: 4px 10px; font-size: 0.78rem; cursor: pointer;
}
.wa-image-remove:hover { background: #FEE2E2; }
.wa-textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 0.95rem;
  padding: 10px 14px; outline: none; resize: vertical; font-family: inherit;
  transition: border-color 0.2s;
}
.wa-textarea:focus { border-color: #25d366; }
.wa-contacts-info {
  padding: 10px 14px; background: var(--surface2); border-radius: 8px;
  font-size: 0.84rem; color: var(--text2); margin-bottom: 12px;
}
.wa-contacts-info strong { color: var(--text); }
.wa-warning {
  padding: 10px 14px; background: #FFFBEB;
  border: 1px solid #FCD34D; border-radius: 8px;
  font-size: 0.8rem; color: #92400E; margin-bottom: 16px;
}
.wa-send-progress { margin-bottom: 14px; }
.wa-send-log {
  margin-top: 8px; max-height: 130px; overflow-y: auto;
  font-size: 0.78rem; color: var(--text2); background: var(--surface2);
  border-radius: 6px; padding: 8px 12px;
  display: flex; flex-direction: column; gap: 2px;
}
.wa-send-log .log-ok   { color: #059669; }
.wa-send-log .log-err  { color: #dc2626; }
.wa-send-log .log-wait { color: #d97706; }
.wa-modal-btns { display: flex; gap: 10px; justify-content: flex-end; }
.btn-wa-send {
  background: #25d366; color: #fff; border: none;
  border-radius: 8px; padding: 11px 24px; font-size: 0.92rem; font-weight: 700;
  cursor: pointer; transition: background 0.18s;
}
.btn-wa-send:hover { background: #1ebe5a; }
.btn-wa-send:disabled { opacity: 0.4; cursor: not-allowed; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .input-row { flex-direction: column; }
  .field input[type="text"], .field input[type="range"] { width: 100%; }
  .btn-primary { width: 100%; }
  .results-header { flex-direction: column; align-items: flex-start; }
  .export-btns { width: 100%; }
  .btn-success, .btn-excel { flex: 1; }
  .category-pills { gap: 4px; }
  .cat-pill { font-size: 0.78rem; padding: 6px 12px; }
}

html, body { overflow-x: hidden; width: 100%; max-width: 100vw; }
