/* ================== Fyndar — araç sayfası stilleri (koyu tema) ==================
   NOT: :root token seti landing.css ile birebir aynı tutulmalı (build yok, elle eş). */

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

:root {
  --bg: #0a0f1c;
  --bg-2: #0e1526;
  --card: #131a2b;
  --card-2: #182238;
  --border: #1f2940;
  --border-2: #2a3652;
  --text: #f2f5fa;
  --muted: #8a94a8;
  --accent: #7c3aed;        /* logo moru */
  --accent-dark: #6d28d9;
  --accent-2: #2f6bff;      /* logo mavisi (gradyan eşi) */
  --accent-ink: #ffffff;
  --cyan: #22d3ee;
  --danger: #ff7a50;        /* logo turuncusu — fırsat rengi */
  --danger-bg: rgba(242, 84, 45, 0.14);
  --wa: #25d366;
  --radius: 12px;
  --glow: 0 0 20px rgba(124, 58, 237, 0.35);
}

html, body { height: 100%; }

body.app-body {
  font-family: "Manrope", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Üst bar ---------- */
.topbar {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  flex-wrap: wrap;
  z-index: 1002;
}

.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { display: block; height: 32px; width: auto; }

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.search-box { display: flex; flex: 1; max-width: 400px; min-width: 200px; }

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-right: none;
  border-radius: 9px 0 0 9px;
  font-size: 14px;
  outline: none;
  background: var(--card);
  color: var(--text);
}
.search-box input::placeholder { color: var(--muted); }
.search-box input:focus { border-color: var(--accent); }

.search-box button {
  padding: 9px 16px;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-radius: 0 9px 9px 0;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.search-box button:hover { filter: brightness(1.12); }

.locate-btn {
  padding: 9px 13px;
  border: 1px solid var(--accent);
  background: transparent;
  color: #a78bfa;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.locate-btn:hover { background: var(--accent); color: var(--accent-ink); box-shadow: var(--glow); }

button:disabled { opacity: 0.5; cursor: wait; }

.icon-btn {
  padding: 8px 10px;
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--text);
  border-radius: 9px;
  font-size: 15px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }

select, #filterInput {
  padding: 9px 10px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  outline: none;
}
select:focus, #filterInput:focus { border-color: var(--accent); }

/* ---------- Auth alanı ---------- */
.auth-area { display: flex; align-items: center; gap: 8px; }

.auth-login-btn {
  padding: 9px 14px;
  border: none;
  background: var(--cyan);
  color: #06222b;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}
.auth-login-btn:hover { filter: brightness(1.1); }

.auth-user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 5px 6px 5px 12px;
  font-size: 13px;
  color: var(--muted);
  max-width: 220px;
}
.auth-user .auth-mail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-user button {
  border: none;
  background: var(--border);
  color: var(--text);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.auth-user button:hover { background: var(--danger); }

/* ---------- Ana düzen ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 420px;
  min-width: 320px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sheet-handle { display: none; }

/* ---------- Sekmeler ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.tab {
  flex: 1;
  padding: 11px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

.badge {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 800;
}
.badge:empty, .badge.zero { background: var(--border); color: var(--muted); }

.tab-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tab-panel[hidden] { display: none; }

/* ---------- Araç çubukları ---------- */
.sidebar-tools {
  display: flex;
  gap: 8px;
  padding: 10px 12px 8px;
}
.sidebar-tools input { flex: 1; min-width: 0; }
.sidebar-tools select { max-width: 46%; }

.lead-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 12px 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border-2);
  background: var(--card);
  color: var(--muted);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip b { font-weight: 800; }
