* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
body { display: flex; overflow: hidden; }

/* ---------- Боковая панель ---------- */
#sidebar {
  width: 340px; min-width: 340px; height: 100vh;
  background: #fff; border-right: 1px solid #e5e7eb;
  display: flex; flex-direction: column; z-index: 1000;
}
.sidebar-header { padding: 18px 16px 12px; border-bottom: 1px solid #eef1f4; }
.sidebar-header h1 { margin: 0; font-size: 22px; color: #1e3a8a; }
.subtitle { margin: 4px 0 0; font-size: 12.5px; color: #64748b; line-height: 1.4; }
.count { margin-top: 10px; font-size: 12.5px; color: #2563eb; font-weight: 600; }
.admin-link { display: inline-block; margin-top: 10px; font-size: 13px; color: #2563eb; text-decoration: none; }
.admin-link:hover { text-decoration: underline; }

.search { padding: 10px 16px; }
.search input { width: 100%; padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; }
.search input:focus { border-color: #2563eb; }

/* ---------- Фильтр по типу точек ---------- */
.filters { display: flex; gap: 6px; padding: 0 16px 10px; }
.filter-btn {
  flex: 1; padding: 7px 10px; border: 1px solid #d1d5db; background: #fff;
  border-radius: 8px; font-size: 13px; cursor: pointer; color: #374151; white-space: nowrap;
}
.filter-btn:hover { background: #eff6ff; }
.filter-btn.active { background: #2563eb; color: #fff; border-color: #2563eb; font-weight: 600; }

.point-list { list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; flex: 1; }
.point-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.point-item:hover { background: #eff6ff; }
.point-item.active { background: #dbeafe; }
.point-name { display: block; font-size: 14px; color: #111827; font-weight: 500; line-height: 1.3; }
.point-meta { display: block; font-size: 11.5px; color: #9ca3af; margin-top: 2px; }
.point-badge { display: inline-block; font-size: 10.5px; color: #6b7280; background: #f3f4f6; border-radius: 999px; padding: 1px 7px; margin-top: 3px; }

/* ---------- Карта ---------- */
#map { flex: 1; height: 100vh; }

/* ---------- Легенда ---------- */
.legend {
  position: absolute; left: 352px; bottom: 20px; z-index: 1000;
  background: rgba(255,255,255,.95); border-radius: 8px; padding: 10px 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15); font-size: 12px; color: #334155; max-width: 260px;
}
.legend-title { font-weight: 600; margin-bottom: 6px; color: #1e3a8a; }
.legend-item { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.legend-line { width: 22px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---------- Модальное окно карточки ---------- */
.modal { position: fixed; inset: 0; z-index: 2000; }
.modal.hidden { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.5); }
.modal-panel {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: #fff; border-radius: 14px; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; width: 36px; height: 36px; border: none; border-radius: 50%; background: #f1f5f9; font-size: 22px; line-height: 1; cursor: pointer; color: #334155; }
.modal-close:hover { background: #e2e8f0; }

.card { padding: 28px 32px 32px; }
.card-title { margin: 0 0 4px; font-size: 22px; color: #1e3a8a; }
.card-category { display: inline-block; font-size: 12px; color: #2563eb; background: #eff6ff; border-radius: 999px; padding: 2px 10px; margin: 6px 0 8px; }
.card-coords { font-size: 13px; color: #6b7280; margin-bottom: 16px; }
.card-description { font-size: 15px; line-height: 1.65; color: #1f2937; }
.card-description a { color: #2563eb; }
.card-description i { color: #475569; }
.card-empty { color: #9ca3af; font-style: italic; padding: 12px 0; }
.card-section { margin-top: 20px; border-top: 1px solid #eef1f4; padding-top: 14px; }
.card-section h3 { margin: 0 0 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: #64748b; }
.links { margin: 0; padding-left: 18px; }
.links li { margin-top: 4px; }
.links a { color: #2563eb; text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* Галерея фото */
.gallery { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; }
.gallery img:hover { border-color: #2563eb; }

/* Видео */
.video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.video-frame { aspect-ratio: 16/9; border: 0; border-radius: 8px; width: 100%; }
.video-item-title { font-size: 13px; color: #334155; margin-top: 4px; }
.video-link { color: #2563eb; }

.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; background: #2563eb; color: #fff; text-decoration: none; font-size: 13px; border: none; cursor: pointer; }
.btn:hover { background: #1d4ed8; }

/* ---------- Лайтбокс фото ---------- */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; }
.lightbox.hidden { display: none; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 6px; }
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 40px; color: #fff; background: rgba(255,255,255,.15); border: none; width: 56px; height: 56px; border-radius: 50%; cursor: pointer; }
.lightbox .lb-prev { left: 20px; }
.lightbox .lb-next { right: 20px; }
.lightbox .lb-close { position: absolute; top: 18px; right: 22px; font-size: 34px; color: #fff; background: none; border: none; cursor: pointer; }

/* ---------- Адаптивность ---------- */
@media (max-width: 768px) {
  #sidebar { width: 260px; min-width: 260px; }
  .legend { left: 272px; }
  .video-grid { grid-template-columns: 1fr; }
}
