/* Map pages */

/* ── Map selector ───────────────────────────────────── */
.map-selector-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.map-selector-header {
  margin-bottom: 28px;
}

.map-selector-header h1 { margin-bottom: 4px; }

.maps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.map-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: all var(--transition);
  color: var(--text);
  display: block;
}

.map-card:hover {
  border-color: var(--border-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.map-card-img {
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-card);
}

.map-card-info {
  padding: 12px 14px;
}

.map-card-name {
  font-weight: 600;
  font-size: 14px;
}

/* ── Map view layout ────────────────────────────────── */
.map-layout {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

/* ── Sidebar ────────────────────────────────────────── */
.map-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-search {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-modes {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.mode-btn {
  flex: 1;
  padding: 5px;
  border-radius: var(--r);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-btn:hover { background: var(--bg-hover); color: var(--text); }
.mode-btn.active { background: var(--accent-dim); color: var(--accent-2); border-color: rgba(139,92,246,0.4); }

.sidebar-route-controls {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-3);
  text-transform: uppercase;
  padding: 12px 12px 4px;
}

.sidebar-category-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 8px;
}

.sidebar-category-controls button {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  background: none;
  color: var(--text-3);
}
.sidebar-category-controls button.active-control {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sidebar-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px 12px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--transition);
  opacity: 0.5;
}

.category-item.active { opacity: 1; }
.category-item:hover { background: var(--bg-hover); opacity: 1; }

.category-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.category-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  text-decoration: inherit;
}

.category-count {
  flex-shrink: 0;
}

.sidebar-search-results {
  border-top: 1px solid var(--border);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}

.search-result-item:hover { background: var(--bg-hover); }

/* ── Map container ──────────────────────────────────── */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#leaflet-map {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

/* Leaflet dark theme overrides */
.leaflet-container { background: #0a0c0f; }
.leaflet-control-zoom a { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.leaflet-control-zoom a:hover { background: var(--bg-hover); }

.map-hint-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(139, 92, 246, 0.15);
  border-bottom: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  padding: 6px;
  z-index: 500;
  pointer-events: none;
}

.map-hint-bar a { pointer-events: all; color: var(--accent-2); font-weight: 700; }

.map-coords-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  background: rgba(10, 12, 15, 0.8);
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--font-mono, monospace);
  padding: 4px 10px;
  z-index: 500;
  pointer-events: none;
}

.map-name-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  padding: 3px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 20px;
}

/* ── Marker panel ───────────────────────────────────── */
.marker-panel {
  position: fixed;
  top: var(--nav-height);
  right: -400px;
  width: 380px;
  bottom: 0;
  background: var(--bg-2);
  border-left: 1px solid var(--border);
  z-index: 200;
  overflow-y: auto;
  transition: right 0.25s ease;
}

.marker-panel.open { right: 0; }

.marker-panel-inner { padding: 20px; }

.marker-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.marker-panel-header h3 { font-size: 1.1rem; margin-bottom: 6px; }

.marker-panel-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.marker-description {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 12px;
  white-space: pre-wrap;
}

.marker-meta { font-size: 12px; color: var(--text-3); }

/* Comments */
.marker-comments {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.comment-item {
  display: flex;
  gap: 10px;
}

.comment-body { flex: 1; }

.comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.comment-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Custom marker icon */
.marker-pin {
  width: 28px;
  height: 36px;
  position: relative;
}

.btn-success {
  background: rgba(63,185,80,0.15);
  color: var(--success);
  border-color: rgba(63,185,80,0.3);
}

/* Personal marker */
.personal-marker {
  border: 2px dashed #5b8dee;
  background: rgba(91,141,238,0.15);
  border-radius: 50%;
  width: 16px;
  height: 16px;
}

/* Route line */
.route-line { stroke: #5b8dee; stroke-dasharray: 8,4; }
.shared-route-line { stroke: #3fb950; }

@media (max-width: 768px) {
  .map-sidebar {
    position: fixed;
    left: -280px;
    top: var(--nav-height);
    bottom: 0;
    transition: left 0.25s ease;
    z-index: 300;
  }
  .map-sidebar.open { left: 0; }
  .marker-panel { width: 100%; right: -100%; }
  .marker-panel.open { right: 0; }
}
