/* CoinMap — тёмная тема */

:root {
  --bg: #0f1216;
  --panel: #161b22;
  --panel-2: #1c232c;
  --line: #262d36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #d4a24a;
  --accent-dim: rgba(212, 162, 74, 0.15);
  --gold: #d4a24a;
  --silver: #b8c4ce;
  --copper: #b87333;
  --other: #7d8896;
  --danger: #e5534b;
  --feed-w: 330px;
  --header-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- шапка ---------- */

.header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 1200;
}

.logo {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
  color: var(--text);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; }
.logo span { color: var(--accent); }

.header-spacer { flex: 1; }

.layer-switch {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.layer-switch button {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.layer-switch button.active { background: var(--accent-dim); color: var(--accent); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chip:hover { color: var(--text); }
.chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn:hover { border-color: #3a4552; text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1b1305; font-weight: 600; }
.btn-primary:hover { background: #e0b25f; border-color: #e0b25f; }
.btn-danger { color: var(--danger); border-color: rgba(229, 83, 75, 0.4); }
.btn:disabled { opacity: 0.5; cursor: default; }

.user-box { display: flex; align-items: center; gap: 10px; font-size: 14px; white-space: nowrap; }

/* ---------- каркас главной ---------- */

.layout {
  display: flex;
  height: calc(100% - var(--header-h));
}

#map { flex: 1; background: #0b0e12; }

.feed {
  width: var(--feed-w);
  border-left: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.feed-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.feed-title { font-weight: 600; font-size: 14px; }
.feed-count { color: var(--muted); font-size: 13px; }

.feed-list { overflow-y: auto; flex: 1; padding: 8px; }

.feed-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
}
.feed-item:hover { background: var(--panel-2); }
.feed-item img {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
  border: 1px solid var(--line);
  flex: none;
}
.feed-item .fi-body { min-width: 0; flex: 1; }
.feed-item .fi-title {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-item .fi-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.feed-item .fi-likes { font-size: 12px; color: var(--muted); flex: none; }

.filters-extra {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}
.filters-extra.open { display: flex; }
.filters-extra label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 3px; }
.filters-extra .f-col { flex: 1; min-width: 90px; }

input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 90px; }

.empty { color: var(--muted); font-size: 14px; padding: 24px 12px; text-align: center; }

/* ---------- маркеры карты ---------- */

.coin-marker-wrap, .city-marker-wrap { background: none; border: 0; }

.coin-marker {
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #0b0e12 center/cover no-repeat;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}
.coin-marker.metal-серебро { border-color: var(--silver); }
.coin-marker.metal-медь { border-color: var(--copper); }
.coin-marker.metal-другое { border-color: var(--other); }
.coin-marker.active { box-shadow: 0 0 0 4px var(--accent-dim), 0 2px 10px rgba(0,0,0,.55); }

.city-marker {
  border-radius: 50%;
  background: rgba(212, 162, 74, 0.22);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.leaflet-popup-content-wrapper {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.leaflet-popup-tip { background: var(--panel); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--panel); color: var(--text); border-color: var(--line);
}
.leaflet-control-attribution {
  background: rgba(15, 18, 22, 0.75) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--muted) !important; }

.popup-coin { width: 230px; }
.popup-coin img {
  width: 100%; height: 130px; object-fit: cover;
  border-radius: 8px; background: var(--panel-2); margin-bottom: 8px;
}
.popup-coin .p-title { font-weight: 600; margin-bottom: 2px; }
.popup-coin .p-meta { color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.popup-city { width: 240px; }
.popup-city .p-note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.popup-city .p-thumbs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.popup-city .p-thumbs img {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  border: 1px solid var(--line); cursor: pointer;
}
.popup-city ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- обычные страницы ---------- */

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}
.page h1 { font-size: 24px; margin: 0 0 4px; }
.page h2 { font-size: 17px; margin: 24px 0 10px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
}
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > .col { flex: 1; min-width: 180px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.checkbox input { width: auto; }

.msg { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg.error { background: rgba(229, 83, 75, 0.12); border: 1px solid rgba(229, 83, 75, 0.4); color: #ff9a94; }
.msg.ok { background: rgba(63, 185, 80, 0.12); border: 1px solid rgba(63, 185, 80, 0.35); color: #77dd8a; }

/* автокомплит */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1500;
  display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 8px 10px; cursor: pointer; font-size: 14px; }
.ac-item:hover, .ac-item.sel { background: var(--accent-dim); }
.ac-item .ac-sub { color: var(--muted); font-size: 12px; }

/* фото-слоты */
.photo-slots { display: flex; gap: 14px; flex-wrap: wrap; }
.photo-slot {
  width: 150px; height: 150px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  overflow: hidden;
  background: var(--panel-2);
  position: relative;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot input[type=file] { display: none; }
.photo-slot .ps-label { padding: 10px; }

#mintMap { height: 260px; border-radius: 12px; border: 1px solid var(--line); }

/* монета */
.coin-photos { display: flex; gap: 16px; flex-wrap: wrap; }
.coin-photos figure { margin: 0; }
.coin-photos img {
  width: 300px; max-width: 100%; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel-2);
}
.coin-photos figcaption { color: var(--muted); font-size: 12px; margin-top: 6px; text-align: center; }
.props { list-style: none; padding: 0; margin: 0; }
.props li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.props li b { color: var(--muted); font-weight: 400; min-width: 140px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted);
}

.grid-coins {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.grid-coins a { color: inherit; }
.grid-coins a:hover { text-decoration: none; }
.grid-coins .gc-img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2);
}
.grid-coins .gc-title { font-size: 13px; margin-top: 6px; font-weight: 600; }
.grid-coins .gc-meta { font-size: 12px; color: var(--muted); }

.stats { display: flex; gap: 22px; margin: 10px 0 4px; }
.stats div b { display: block; font-size: 20px; }
.stats div span { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button { flex: 1; }
.tabs button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ---------- мобильная вёрстка ---------- */

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  #map { flex: 1; min-height: 0; }
  .feed {
    width: 100%;
    height: 150px;
    border-left: 0;
    border-top: 1px solid var(--line);
    flex: none;
  }
  .feed-list {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
  }
  .feed-item {
    flex-direction: column;
    width: 96px;
    flex: none;
    text-align: center;
    padding: 6px;
  }
  .feed-item .fi-title { font-size: 12px; white-space: normal; max-height: 32px; overflow: hidden; }
  .feed-item .fi-meta { justify-content: center; font-size: 11px; }
  .feed-item .fi-likes { display: none; }

  .header { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .layout { height: auto; flex: 1; }
  body { display: flex; flex-direction: column; }
  .header-spacer { display: none; }
  .chips { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .chip { flex: none; }
  .user-box { font-size: 13px; }
  .user-box .btn { padding: 6px 10px; font-size: 13px; }
  .coin-photos img { width: 100%; }
  .props li { flex-direction: column; gap: 2px; }
  .props li b { min-width: 0; }
}
