/* ---------- Map view (Discover toggle + #/map) ---------- */

.map-view-wrap { margin: 0 0 12px; }

.map-view {
  width: 100%;
  height: min(70vh, 620px);
  min-height: 360px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2); /* shows while tiles are still loading */
}

/* Category-colored pin, built from the same categoryColor()/categoryIconSvg() every card thumbnail uses. */
.map-pin-wrap { background: transparent; border: none; }
.map-pin {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% 50% 50% 0;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  transform: rotate(-45deg);
}
.map-pin-icon { display: flex; transform: rotate(45deg); }
.map-pin-icon svg { width: 15px; height: 15px; }

.map-popup { font: inherit; min-width: 140px; }
.map-popup strong { display: block; font-size: 13px; margin-bottom: 2px; }
.map-popup-cat { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.map-popup a { font-size: 13px; font-weight: 600; color: var(--brand-text); }

.map-locate-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.4);
}
.map-locate-btn:hover { background: var(--surface-2); }

/* Leaflet's own chrome (zoom buttons, popups, attribution) is styled light by default; the tiles stay light in
   both themes (see the map-view build report), but the chrome around them should still track dark mode. */
:root[data-theme="dark"] .leaflet-control-zoom a,
:root[data-theme="dark"] .leaflet-bar a {
  background: var(--surface);
  color: var(--text);
  border-bottom-color: var(--border);
}
:root[data-theme="dark"] .leaflet-control-zoom a:hover { background: var(--surface-2); }
:root[data-theme="dark"] .map-locate-btn { border-color: var(--border); }
:root[data-theme="dark"] .leaflet-popup-content-wrapper,
:root[data-theme="dark"] .leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}
:root[data-theme="dark"] .leaflet-popup-close-button { color: var(--text-muted) !important; }
:root[data-theme="dark"] .leaflet-control-attribution {
  background: rgba(28, 25, 23, 0.75);
  color: var(--text-muted);
}
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--text-muted); }

/* List: one tight row per result inside a single panel */
.card-list.view-list {
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.rv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.rv-row:first-child { border-top: none; }
.rv-row:hover, .rv-tile:hover { background: var(--surface-2); }

.rv-thumb {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rv-thumb svg { width: 16px; height: 16px; }

.rv-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.rv-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-sub {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rv-end { flex: none; font-size: 12px; font-weight: 600; color: var(--brand-text); }
.rv-chev { flex: none; color: var(--text-muted); }

/* Grid tiles: a picture block on top, then name, one line of context and the key figure */
.rv-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
}

.rv-tile .rv-thumb { width: 100%; height: 56px; border-radius: 8px; margin-bottom: 3px; }
.rv-tile .rv-thumb svg { width: 20px; height: 20px; }

.rv-tile .rv-title {
  font-size: 13px;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.view-grid3 .rv-tile { padding: 6px; }
.view-grid3 .rv-tile .rv-thumb { height: 44px; }
.view-grid3 .rv-tile .rv-title { font-size: 12px; }
.view-grid3 .rv-tile .rv-sub, .view-grid3 .rv-tile .rv-end { font-size: 11px; }

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
}

.card h2, .card h3 { margin: 0 0 4px; }

/* Bookmark toggle: a sibling of `.card`, not nested inside its <a> (two interactive elements can't nest). */
.card-wrap { position: relative; }
.card-wrap .card { padding-right: 48px; }
.save-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
}
.save-toggle svg { width: 16px; height: 16px; }
.save-toggle.saved { color: var(--brand-text); border-color: var(--brand-text); }
/* Labeled variant used inline in a detail page's .btn-row (btn/btn-secondary base already applied via class) */
.save-toggle.btn {
  position: static;
  width: auto;
  height: auto;
  gap: 6px;
}
.save-toggle.btn.saved { color: var(--brand-text); border-color: var(--brand-text); }

.card-meta {
  color: var(--brand-text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.tag {
  background: var(--brand-tint);
  color: var(--brand-text);
  font-size: 11px;
  line-height: 1.3;
  padding: 2px 7px;
  border-radius: 999px;
}

.tag[data-cat="Electronics"] { background: color-mix(in srgb, var(--cat-electronics-fg) 35%, var(--surface)); color: var(--text); }
.tag[data-cat="Fashion"] { background: color-mix(in srgb, var(--cat-fashion-fg) 35%, var(--surface)); color: var(--text); }
.tag[data-cat="Foodstuffs"] { background: color-mix(in srgb, var(--cat-food-fg) 35%, var(--surface)); color: var(--text); }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.status-pill.open { background: var(--success-bg); color: var(--success-text); }
.status-pill.closed { background: var(--danger-bg); color: var(--danger-text); }
.status-pill.pending { background: var(--warning-bg); color: var(--warning-text); }

.link-row {
  display: flex;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-text);
}

