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

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --ink: #f0f0f0;
  --muted: #555;
  --accent: #e8c547;
  --accent-dim: rgba(232, 197, 71, 0.12);
  --warn: #e87d47;
  --warn-dim: rgba(232, 125, 71, 0.15);
  --topbar-h: 52px;
  --panel-w: 380px;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  background: var(--bg);
  z-index: 1000;
}
.topbar-left { display: flex; align-items: center; gap: 0.6rem; }
.logo { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.2em; }

.count-badge {
  font-size: 0.65rem; font-weight: 500;
  background: var(--accent-dim); color: var(--accent);
  padding: 0.2rem 0.5rem; border-radius: 999px;
  border: 1px solid rgba(232, 197, 71, 0.25);
}

.unlocated-badge {
  font-size: 0.65rem; font-weight: 500;
  background: var(--warn-dim); color: var(--warn);
  padding: 0.2rem 0.6rem; border-radius: 999px;
  border: 1px solid rgba(232, 125, 71, 0.3);
  cursor: pointer;
  transition: background 0.15s;
}
.unlocated-badge:hover { background: rgba(232, 125, 71, 0.25); }

.topbar-right { display: flex; align-items: center; gap: 0.25rem; }
.ver-link {
  font-size: 0.7rem; font-weight: 500; color: var(--muted);
  text-decoration: none; padding: 0.3rem 0.6rem; border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.ver-link:hover { color: var(--ink); background: var(--surface2); }
.ver-link.active { color: var(--accent); }

/* Haritada işaretle overlay */
.pick-overlay {
  position: absolute;
  top: calc(var(--topbar-h) + 1rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--accent);
  color: #000;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  pointer-events: all;
}
.pick-cancel {
  background: rgba(0,0,0,0.15); border: none; cursor: pointer;
  font-size: 0.75rem; font-weight: 600; color: #000;
  padding: 0.2rem 0.6rem; border-radius: 999px;
}
.pick-cancel:hover { background: rgba(0,0,0,0.25); }

/* Map */
#map {
  position: absolute;
  top: var(--topbar-h); left: 0; right: var(--panel-w); bottom: 0;
  z-index: 1;
}
.map-pick-cursor { cursor: crosshair !important; }

/* Leaflet overrides */
.leaflet-container { background: #111; }
.leaflet-tile { filter: brightness(0.85); }
.leaflet-control-attribution { background: rgba(0,0,0,0.6) !important; color: #555 !important; }
.leaflet-control-attribution a { color: #666 !important; }

/* Pins */
.pin-marker {
  width: 28px; height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid rgba(0,0,0,0.4);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.2s;
}
.pin-marker.yellow { background: var(--accent); }
.pin-marker.yellow:hover,
.pin-marker.yellow.active { transform: rotate(-45deg) scale(1.2); background: #fff; }

/* Panel */
.panel {
  position: absolute;
  top: var(--topbar-h); right: 0; width: var(--panel-w); bottom: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 2; overflow: hidden;
}

.panel-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.85rem;
}

.panel-content {
  display: flex; flex-direction: column;
  height: 100%; overflow-y: auto;
}

/* Location row */
.panel-location-row {
  display: flex; align-items: flex-start; gap: 0.4rem;
  padding: 1.25rem 1rem 0.5rem;
}
.panel-location {
  font-size: 0.95rem; font-weight: 600; color: var(--ink);
  line-height: 1.4; flex: 1;
}
.icon-btn {
  background: none; border: none; cursor: pointer;
  font-size: 0.85rem; padding: 0.15rem 0.3rem; border-radius: 4px;
  opacity: 0.35; transition: opacity 0.15s, background 0.15s;
  flex-shrink: 0; margin-top: 0.1rem;
}
.icon-btn:hover { opacity: 1; background: var(--surface2); }

/* Edit row */
.panel-edit-row { padding: 1rem 1rem 0.5rem; }
.edit-input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--ink); font-family: inherit;
  font-size: 0.85rem; padding: 0.6rem 0.75rem; outline: none;
  transition: border-color 0.15s;
}
.edit-input:focus { border-color: var(--accent); }
.edit-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.save-btn, .cancel-btn {
  font-family: inherit; font-size: 0.75rem; font-weight: 500;
  padding: 0.4rem 0.9rem; border-radius: 6px; border: none; cursor: pointer;
}
.save-btn { background: var(--accent); color: #000; }
.save-btn:hover { opacity: 0.85; }
.save-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cancel-btn { background: var(--surface2); color: var(--muted); }
.cancel-btn:hover { color: var(--ink); }
.edit-status { font-size: 0.75rem; margin-top: 0.5rem; min-height: 1rem; color: var(--muted); }
.edit-status.error { color: #e55; }
.edit-status.success { color: #5c5; }

/* IG link */
.panel-ig-link {
  display: inline-flex; align-items: center; gap: 0.3rem;
  margin: 0 1rem 1rem; font-size: 0.75rem; font-weight: 500;
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid transparent; width: fit-content;
  transition: border-color 0.15s;
}
.panel-ig-link:hover { border-color: var(--accent); }

/* Embed */
.panel-embed { flex: 1; overflow-y: auto; padding: 0 0.5rem 1rem; }
.panel-embed .instagram-media { min-width: 0 !important; max-width: 100% !important; margin: 0 !important; }

/* Konumsuz drawer */
.unlocated-drawer {
  position: absolute; inset: 0;
  background: var(--surface);
  display: flex; flex-direction: column;
  z-index: 10;
}
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; color: var(--warn);
}
.drawer-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 1rem;
  padding: 0.2rem 0.4rem; border-radius: 4px;
  transition: color 0.15s;
}
.drawer-close:hover { color: var(--ink); }

.unlocated-list { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }

.unlocated-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.75rem 1rem;
  display: flex; align-items: center; gap: 0.75rem;
}
.unlocated-item-info { flex: 1; min-width: 0; }
.unlocated-item-name {
  font-size: 0.8rem; font-weight: 500; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.unlocated-item-sub { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }
.mark-btn {
  font-family: inherit; font-size: 0.7rem; font-weight: 600;
  padding: 0.35rem 0.75rem; border-radius: 6px; border: none;
  background: var(--warn-dim); color: var(--warn);
  border: 1px solid rgba(232,125,71,0.3);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background 0.15s;
}
.mark-btn:hover { background: rgba(232,125,71,0.25); }

/* No places */
.no-places {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; color: var(--muted); font-size: 0.9rem;
  z-index: 10; pointer-events: none;
}
.no-places strong { display: block; margin-bottom: 0.5rem; color: var(--ink); font-size: 1.1rem; }

/* Mobile */
@media (max-width: 768px) {
  :root { --panel-w: 0px; }
  #map { right: 0; bottom: 45vh; }
  .panel { top: auto; bottom: 0; left: 0; width: 100%; height: 45vh; border-left: none; border-top: 1px solid var(--border); }
  .pick-overlay { top: calc(var(--topbar-h) + 0.5rem); width: 90%; }
  .topbar-right .ver-link:not(.active) { display: none; }
}