.chip b:empty { display: none; }
.chip:hover { border-color: var(--accent); }
.chip:has(input:checked) {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent);
  color: #c4b5fd;
}
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.csv-btn {
  margin-left: auto;
  padding: 5px 11px;
  border: 1px solid var(--cyan);
  background: transparent;
  color: var(--cyan);
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.csv-btn:hover { background: var(--cyan); color: #06222b; }

.leads-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.leads-summary { font-size: 13px; color: var(--muted); }

/* ---------- Durum çubuğu ---------- */
.status-bar {
  padding: 9px 14px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.status-bar b { color: var(--text); }
.status-bar.error { color: #ff8896; background: rgba(255, 85, 102, 0.08); }

/* ---------- Sonuç listesi ---------- */
.results-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}
.results-list::-webkit-scrollbar { width: 8px; }
.results-list::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 4px; }

/* ---------- İşletme kartı ---------- */
.place-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--card);
}
.place-card:hover { background: var(--card-2); border-color: var(--border-2); }
.place-card.active { border-color: var(--accent); box-shadow: var(--glow); }

.place-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-right: 30px;
}
.place-name { font-size: 15px; font-weight: 800; flex: 1; }
.place-dist { font-size: 12px; color: var(--muted); white-space: nowrap; }

.save-btn {
  position: absolute;
  top: 9px;
  right: 9px;
  border: none;
  background: none;
  font-size: 17px;
  cursor: pointer;
  color: var(--muted);
  filter: grayscale(1);
  transition: transform 0.15s, filter 0.15s;
  line-height: 1;
  padding: 3px;
}
.save-btn:hover { transform: scale(1.25); filter: grayscale(0.4); }
.save-btn.saved { filter: none; }

.place-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.place-cat {
  display: inline-block;
  font-size: 11.5px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border-radius: 20px;
  padding: 2px 9px;
}

.opp-badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--danger);
  background: var(--danger-bg);
  border: 1px solid rgba(242, 84, 45, 0.45);
  border-radius: 20px;
  padding: 2px 9px;
}

