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

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --border: #e5e5e0;
  --text: #1a1a1a;
  --text-muted: #6b6b63;
  --accent: #2d6a4f;
  --accent-light: #e8f5ee;
  --tag-bg: #f0f0eb;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --radius: 8px;
  --sidebar-width: 340px;
}

html {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-shrink: 0;
}

header h1 {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

header span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

#sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#search {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#search:focus {
  border-color: var(--accent);
}

#btn-locate {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#btn-locate:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#restaurant-list {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.restaurant-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.restaurant-item:last-child {
  border-bottom: none;
}

.restaurant-item:hover,
.restaurant-item.active {
  background: var(--accent-light);
}

.restaurant-item h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.restaurant-item .city {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  font-size: 0.7rem;
  background: var(--tag-bg);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 20px;
}

/* ── Map ── */
#map {
  flex: 1;
  min-height: 0;
  z-index: 0;
}

/* ── Leaflet popup overrides ── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  max-width: 260px;
}

.leaflet-popup-content {
  margin: 0;
  width: 100% !important;
}

.popup-photo {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.popup-photo-placeholder {
  width: 100%;
  height: 90px;
  background: var(--tag-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--border);
}

.popup-body {
  padding: 12px 14px 14px;
}

.popup-body h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.popup-body .city {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.popup-body p {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #333;
  margin-bottom: 8px;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .layout {
    flex-direction: column-reverse;
  }

  #sidebar {
    width: 100%;
    max-height: 38dvh;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  #map {
    flex: 1;
    min-height: 0;
  }
}
