:root {
  --brand: #ff5a36;
  --brand-dark: #e8471f;
  --ink: #16181d;
  --ink-soft: #5b6470;
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e7e9f0;
  --success: #16a34a;
  --danger: #ef4444;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  height: 100vh; overflow: hidden;
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- Топбар ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: 64px;
  box-shadow: var(--shadow-sm);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-icon { font-size: 20px; }
.brand-accent { color: var(--brand); }

.search-wrap { position: relative; flex: 1; max-width: 460px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: 0.5; }
#searchInput {
  width: 100%;
  padding: 10px 38px 10px 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
#searchInput:focus { border-color: var(--brand); background: white; }
.search-clear-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: var(--border); color: var(--ink-soft); cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.search-clear-btn:hover { background: var(--ink-soft); color: white; }
.hidden { display: none !important; }

.social-links { display: flex; gap: 8px; margin-left: auto; }
.social-icon {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  color: white; text-decoration: none; transition: transform 0.15s, opacity 0.15s;
}
.social-icon:hover { transform: translateY(-2px); opacity: 0.9; }
.social-icon.vk { background: #0077ff; }
.social-icon.tg { background: #26a5e4; }

.wishlist-icon-btn {
  background: var(--bg); color: var(--ink); border: 1px solid var(--border);
  cursor: pointer; position: relative; font-family: inherit;
}
.wishlist-icon-btn:hover { background: var(--border); }
.wishlist-count-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--brand); color: white; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1; box-shadow: 0 0 0 2px white;
}

/* ---------- Лента "Интересное" ---------- */
.banner-strip {
  display: flex;
  gap: 10px;
  padding: 12px 24px;
  overflow-x: auto;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  min-height: 140px;
}
.banner-strip:empty { display: none; }
.banner-item {
  flex: 0 0 auto;
  width: 320px;
  height: 120px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}
.banner-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.banner-item img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; inset: 0; z-index: 0; }
.banner-item .banner-tag {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: rgba(22, 24, 29, 0.7); color: white;
  font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  letter-spacing: 0.02em;
}
.banner-item .banner-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 30px 12px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
  color: white;
}
.banner-item .banner-headline {
  font-size: 14px; font-weight: 800; line-height: 1.2; margin-bottom: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.banner-item .banner-subtext {
  font-size: 11px; font-weight: 500; line-height: 1.3; opacity: 0.92;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ---------- Раскладка ---------- */
.layout {
  display: flex;
  height: calc(100vh - 64px - 140px);
}

.filters {
  width: 264px;
  padding: 20px;
  background: var(--card);
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
.filters h3 { margin-bottom: 14px; font-size: 15px; font-weight: 700; }
.filter-group { margin-bottom: 16px; }
.filter-group label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); margin-bottom: 6px; }
.filter-group select {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); font-family: inherit; font-size: 14px; color: var(--ink); outline: none;
}
.filter-group select:focus { border-color: var(--brand); }
.checkbox-group label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); font-weight: 500; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); }

#applyFilters {
  width: 100%; padding: 11px; background: var(--brand); color: white;
  border: none; border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  font-family: inherit; transition: background 0.15s;
}
#applyFilters:hover { background: var(--brand-dark); }
.results-count { margin-top: 10px; font-size: 12px; color: var(--ink-soft); }
.admin-link-wrap { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.admin-link-wrap a { font-size: 12px; color: var(--ink-soft); text-decoration: none; }
.admin-link-wrap a:hover { color: var(--brand); }

.geo-btn {
  width: 100%; padding: 10px; background: #ecfdf5; color: #047857;
  border: 1px solid #a7f3d0; border-radius: 10px; cursor: pointer; font-size: 13px;
  font-weight: 600; margin-bottom: 6px; font-family: inherit; transition: background 0.15s;
}
.geo-btn:hover { background: #d1fae5; }
.geo-clear-btn {
  width: 100%; padding: 7px; background: none; color: var(--ink-soft);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 12px; font-family: inherit;
}
.geo-status { margin-top: 8px; font-size: 12px; color: #047857; font-weight: 500; }

.add-place-btn {
  width: 100%; padding: 10px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
}
.add-place-btn:hover { background: var(--border); }

.subcategory-checkboxes {
  display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg);
}
.subcategory-checkboxes label {
  display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink);
  background: var(--card); padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border);
  cursor: pointer; white-space: nowrap;
}
.subcategory-checkboxes input[type="checkbox"] { margin: 0; }
.dist-badge { color: var(--brand); font-weight: 700; }

