*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #202124;
}

.map-app {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 520px;
}

#map {
  width: 100%;
  height: 100%;
}

.sidebar {
  position: absolute;
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(420px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  z-index: 1000;
}

.sidebar__header {
  padding: 20px 20px 12px;
  border-bottom: 1px solid #e8eaed;
}

.sidebar__title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 600;
}

.sidebar__intro {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #5f6368;
}

.sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 12px;
}

.place-card {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #f8f9fa;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.place-card:hover {
  background: #f1f3f4;
}

.place-card.is-active {
  background: #fff;
  border-color: #1a73e8;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.18);
}

.place-card__image {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #dadce0;
}

.place-card__body {
  min-width: 0;
}

.place-card__title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
}

.place-card__meta {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: #5f6368;
}

.place-card__meta .rating {
  color: #202124;
  font-weight: 600;
}

.place-card__description {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #3c4043;
}

/* Кастомные метки на карте */
.map-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 26px;
  padding: 0 8px;
  border-radius: 13px;
  background: #fff;
  border: 1px solid #dadce0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  font-size: 12px;
  font-weight: 600;
  color: #202124;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.map-label:hover,
.map-label.is-active {
  transform: scale(1.06);
  border-color: #1a73e8;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.28);
}

.leaflet-popup-content-wrapper {
  border-radius: 12px;
}

.leaflet-popup-content {
  margin: 12px 14px;
  line-height: 1.4;
}

.popup-title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
}

.popup-meta {
  margin: 0 0 6px;
  font-size: 0.78rem;
  color: #5f6368;
}

.popup-text {
  margin: 0;
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  html,
  body {
    overflow: hidden;
  }

  .map-app {
    display: flex;
    flex-direction: column;
    min-height: 620px;
    background: #fff;
  }

  #map {
    flex: 0 0 52%;
    min-height: 340px;
    height: auto;
  }

  .sidebar {
    position: relative;
    inset: auto;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    border-top: 1px solid #e8eaed;
    border-radius: 0;
    box-shadow: none;
  }

  .sidebar__header {
    padding: 12px 16px 8px;
  }

  .sidebar__title {
    font-size: 1rem;
    line-height: 1.3;
  }

  .sidebar__intro {
    font-size: 0.82rem;
    line-height: 1.4;
  }

  .sidebar__list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 14px 16px;
    scroll-snap-type: x mandatory;
  }

  .place-card {
    flex: 0 0 min(288px, 86vw);
    grid-template-columns: 76px 1fr;
    margin: 0;
    scroll-snap-align: start;
  }

  .place-card__image {
    width: 76px;
    height: 76px;
  }

  .leaflet-top,
  .leaflet-bottom {
    z-index: 700;
  }

  .leaflet-control-attribution {
    font-size: 9px;
  }
}
