/* ===== «По пути» — общие стили ===== */
:root {
  --green: #1b7f3a;
  --green-dark: #145d29;
  --green-light: #e7f5ec;
  --teal: #0e7c86;
  --gold: #d99a26;
  --ink: #22303a;
  --muted: #66788a;
  --line: #dfe7ee;
  --bg: #f4f7fa;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(20, 50, 40, .12);
  --font: "Segoe UI", "Arial", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 18px; }

header.topbar {
  background: linear-gradient(120deg, var(--green-dark), var(--green) 60%, #2f8f4e);
  color: #fff;
  box-shadow: var(--shadow);
  position: relative;
  z-index: 20;
}
.topbar .container { display: flex; align-items: center; gap: 22px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 22px; color: #fff; text-decoration: none; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 10px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px;
}
.topbar nav { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.topbar nav a, .topbar nav button.bare {
  color: #fff; text-decoration: none; padding: 8px 14px; border-radius: 8px;
  background: rgba(255,255,255,.12); border: 1px solid transparent; font-size: 14px; cursor: pointer;
}
.topbar nav a:hover, .topbar nav button.bare:hover { background: rgba(255,255,255,.2); }
.topbar nav .user-chip { background: rgba(255,255,255,.16); padding: 8px 14px; border-radius: 8px; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 9px; padding: 10px 16px;
  font-size: 15px; cursor: pointer; text-decoration: none; background: var(--green); color: #fff;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.outline { background: #fff; color: var(--green); border-color: var(--green); }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 7px; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 5px; font-size: 14px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=tel], .field input[type=url],
.field input[type=file], .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 15px; font-family: var(--font); background: #fff; color: var(--ink);
}
.field textarea { min-height: 90px; resize: vertical; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* ===== Подсветка обязательного поля ===== */
.field-required-error input,
.field-required-error select,
.field-required-error textarea {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
  animation: field-pulse 1.5s ease-in-out 3;
}
.field-required-error label {
  color: var(--danger);
}
.field-hint-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
@keyframes field-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(192, 57, 43, 0.25); }
}

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.tag { display: inline-block; background: var(--green-light); color: var(--green-dark); border-radius: 20px; padding: 2px 10px; font-size: 12.5px; margin: 2px 4px 2px 0; }
.stars { color: var(--gold); letter-spacing: 1px; }
.muted { color: var(--muted); font-size: 13px; }
.notice { background: #fff7e6; border: 1px solid #f3d59a; color: #7a5b12; border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px; }
.notice-error { background: #fdecea; border-color: #f5c2bd; color: #8e2a1f; }

/* ===== Карточка объекта ===== */
.obj-card .title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.obj-card .contact-line a { color: var(--ink); text-decoration: none; }
.obj-card .contact-line a:hover { text-decoration: underline; }

/* слайдер фото */
.p-slider { position: relative; overflow: hidden; border-radius: 10px; margin: 10px 0; }
.p-track { display: flex; transition: transform .35s ease; }
.p-slide { flex: 0 0 100%; }
.p-img { width: 100%; height: 260px; object-fit: cover; display: block; cursor: zoom-in; border-radius: 10px; }
.p-arrow { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.5); color: #fff; border: none; width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; z-index: 5; display: flex; align-items: center; justify-content: center; }
.p-arrow.prev { left: 8px; }
.p-arrow.next { right: 8px; }
.p-arrow:hover { background: rgba(0,0,0,.75); }
.p-count { position: absolute; bottom: 8px; right: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 12px; z-index: 5; }

/* лайтбокс (просмотр фото в полный размер) */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 20000; display: flex; align-items: center; justify-content: center; cursor: zoom-out; outline: none; }
.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 6px; }
.lightbox .lb-close { position: absolute; top: 16px; right: 20px; background: rgba(255,255,255,.2); color: #fff; border: none; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.lightbox .lb-nav { position: absolute; bottom: 20px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; }
.lightbox .lb-btn { background: rgba(255,255,255,.25); color: #fff; border: none; width: 44px; height: 44px; border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; }
.lightbox .lb-btn:hover { background: rgba(255,255,255,.45); }
.lightbox .lb-count { color: #fff; font-size: 14px; }

.review { border-top: 1px dashed var(--line); padding: 10px 0 4px; }
.review .who { font-weight: 600; font-size: 13.5px; }

table.data { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
table.data th { background: var(--green-light); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
table.data tr:hover td { background: #fbfdfc; }

.gallery-thumb { width: 46px; height: 34px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.legalbar { border-top: 1px dashed var(--line); padding: 14px 0; margin-top: 18px; color: var(--muted); font-size: 13.5px; }

/* ===== Главная страница: фильтры/список/карта ===== */
#app { display: flex; height: calc(100vh - 74px); min-height: 520px; }
aside.panel {
  width: 380px; min-width: 300px; overflow-y: auto; background: #fff;
  border-right: 1px solid var(--line); padding: 16px;
}
#map { flex: 1; }

.route-box { display: flex; gap: 8px; flex-wrap: wrap; }

/* Главные кнопки (показать маршрут / показать всех) — покрупнее и заметнее */
.route-box .btn { flex: 1 1 0; min-width: 150px; padding: 13px 18px; font-size: 16px; font-weight: 700; border-radius: 11px; }
.route-box .btn#btnRoute { background: var(--green); box-shadow: 0 4px 12px rgba(27, 127, 58, .35); }
.route-box .btn#btnShowAll { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 4px 12px rgba(14, 124, 134, .3); }
.route-box .btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(20, 80, 40, .28); }
.route-box .btn:active { transform: translateY(0); }
.from-row { display: flex; gap: 8px; align-items: flex-start; }
.from-row .autocomplete-wrap { flex: 1 1 auto; }

/* Чекбокс под полем «Откуда»: включение геолокации */
.field label.check-row {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 0;
  font-weight: 400; font-size: 13.5px; color: var(--ink);
  cursor: pointer; user-select: none;
}
.field label.check-row input[type=checkbox] {
  flex: 0 0 auto; width: 18px; height: 18px; margin: 0;
  accent-color: var(--green); cursor: pointer;
}
.field label.check-row input[type=checkbox]:disabled { cursor: progress; }
.field label.check-row:hover { color: var(--green-dark); }
.field label.check-row:has(input:disabled) { opacity: .65; }
.autocomplete-wrap { position: relative; flex: 1 1 100%; }
.autocomplete-wrap input { width: 100%; }
.suggest { position: absolute; z-index: 6000; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.suggest div { padding: 9px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #f0f4f7; }
.suggest div:hover { background: var(--green-light); }

.tabs { display: flex; gap: 6px; margin: 14px 0 10px; flex-wrap: wrap; }
.tabs button {
  flex: 1; min-width: 96px; padding: 9px 8px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
}
.tabs button.active { background: var(--green); color: #fff; border-color: var(--green); }

.cat-tree { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.cat-tree label {
  font-size: 13.5px; display: flex; align-items: center; gap: 7px; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fbfdfc;
}
.cat-tree label.checked { background: var(--green-light); border-color: #a9d4b4; }
.cat-tree .parent-name { font-weight: 700; }
.cat-tree .arrow { margin-left: auto; font-size: 11px; color: var(--muted); transition: transform .15s; }
.cat-tree label.checked .arrow { transform: rotate(90deg); }
.subs {
  display: flex; flex-wrap: wrap; grid-column: 1 / -1; margin-left: 6px;
  font-size: 12.5px; color: var(--muted);
}
.subs[hidden] { display: none; }
.subs label { font-size: 12.5px; padding: 5px 8px; }
.cat-tree .small-hint { color: var(--muted); font-size: 12px; margin: 2px 0 4px; grid-column: 1 / -1; }
/* цветные метки категорий в фильтрах — компактные квадратики, без заливки кнопок */
.cat-dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.slider-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.cta { background: var(--green-light); border: 1px dashed #b7d4bd; border-radius: 12px; padding: 14px 16px; margin: 4px 0 6px; }
.cta .cta-title { margin: 0 0 4px; font-weight: 700; font-size: 14.5px; }
.cta .muted { margin: 0 0 10px; }
.slider-row input[type=range] { flex: 1; }

.obj-list-item {
  border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer; background: #fff; transition: box-shadow .12s;
}
.obj-list-item:hover { box-shadow: 0 3px 12px rgba(0,0,0,.1); }
.obj-list-item h4 { margin: 0 0 3px; font-size: 15px; }
.obj-list-item .addr { font-size: 13px; color: var(--muted); }
.obj-list-item .d { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12.5px; }

/* маркеры */
.marker-icon { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-size: 15px; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); position: relative; }
.marker-icon::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset -2px -3px 5px rgba(0,0,0,.25), inset 2px 2px 4px rgba(255,255,255,.45); }
.marker-farmer { background: linear-gradient(145deg, #2f9e44, #2b8a3e); }
.marker-leisure { background: linear-gradient(145deg, #0ea5a5, #0d9488); }
.marker-start { background: linear-gradient(145deg, #3b82f6, #2563eb); }
.marker-end { background: linear-gradient(145deg, #ef4444, #dc2626); }
.marker-stop { background: linear-gradient(145deg, #eab308, #d97706); }
.marker-route { background: linear-gradient(145deg, #eab308, #d97706); }

/* Посылки: место забора — сплошной круг, место доставки — квадрат.
   Формой они отличаются от объектов, чтобы их нельзя было спутать. */
.marker-parcel { background: linear-gradient(145deg, #8b5cf6, #7c3aed); }
.marker-parcel-to {
  border-radius: 8px;
  background: linear-gradient(145deg, #a78bfa, #8b5cf6);
  opacity: .92;
}
/* цвета по категориям фермерских товаров */
.cat-ovosh { background: linear-gradient(145deg, #2f9e44, #238636) !important; }
.cat-frukt { background: linear-gradient(145deg, #ec4899, #db2777) !important; }
.cat-yagody { background: linear-gradient(145deg, #d946a8, #be185d) !important; }
.cat-zelen { background: linear-gradient(145deg, #65a30d, #4d7c0f) !important; }
.cat-griby { background: linear-gradient(145deg, #a16207, #854d0e) !important; }
.cat-med { background: linear-gradient(145deg, #f59e0b, #d97706) !important; }
.cat-yajca { background: linear-gradient(145deg, #fbbf24, #f59e0b) !important; }
.cat-moloko { background: linear-gradient(145deg, #64748b, #475569) !important; }
.cat-myaso { background: linear-gradient(145deg, #b91c1c, #991b1b) !important; }
.cat-ryba { background: linear-gradient(145deg, #0284c7, #0369a1) !important; }
.cat-polufab { background: linear-gradient(145deg, #c2410c, #9a3412) !important; }
.cat-konserv { background: linear-gradient(145deg, #ca8a04, #a16207) !important; }
.cat-solen { background: linear-gradient(145deg, #84cc16, #65a30d) !important; }
.cat-hleb { background: linear-gradient(145deg, #d97706, #b45309) !important; }
.cat-sazhency { background: linear-gradient(145deg, #10b981, #059669) !important; }
.cat-prochee { background: linear-gradient(145deg, #78716c, #57534e) !important; }
/* цвета по категориям досуга */
.cat-muzei { background: linear-gradient(145deg, #8b5cf6, #7c3aed) !important; }
.cat-dostop { background: linear-gradient(145deg, #6366f1, #4f46e5) !important; }
.cat-teatry { background: linear-gradient(145deg, #a855f7, #9333ea) !important; }
.cat-kafe { background: linear-gradient(145deg, #f97316, #ea580c) !important; }
.cat-restoran { background: linear-gradient(145deg, #dc2626, #b91c1c) !important; }
.cat-kofe { background: linear-gradient(145deg, #92400e, #78350f) !important; }
.cat-syr { background: linear-gradient(145deg, #eab308, #ca8a04) !important; }
.cat-park { background: linear-gradient(145deg, #22c55e, #16a34a) !important; }
.cat-tualet { background: linear-gradient(145deg, #94a3b8, #64748b) !important; }
.marker-selected { border: 3px solid #ffd700; box-shadow: 0 0 0 4px rgba(255, 215, 0, .45), 0 4px 14px rgba(0,0,0,.45); }
.marker-icon > .emoji { z-index: 1; }
.obj-list-item.selected { border: 2px solid var(--gold); box-shadow: 0 3px 12px rgba(0,0,0,.15); }

#routePopup { position: fixed; z-index: 9000; right: 18px; bottom: 18px; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; font-size: 14px; display: none; max-width: 340px; max-height: calc(100vh - 60px); overflow-y: auto; }
#routePopup.show { display: block; }
#routePopup::-webkit-scrollbar { width: 8px; }
#routePopup::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
#routePopup::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
#routePopup::-webkit-scrollbar-track { background: transparent; }

footer.legalbar { border-top: 1px solid var(--line); padding: 26px 0 40px; margin-top: 34px; color: var(--muted); font-size: 13.5px; }

/* Скрываем логотип (флаг) Leaflet в правом нижнем углу карты, оставляя атрибуцию */
.leaflet-container .leaflet-control-attribution .leaflet-attribution-flag { display: none !important; }

/* ===== Название в шапке: подстрочник + печатное название ===== */
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-sub {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.9;
  letter-spacing: .3px;
}
.brand-main {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== Баннер «Сайт в разработке» ===== */
.dev-banner {
  background: linear-gradient(135deg, #fff3cd, #ffeeba);
  border-bottom: 1px solid #ffc107;
  padding: 10px 0;
  position: relative;
  z-index: 100;
}
.dev-banner-content {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dev-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.dev-banner-text {
  font-size: 14px;
  color: #856404;
  flex: 1;
}
.dev-banner-text a {
  color: #7a3e00;
  font-weight: 600;
  text-decoration: underline;
}
.dev-banner-text a:hover {
  color: #5c2f00;
}
.dev-banner-close {
  background: none;
  border: none;
  font-size: 18px;
  color: #856404;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}
.dev-banner-close:hover {
  background: rgba(133, 100, 4, 0.1);
}

/* ===== Cookie-баннер =====
   Стили вынесены в отдельный файл /css/cookie-consent.css
   (модульная подключаемость + единый баннер на всех страницах). */

/* Скрытие баннера «Сайт в разработке» */
.dev-banner.hidden {
  display: none;
}

@media (max-width: 900px) {
  /* мобильный режим: карта сверху и всегда на экране, панель ниже прокручивается */
  #app { display: flex; flex-direction: column; height: calc(100vh - 74px); height: calc(100dvh - 74px); min-height: 0; }
  aside.panel { order: 2; flex: 0 0 46%; width: 100%; max-height: 46%; overflow-y: auto; border-right: none; border-bottom: 1px solid var(--line); }
  #map { order: 1; flex: 1 1 auto; min-height: 0; }
  .brand-sub { font-size: 10px; }
  .brand-main { font-size: 16px; letter-spacing: 1.5px; }
  #routePopup { right: 8px; bottom: 8px; left: 8px; max-width: none; }
}