* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; inset: 0; }

#topbar {
  position: absolute; top: 12px; left: 12px; right: 12px; z-index: 10;
  display: flex; align-items: center; gap: 14px; pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.logo {
  background: #fff; padding: 10px 16px; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18); font-size: 17px; color: #1a1a2e;
}
.logo .v { color: #6c5ce7; font-size: 12px; font-weight: 700; }
.search-box { position: relative; flex: 0 1 420px; }
#search {
  width: 100%; padding: 11px 16px; border: none; border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18); font-size: 14px; outline: none;
}
#search-results {
  position: absolute; top: 46px; left: 0; right: 0; background: #fff;
  border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.22); overflow: hidden;
}
#search-results div { padding: 10px 14px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f0f0f0; }
#search-results div:hover { background: #f4f2ff; }
.hint {
  background: rgba(26,26,46,.85); color: #fff; padding: 9px 14px;
  border-radius: 10px; font-size: 13px;
}
#sektor, #radius {
  padding: 10px 12px; border: none; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18); background: #fff; color: #1a1a2e;
  cursor: pointer; outline: none; max-width: 220px;
}
#sektor { font-weight: 600; }
#trafik-toggle {
  padding: 9px 12px; border: none; border-radius: 12px; font-size: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18); background: #fff; cursor: pointer;
}
#trafik-toggle.pasif { opacity: .45; filter: grayscale(1); }
#en-iyi, #takipler-btn {
  padding: 10px 12px; border: none; border-radius: 12px; font-size: 13.5px;
  box-shadow: 0 2px 12px rgba(0,0,0,.18); background: #6c5ce7; color: #fff;
  cursor: pointer; font-weight: 600; white-space: nowrap;
}
#takipler-btn { background: #fff; font-size: 16px; padding: 9px 12px; }
#en-iyi:disabled { opacity: .6; cursor: wait; }

.panel-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.panel-actions button {
  flex: 1; padding: 9px 0; border: 1.5px solid #6c5ce7; border-radius: 10px;
  background: #fff; color: #6c5ce7; font-weight: 600; font-size: 13px; cursor: pointer;
}
.panel-actions button:hover { background: #f4f2ff; }
.mini-btn {
  padding: 5px 12px; border: 1px solid #ddd; border-radius: 8px; background: #fff;
  font-size: 12px; cursor: pointer; margin-right: 6px;
}

/* PDF / yazdırma: sadece analiz raporu çıkar */
@media print {
  #map, #topbar, #panel-close, .no-print, .maplibregl-control-container { display: none !important; }
  #panel { position: static; width: 100%; max-width: 100%; box-shadow: none; transform: none !important; }
  #panel.hidden { transform: none; }
  body { background: #fff; }
  .card { break-inside: avoid; }
  .biz-list { max-height: none; overflow: visible; }
  #panel-content::before {
    content: "Nerde.ai — Lokasyon Analiz Raporu";
    display: block; font-size: 20px; font-weight: 700; margin: 10px 0 16px; color: #1a1a2e;
  }
}

.rakip-ozet { display: flex; gap: 8px; margin-bottom: 10px; }
.rakip-ozet .stat { flex: 1; text-align: center; }

#panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 420px; max-width: 94vw;
  background: #fff; z-index: 20; box-shadow: -4px 0 24px rgba(0,0,0,.2);
  overflow-y: auto; transition: transform .25s ease;
}
#panel.hidden { transform: translateX(105%); }
#panel-close {
  position: sticky; top: 10px; left: 10px; z-index: 2; width: 32px; height: 32px;
  border: none; border-radius: 50%; background: #eee; font-size: 20px; cursor: pointer; margin: 10px;
}
#panel-content { padding: 0 20px 30px; }

#loading { text-align: center; padding: 40px 0; }
.spinner {
  width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%;
  border: 4px solid #ece9ff; border-top-color: #6c5ce7; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-weight: 600; color: #333; margin-bottom: 18px; }
.loading-steps { text-align: left; max-width: 260px; margin: 0 auto; }
.step { padding: 6px 0; font-size: 13px; color: #bbb; transition: color .3s; }
.step.active { color: #6c5ce7; font-weight: 600; }
.step.done { color: #27ae60; }

.hidden { display: none !important; }

/* Sonuç kartları */
.addr { font-size: 15px; font-weight: 700; color: #1a1a2e; margin: 4px 0 2px; }
.addr-sub { font-size: 12px; color: #888; margin-bottom: 14px; }
.card {
  background: #fafafa; border: 1px solid #eee; border-radius: 14px;
  padding: 14px 16px; margin-bottom: 14px;
}
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: #6c5ce7; margin-bottom: 10px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: #fff; border-radius: 10px; padding: 8px 10px; border: 1px solid #f0f0f0; }
.stat .val { font-size: 16px; font-weight: 700; color: #1a1a2e; }
.stat .lbl { font-size: 11px; color: #999; }

.traffic-bar { height: 10px; border-radius: 5px; background: #eee; overflow: hidden; margin: 8px 0 4px; }
.traffic-bar > div { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #6c5ce7, #a29bfe); }
.traffic-lbl { display: flex; justify-content: space-between; font-size: 12px; color: #666; }

.hours { display: flex; align-items: flex-end; gap: 2px; height: 56px; margin-top: 10px; }
.hours > div { flex: 1; background: #a29bfe; border-radius: 2px 2px 0 0; min-height: 2px; }
.hours-lbl { display: flex; justify-content: space-between; font-size: 10px; color: #aaa; margin-top: 3px; }

.score-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f2f2f2; }
.score-row:last-child { border-bottom: none; }
.score-row .name { flex: 1; font-size: 13px; color: #333; }
.score-row .comp { font-size: 11px; color: #999; }
.score-badge {
  min-width: 42px; text-align: center; padding: 4px 8px; border-radius: 8px;
  font-size: 13px; font-weight: 700; color: #fff;
}

.oneri-card { border-left: 4px solid #6c5ce7; background: #f7f5ff; border-radius: 12px; padding: 13px 15px; margin-bottom: 10px; }
.oneri-card h4 { font-size: 14px; color: #1a1a2e; margin-bottom: 6px; }
.oneri-card .uygun { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 6px; background: #6c5ce7; color: #fff; margin-left: 6px; vertical-align: middle; }
.oneri-card p { font-size: 12.5px; color: #444; line-height: 1.5; }
.oneri-card .risk { margin-top: 6px; font-size: 11.5px; color: #b06000; }
.genel { font-size: 13px; color: #333; line-height: 1.55; background: #fffbe8; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; border: 1px solid #f5ecc0; }

.kaynak-info { font-size: 11px; color: #aaa; text-align: center; margin-top: 8px; }
.biz-list { max-height: 200px; overflow-y: auto; }
.biz-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid #f4f4f4; }
.biz-row .cat { color: #999; font-size: 11px; }
.biz-row .dist { color: #6c5ce7; white-space: nowrap; margin-left: 8px; }

@media (max-width: 700px) {
  #topbar { flex-wrap: wrap; }
  .hint { display: none; }
  #panel { width: 100vw; }
}
