/* Cmentarz — wyszukiwarka, mapa Leaflet, okno grobu */

/* ---------- wyszukiwarka ---------- */
.controls-container {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: .75rem;
  margin-bottom: 1rem;
}
.search-box { position: relative; flex: 1; min-width: 240px; }
.controls { display: flex; }
.controls .btn { white-space: nowrap; }

#grobSearch {
  width: 100%;
  padding: .8rem 1rem;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .2s, box-shadow .2s;
}
#grobSearch::placeholder { color: var(--muted); }
#grobSearch:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--goldsoft);
}

.search-results-dropdown {
  display: none; /* JS przełącza na block */
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  right: 0;
  z-index: 30;
  max-height: 260px;
  overflow: auto;
  background: var(--drop);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.search-item {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
}
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: var(--s2); }
.search-item strong { color: var(--gold); }
.search-item small { color: var(--muted); }
.search-item-empty { padding: .65rem 1rem; color: var(--muted); text-align: left; }

/* ---------- mapa ---------- */
#map {
  position: relative;
  z-index: 1; /* mapa pod listą podpowiedzi */
  width: 100%;
  height: min(72vh, 720px);
  min-height: 380px;
  background: #0a0a0a;
  border: 1px solid var(--line);
  border-radius: var(--rl);
  overflow: hidden;
}
.leaflet-container { font-family: var(--font); background: #0a0a0a; }

/* przyciski +/− : okrągłe, w prawym dolnym rogu */
.leaflet-top.leaflet-left { top: auto; left: auto; bottom: .75rem; right: .75rem; }
.leaflet-top.leaflet-left .leaflet-control { margin: 0; }
.leaflet-container .leaflet-bar,
.leaflet-touch .leaflet-bar {
  display: grid;
  gap: .4rem;
  border: 0;
  box-shadow: none;
  background: none;
}
.leaflet-container .leaflet-bar a,
.leaflet-touch .leaflet-bar a {
  width: 2.6rem;
  height: 2.6rem;
  line-height: 2.5rem;
  color: var(--text);
  background-color: var(--hdr);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line) !important;
  border-radius: 50% !important;
  font: 600 1.2rem var(--font);
  transition: border-color .2s;
}
.leaflet-container .leaflet-bar a:hover { border-color: var(--gold) !important; background-color: var(--hdr); color: var(--text); }
.leaflet-bar a.leaflet-disabled { opacity: .4; cursor: default; }

/* podpis "Leaflet" w lewym dolnym rogu, żeby nie kolidował z przyciskami */
.leaflet-bottom.leaflet-right { right: auto; left: 0; }
.leaflet-container .leaflet-control-attribution {
  background: var(--hdr);
  color: var(--muted);
  font-size: .7rem;
  padding: .1rem .5rem;
  border-top-right-radius: 10px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.leaflet-control-attribution a { color: var(--gold); }

/* numery grobów */
.numer-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--gold);
  color: #0a0a0a;
  border: 1px solid #000;
  border-radius: 8px;
  font: 700 11px var(--font);
  white-space: nowrap;
  transition: background .2s;
}
.numer-icon:hover { background: #fff; }

/* kolory grobów (kolumna "kolor" w bazie) */
.numer-icon.kolor-niebieski { background: #3b82f6; color: #fff; }
.numer-icon.kolor-zielony   { background: #30a46c; color: #fff; }
.numer-icon.kolor-czerwony  { background: #e5484d; color: #fff; }
.numer-icon.kolor-niebieski:hover,
.numer-icon.kolor-zielony:hover,
.numer-icon.kolor-czerwony:hover { background: #fff; color: #0a0a0a; }

/* ---------- legenda ---------- */
.legenda {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem 1.5rem;
  margin-bottom: 1rem;
  padding: .75rem 1.1rem;
  background: var(--s1);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.legenda-tytul {
  color: var(--gold);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.legenda ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legenda li {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0;
  font-size: .92rem;
  color: var(--text);
}
/* mała kopia znacznika z mapy */
.legenda-znacznik {
  flex: none;
  width: 26px;
  height: 18px;
  border: 1px solid #000;
  border-radius: 6px;
  background: var(--gold);
}
.legenda-znacznik.kolor-niebieski { background: #3b82f6; }
.legenda-znacznik.kolor-zielony   { background: #30a46c; }
.legenda-znacznik.kolor-czerwony  { background: #e5484d; }

@media (max-width: 600px) {
  .legenda { flex-direction: column; align-items: flex-start; }
  .legenda ul { flex-direction: column; }
}

/* ---------- okno grobu ---------- */
#graveModal {
  display: none; /* JS ustawia flex */
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, .8);
}
.modal-content {
  position: relative;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1.7rem;
  background: var(--drop);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--rl);
  text-align: center;
}
.modal-close {
  position: absolute;
  top: .6rem;
  right: .8rem;
  background: none;
  border: 0;
  color: var(--gold);
  font-size: 1.3rem;
  cursor: pointer;
}
.modal-close:hover { color: #fff; }
#modalData h3 { margin: 0 0 .6rem; color: var(--gold); font-size: 1.5rem; }
#modalData p { margin: .3rem 0; }
#modalData img {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 1rem auto 0;
  border-radius: 16px;
  border: 1px solid var(--line);
}
#modalData .modal-location {
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px solid var(--line);
  color: var(--gold);
  font-size: .9rem;
}

@media (max-width: 600px) {
  #map { height: 60vh; min-height: 360px; }
}