.suggest-edit-btn {
  margin: 10px 0; padding: 8px 14px; background: var(--bg); color: var(--ink-soft);
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit;
}
.suggest-edit-btn:hover { background: var(--border); }
.edit-suggest-form {
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--bg); border-radius: 10px; margin-bottom: 12px;
}
.edit-suggest-form input, .edit-suggest-form textarea {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  font-family: inherit; font-size: 13px; outline: none;
}
.edit-suggest-form button {
  padding: 9px; background: var(--brand); color: white; border: none;
  border-radius: 8px; cursor: pointer; font-weight: 700; font-family: inherit;
}
.review-photo-thumb {
  width: 70px; height: 70px; object-fit: cover; border-radius: 8px;
  cursor: pointer; margin-right: 6px;
}
.photo-thumb-loading {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 8px; background: var(--bg);
  font-size: 10px; color: var(--ink-soft); text-align: center;
}

.map-wrap { flex: 1; position: relative; }
#map { height: 100%; width: 100%; }

.mobile-tabs { display: none; }

.list-panel {
  width: 340px;
  overflow-y: auto;
  background: var(--card);
  border-left: 1px solid var(--border);
}
.place-card {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.place-card:hover { background: var(--bg); }
.place-card .name { font-weight: 700; font-size: 14px; margin-bottom: 4px; letter-spacing: -0.01em; }
.place-card-featured {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 60%);
  border-left: 3px solid var(--success);
}
.featured-check { color: var(--success); font-weight: 700; margin-right: 4px; }
.promo-badge {
  display: inline-block; font-size: 11px; font-weight: 700; color: #92400e;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  padding: 3px 9px; border-radius: 6px; margin: 4px 0; line-height: 1.4;
}
.promo-badge-modal { font-size: 12px; padding: 5px 10px; margin: 8px 0; }
.place-icon { margin-right: 4px; }
.featured-marker-inner {
  width: 32px; height: 32px; background: var(--success); border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35); border: 2px solid white;
}
.featured-marker-inner { font-size: 15px; }
.featured-marker-inner > * { transform: rotate(45deg); }
.place-card .meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 2px; }
.place-card .rating { color: #d97706; font-weight: 700; }
.rating-source { font-size: 10px; color: #9ca3af; }
.rating-breakdown { font-size: 12px; color: var(--ink-soft); }
.place-card .open-badge {
  color: var(--success); font-size: 11px; font-weight: 700;
  background: #ecfdf5; padding: 2px 8px; border-radius: 999px;
}
.place-card .closed-badge {
  color: var(--danger); font-size: 11px; font-weight: 700;
  background: #fef2f2; padding: 2px 8px; border-radius: 999px;
}

/* ---------- Модалка ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--card); border-radius: 20px; padding: 28px;
  max-width: 500px; width: 92%; max-height: 85vh; overflow-y: auto;
  position: relative; box-shadow: var(--shadow-md);
}
.close-btn {
  position: absolute; top: 16px; right: 16px; background: var(--bg);
  border: none; font-size: 20px; width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; color: var(--ink-soft); display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { background: var(--border); }
.modal-content h2 { margin-bottom: 10px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.modal-content h3 { font-size: 15px; font-weight: 700; }
.modal-content .info-row { font-size: 14px; margin: 8px 0; color: var(--ink-soft); line-height: 1.5; }
.modal-content .info-row a { color: var(--brand); text-decoration: none; font-weight: 600; }
.review-item { border-top: 1px solid var(--border); padding: 10px 0; font-size: 13px; }
.review-form { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.review-form input, .review-form select, .review-form textarea {
  width: 100%; padding: 9px 12px; margin-bottom: 10px; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; font-size: 14px; outline: none;
}
.review-form input:focus, .review-form select:focus, .review-form textarea:focus { border-color: var(--brand); }
.review-form button {
  padding: 10px 18px; background: var(--brand); color: white; border: none;
  border-radius: 10px; cursor: pointer; font-weight: 700; font-family: inherit; font-size: 14px;
}
.review-form button:hover { background: var(--brand-dark); }

.suggest-edit-link {
  display: inline-block; margin-top: 12px; font-size: 13px; color: var(--brand);
  cursor: pointer; font-weight: 600; text-decoration: none;
}
.suggest-edit-link:hover { text-decoration: underline; }
.suggest-form { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.suggest-form textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 13px; outline: none; resize: vertical; }
.suggest-form textarea:focus { border-color: var(--brand); }
.suggest-form button {
  padding: 9px 16px; background: var(--ink); color: white; border: none;
  border-radius: 10px; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 13px; margin-top: 8px;
}

/* ---------- Мобильная адаптация ---------- */
@media (max-width: 768px) {
  body { overflow: auto; height: auto; }

  .topbar { flex-wrap: wrap; height: auto; padding: 12px 16px; gap: 10px; }
  .brand { font-size: 17px; }
  .search-wrap { max-width: 100%; flex-basis: 100%; order: 3; }
  .social-links { margin-left: 0; }

  .banner-strip { min-height: 130px; padding: 8px 12px; }
  .banner-item { width: 260px; height: 116px; }
  .banner-item .banner-overlay { padding: 26px 10px 8px; }
  .banner-item .banner-headline { font-size: 12px; margin-bottom: 1px; }
  .banner-item .banner-subtext { font-size: 10.5px; line-height: 1.25; -webkit-line-clamp: 2; }

  .layout {
    flex-direction: column;
    height: auto;
  }

  .filters {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 60vh;
  }

  .mobile-tabs {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
  }
  .mobile-tab-btn {
    flex: 1; padding: 13px; border: none; background: none;
    font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
    border-bottom: 3px solid transparent; font-family: inherit;
  }
  .mobile-tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }

  .map-wrap {
    display: none;
    flex: none;
    height: 70vh;
    min-height: 400px;
    width: 100%;
    position: relative;
  }
  .map-wrap.mobile-visible { display: block; }
  #map { height: 100% !important; width: 100% !important; min-height: 400px; position: absolute; inset: 0; }

  .list-panel {
    display: none;
    width: 100%;
    border-left: none;
    max-height: 70vh;
  }
  .list-panel.mobile-visible { display: block; }

  .modal-content { padding: 20px; max-height: 90vh; }
}


.coords-hint { margin-bottom: 10px; }
.coords-hint input { margin-bottom: 0; }
.coords-help {
  font-size: 11px; color: var(--ink-soft); margin-top: 6px; line-height: 1.5;
  background: var(--bg); padding: 8px 10px; border-radius: 8px;
}

.reviews-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.reviews-header h3 { margin: 0; }
.review-sort-select {
  font-size: 12px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); font-family: inherit; color: var(--ink);
}
.photo-upload-label {
  display: inline-block; font-size: 12px; color: var(--brand); cursor: pointer;
  margin-top: 4px; font-weight: 600;
}
.photo-preview { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.photo-thumb { position: relative; width: 60px; height: 60px; border-radius: 8px; overflow: hidden; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb button {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: white; border: none; font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.review-photos { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.review-photo {
  width: 70px; height: 70px; border-radius: 8px; object-fit: cover; cursor: pointer;
  border: 1px solid var(--border);
}

.place-card-temp-closed { opacity: 0.75; }
.temp-closed-marker-inner {
  width: 16px; height: 16px; background: #9ca3af; border-radius: 50%;
  border: 2px solid white; box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* ---------- Вишлист "Хочу сходить" ---------- */

/* Сердечко на карточке (список справа) и в модалке заведения — сделано
   тем же способом, что кнопка очистки поиска (круглая, без эмодзи, чистая
   SVG-иконка), чтобы визуально не выбивалось "восьмибитным" видом emoji,
   который по-разному рендерится в разных браузерах/ОС. */
.wishlist-heart-btn {
  border: none; background: var(--card); cursor: pointer; padding: 0;
  position: absolute; top: 12px; right: 12px; line-height: 1;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  transition: transform 0.15s, background 0.15s;
}
.wishlist-heart-btn svg { width: 15px; height: 15px; stroke: var(--ink-soft); fill: none; stroke-width: 2; transition: stroke 0.15s, fill 0.15s; }
.wishlist-heart-btn:hover { transform: scale(1.1); }
.wishlist-heart-btn.active svg { stroke: var(--brand); fill: var(--brand); }
.place-card { position: relative; }

/* Кнопка "Подробнее" во всплывающем окне на карте (стандартный Leaflet
   popup) - приводим к тому же фирменному стилю, что остальные кнопки
   действия на сайте, плюс отступ сверху от строки рейтинга. */
.leaflet-popup-content .map-popup-btn {
  display: block; width: 100%; margin-top: 8px; padding: 8px 12px;
  background: var(--brand); color: white; border: none; border-radius: 8px;
  cursor: pointer; font-weight: 700; font-size: 13px; font-family: inherit;
  transition: background 0.15s;
}
.leaflet-popup-content .map-popup-btn:hover { background: var(--brand-dark); }

/* Сердечко в окне подробностей заведения ставим рядом с крестиком
   закрытия - тем же absolute-позиционированием, чтобы получилась пара
   круглых кнопок в углу, а не оторванная иконка посреди заголовка. */
.wishlist-heart-btn-modal {
  position: absolute; top: 16px; right: 58px; width: 32px; height: 32px;
  box-shadow: none; border: 1px solid var(--border); background: var(--card);
}
.wishlist-heart-btn-modal svg { width: 16px; height: 16px; }
.wishlist-heart-btn-modal svg { width: 16px; height: 16px; }

/* Список внутри модалки вишлиста */
.wishlist-item {
  position: relative;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 12px 34px 12px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.wishlist-item:last-child { border-bottom: none; }
.wishlist-item-info { flex: 1; }
.wishlist-item-info .meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

/* Крестик удаления — тот же стиль, что у крестика очистки поиска,
   расположен над строкой (справа от заголовка), а не под текстом. */
.wishlist-remove-btn {
  position: absolute; top: 10px; right: 0;
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: var(--border); color: var(--ink-soft); cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.wishlist-remove-btn:hover { background: var(--danger); color: white; }

/* Кнопка "Поделиться списком" — в стиле основной кнопки сайта (как
   "Применить" в фильтрах): яркая, фирменного оранжевого цвета. */
.share-wishlist-btn {
  width: 100%; padding: 11px; background: var(--brand); color: white; border: none;
  border-radius: 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  font-family: inherit; transition: background 0.15s;
}
.share-wishlist-btn:hover { background: var(--brand-dark); }

.subcategory-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}
.subcategory-checkboxes label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--ink);
  background: var(--card);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
}
.subcategory-checkboxes input[type="checkbox"] {
  margin: 0;
}

@media (max-width: 768px) {
  #addPlaceModal .modal-content {
    padding: 20px 14px;
  }
  #addPlaceModal .subcategory-checkboxes {
    flex-direction: column;
    max-height: 160px;
  }
  #addPlaceModal .subcategory-checkboxes label {
    width: 100%;
    justify-content: flex-start;
    border-radius: 8px;
    margin-bottom: 2px;
    font-size: 13px;
    padding: 8px 10px;
  }
  #addPlaceModal .coords-help {
    font-size: 11px;
    line-height: 1.4;
  }
}

/* Фикс крестика удаления в вишлисте — не перекрывает название */
.wishlist-item {
  padding-right: 40px !important;
}
.wishlist-remove-btn {
  right: 8px !important;
  width: 20px !important;
  height: 20px !important;
  font-size: 11px !important;
}

/* Фикс чекбоксов категорий на мобильных — текст обрезан */
@media (max-width: 768px) {
  #addPlaceModal .subcategory-checkboxes label {
    white-space: normal !important;
    word-wrap: break-word !important;
    text-overflow: clip !important;
    overflow: visible !important;
    line-height: 1.3 !important;
  }
}
