/* ── Fonts ────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-semibold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('/static/fonts/playfair-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Playfair Display';
  src: url('/static/fonts/playfair-bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f0ede8;
  color: #3a3830;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: 360px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-right: 1px solid #e2ddd6;
  overflow: hidden;
}

#sidebar-header {
  flex-shrink: 0;
  padding: 28px 28px 22px;
  border-bottom: 1px solid #e2ddd6;
}

.city-name {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-size: 2rem;
  font-weight: 700;
  color: #1a1814;
  letter-spacing: -0.5px;
  line-height: 1;
  margin-bottom: 6px;
}

.city-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #b45309;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 4px;
}

.city-coords {
  font-size: 0.7rem;
  color: #a09880;
  font-variant-numeric: tabular-nums;
}

/* ── Location detail ──────────────────────────────────────────────────────── */

#location-detail {
  flex: 1;
  min-height: 0;
  padding: 24px 28px;
  overflow-y: auto;
  transition: opacity 150ms ease, transform 150ms ease;
}

#location-detail.fading { opacity: 0; transform: translateY(6px); }

.location-name {
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a1814;
  line-height: 1.2;
  margin-bottom: 8px;
}

.location-coords {
  font-size: 0.7rem;
  color: #a09880;
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}

.location-description {
  font-size: 0.875rem;
  line-height: 1.75;
  color: #5a5648;
  margin-bottom: 18px;
}

.location-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.badge-religious { background: #fce7f3; color: #9d174d; }
.badge-academic  { background: #dbeafe; color: #1e40af; }
.badge-historic  { background: #fef3c7; color: #92400e; }
.badge-other     { background: #f3f4f6; color: #374151; }

/* ── Map ─────────────────────────────────────────────────────────────────── */

#map { position: relative; flex: 1; height: 100%; }
#map.pick-mode,
#map.pick-mode .leaflet-grab,
#map.pick-mode .leaflet-dragging { cursor: crosshair !important; }

/* ── Leaflet overrides ───────────────────────────────────────────────────── */

.leaflet-control-attribution {
  background: rgba(255,255,255,0.8) !important;
  color: #a09880 !important;
  font-size: 0.62rem !important;
}
.leaflet-control-attribution a { color: #78716c !important; }

.leaflet-control-zoom a {
  background: #ffffff !important;
  border-color: #e2ddd6 !important;
  color: #5a5648 !important;
}
.leaflet-control-zoom a:hover {
  background: #f5f2ed !important;
  color: #1a1814 !important;
}

/* ── Markers ─────────────────────────────────────────────────────────────── */

.map-marker {
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.25));
  user-select: none;
}

/* ── Admin panel ─────────────────────────────────────────────────────────── */

#admin-panel {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  max-height: 45vh;
  border-top: 1px solid #e2ddd6;
  background: #faf9f6;
}

#admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid #e2ddd6;
}

.admin-title {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #b45309;
}

#admin-content { overflow-y: auto; flex: 1; min-height: 0; }

.marker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid #ece9e3;
}
.marker-item:hover    { background: #f5f2ed; }
.marker-item.selected { background: #f0ede8; }

.marker-item-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-religious { background: #db2777; }
.dot-academic  { background: #2563eb; }
.dot-historic  { background: #d97706; }
.dot-other     { background: #6b7280; }

.marker-item-name {
  flex: 1;
  font-size: 0.78rem;
  color: #3a3830;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marker-item-actions { display: flex; gap: 4px; }

.admin-btn {
  background: #ffffff;
  border: 1px solid #d6d0c8;
  border-radius: 4px;
  color: #5a5648;
  font-size: 0.68rem;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms, border-color 120ms;
}

.admin-btn:hover   { background: #f5f2ed; color: #1a1814; border-color: #b8b0a4; }
.add-btn           { border-color: #d97706; color: #b45309; background: #fff8ed; }
.add-btn:hover     { background: #fef3c7; border-color: #b45309; }
.delete-btn:hover  { border-color: #db2777; color: #9d174d; background: #fdf2f8; }
.save-btn          { background: #2563eb; border-color: #2563eb; color: #ffffff; flex: 1; }
.save-btn:hover    { background: #1d4ed8; border-color: #1d4ed8; }

.admin-empty {
  padding: 18px;
  font-size: 0.78rem;
  color: #a09880;
  text-align: center;
}

/* ── Edit form ───────────────────────────────────────────────────────────── */

.edit-form { padding: 12px 14px 14px; overflow-y: auto; }

.form-group { margin-bottom: 9px; }

.form-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #a09880;
  margin-bottom: 4px;
}

.form-input, .form-textarea, .form-select {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d6d0c8;
  border-radius: 4px;
  color: #1a1814;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 5px 8px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
}

.form-textarea      { resize: vertical; min-height: 68px; }
.form-select        { cursor: pointer; }

.coords-row  { display: flex; gap: 6px; align-items: flex-end; }
.coord-input { flex: 1; }

.form-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ── Pick hint ───────────────────────────────────────────────────────────── */

.pick-active-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(37,99,235,0.92);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 0.82rem;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%; height: 220px;
    flex-direction: row;
    flex-shrink: 0;
  }
  #sidebar-header {
    width: 145px; flex-shrink: 0;
    padding: 14px;
    border-right: 1px solid #e2ddd6;
    border-bottom: none;
  }
  .city-name       { font-size: 1.3rem; }
  #location-detail { padding: 14px 12px; font-size: 0.87em; }
  .location-name   { font-size: 1.1rem; }
  #admin-panel     { display: none; }
  #map             { flex: 1; height: 0; }
}