.place-addr { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.place-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.place-links a {
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 7px;
  padding: 4px 9px;
}
.place-links a:hover { border-color: var(--accent); color: #a78bfa; }

.place-links a.wa-link {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.5);
  color: var(--wa);
}
.place-links a.wa-link:hover { background: var(--wa); color: #04120b; border-color: var(--wa); }

/* Listem kartı ekstraları */
.lead-status {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.lead-status select {
  padding: 5px 8px;
  font-size: 12.5px;
  border-radius: 7px;
}
.lead-status select.st-mesaj { color: var(--cyan); border-color: var(--cyan); }
.lead-status select.st-gorusuldu { color: var(--accent); border-color: var(--accent); }
.lead-remove {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
}
.lead-remove:hover { color: var(--danger); }

/* ---------- Boş durum + skeleton ---------- */
.empty-note {
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  padding: 28px 16px;
  line-height: 1.7;
}
.empty-note .primary-btn { margin-top: 10px; }

.onboard {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 18px 16px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
  background: var(--card);
}
.onboard b { color: var(--text); }
.onboard .hl { color: #c4b5fd; font-weight: 700; }

.primary-btn {
  padding: 9px 16px;
  border: none;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
}
.primary-btn:hover { filter: brightness(1.12); box-shadow: var(--glow); }

.ghost-btn {
  padding: 9px 14px;
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--text); border-color: var(--muted); }

.more-btn { margin: 4px auto 8px; display: block; }

.skeleton-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--card);
}
.skeleton-card .sk {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--border) 25%, var(--border-2) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  margin-bottom: 9px;
}
.skeleton-card .sk:nth-child(1) { width: 60%; height: 15px; }
.skeleton-card .sk:nth-child(2) { width: 35%; }
.skeleton-card .sk:nth-child(3) { width: 85%; margin-bottom: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Harita ---------- */
.map-wrap { flex: 1; min-width: 0; position: relative; background: var(--bg); }
#map { position: absolute; inset: 0; background: #1a2233; }

.map-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1000;
  background: rgba(10, 15, 28, 0.88);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  padding: 7px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--muted);
}
.map-legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-op { background: #f2542d; border: 2px solid #f2542d; }
.dot-std { background: #fff; border: 2px solid #2f6bff; }

/* Leaflet koyu tema uyumu */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
.leaflet-popup-content { font-size: 13px; line-height: 1.55; }
.leaflet-popup-content b { font-size: 14px; }
.leaflet-popup-content a { color: #a78bfa; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a {
  background: var(--card);
  color: var(--text);
  border-bottom-color: var(--border);
}
.leaflet-bar a:hover { background: var(--card-2); }
.leaflet-control-attribution {
  background: rgba(10, 15, 28, 0.75) !important;
  color: var(--muted);
}
.leaflet-control-attribution a { color: var(--cyan); }

/* ---------- Modallar ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.72);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.open { display: flex; }

.modal-card {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 20px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.modal-head h2 { font-size: 17px; font-weight: 800; }
.modal-close {
  border: none;
  background: var(--card);
  color: var(--muted);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.modal-close:hover { color: var(--text); background: var(--border); }

.modal-hint { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.modal-hint code {
  background: var(--card);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 1px 6px;
  color: #c4b5fd;
  font-size: 12px;
}

#templateInput {
  width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
#templateInput:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}
.modal-note { font-size: 12px; color: var(--muted); }
.modal-note a { color: var(--cyan); }

/* Auth modal */
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px;
  border: none;
  border-radius: 9px;
  background: #fff;
  color: #1a1a1a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.google-btn:hover { filter: brightness(0.92); }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border-2); }

#emailForm { display: flex; flex-direction: column; gap: 9px; }
#emailForm input {
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
#emailForm input:focus { border-color: var(--accent); }

.auth-error {
  font-size: 12.5px;
  color: #ff8896;
  background: rgba(255, 85, 102, 0.1);
  border-radius: 7px;
  padding: 8px 10px;
}

.auth-actions { display: flex; gap: 8px; }
.auth-actions .primary-btn { flex: 1; }

/* ---------- Diğer ---------- */
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--border-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.noscript-note {
  position: fixed;
  inset: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 3000;
}

/* ---------- Mobil: bottom sheet ---------- */
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .brand img { height: 26px; }

  /* Sıra: 1) marka  2) arama kutusu (tam satır)  3) Konumum + yarıçap + ayar + giriş */
  .controls { flex-basis: 100%; justify-content: flex-start; }
  .search-box { order: 1; max-width: none; flex-basis: 100%; }
  .locate-btn { order: 2; flex: 1; }
  #radiusSelect { order: 3; }
  .icon-btn { order: 4; }
  .auth-area { order: 5; margin-left: auto; }

  .layout { position: relative; }
  .map-wrap { flex: 1; }

  .sidebar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: 0;
    height: 52%;
    border-right: none;
    border-top: 1px solid var(--border-2);
    border-radius: 16px 16px 0 0;
    z-index: 1001;
    transition: height 0.25s ease;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.45);
  }
  .sidebar.sheet--peek { height: 132px; }
  .sidebar.sheet--peek .results-list,
  .sidebar.sheet--peek .lead-filters,
  .sidebar.sheet--peek .sidebar-tools { display: none; }
  .sidebar.sheet--full { height: 86%; }

  .sheet-handle {
    display: block;
    width: 100%;
    padding: 8px 0 4px;
    background: none;
    border: none;
    cursor: pointer;
  }
  .sheet-handle span {
    display: block;
    width: 42px;
    height: 4px;
    border-radius: 2px;
    background: var(--border-2);
    margin: 0 auto;
  }

  /* Zoom butonları sol üstte; lejant sağ üste geçsin */
  .map-legend { bottom: auto; top: 10px; left: auto; right: 10px; }

  /* Dokunma hedefleri parmak boyutuna çıksın */
  .place-links a { padding: 7px 11px; }
  .chip { padding: 8px 13px; }
  .tab { padding: 13px 8px; }
  .csv-btn { padding: 8px 13px; }
  .save-btn { padding: 6px; }
}

/* ---------- Dil değiştirici (TR|EN) — landing.css ile aynı görünüm ---------- */
.lang-switch {
  display: inline-block;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1;
  white-space: nowrap;
}
.lang-switch:hover { color: var(--text); border-color: var(--accent); }
