html,
body {
  height: 100%;
  margin: 0;
}

#container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

#sidePanel {
  width: 300px;
  min-width: 150px;
  max-width: 600px;
  background: #e7e3d5;
  overflow-y: auto;
  padding: 10px;
  flex-shrink: 0;
}

#sidePanel h5 {
  display: block;
  width: 100%;
  text-align: center;
}

/* Amikor hidden mód van */
#sidePanel.hidden .panel-content {
  display: none !important; /* vagy visibility: hidden; */
}

/* A sidePanel, amikor hidden – fehér háttér + kis szélesség */
#sidePanel.hidden {
  background: #e7e3d5;
  width: 26px !important; /* Vagy amekkora legyen a sáv */
  min-width: 26px !important;
  overflow: visible; /* Hogy gomb + resizer ne legyen elvágva */
}

#resizer {
  width: 12px;
  cursor: col-resize;
  background: #ccc;
  flex-shrink: 0;
}

#resizer:hover {
  background: #999;
}

#map {
  flex: 1;
  height: 100%;
}

.leaflet-draw {
  margin-top: 70px !important;
}

@media (max-width: 768px) {
  #container {
    flex-direction: column;
  }
  #sidePanel {
    width: 100% !important;
    max-width: 100% !important;
    height: 200px;
  }
  #resizer {
    width: 100%;
    height: 8px;
    cursor: row-resize;
  }
  #map {
    flex: 1;
    height: calc(100vh - 200px);
  }
}

.leaflet-control-layers {
  font-size: 16px;
  line-height: 1.5;
  max-height: 80vh;
  border-radius: 8px;
  padding: 8px;
}

@media (max-width: 768px) {
  .leaflet-control-layers {
    font-size: 18px;
    padding: 12px;
  }
  .leaflet-control-layers label {
    padding: 6px 0;
  }
}

.geo-search.open input {
  font-size: 20px;
  height: 1.5em; /* tetszőleges pixel vagy rem érték */
}
/* Modern böngészők placeholder stílusozása*/
.geo-search.open input::placeholder {
  font-size: 16px; /* Betűméret */
  color: gray; /* Szín */
  font-style: italic; /* Opcionális stílus */
}
.geo-search button img {
  position: relative;
  height: 28px;
  width: 28px;
}
.geo-search button {
  background-color: #ead9a2;
}

#itemList {
  background-color: #dcd6ac;
  color: rgb(68, 51, 9);
  padding: 5px;
  border-radius: 5px;
}
#itemList .list-group-item {
  background-color: transparent;
  color: rgb(18, 17, 17);
  border: 2px solid #0056b3;
  margin-bottom: 3px;
}
#itemList .list-group-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

#filterToggle {
  background-color: #a38e67;
  border-color: #a38e67;
  color: white;
}
#filterToggle:hover {
  background-color: #8b7754;
  border-color: #8b7754;
}

#filterBtn {
  font-weight: bold;
  background-color: #d3c19f;
  border-color: #a38e67;
  color: rgb(139 120 65);
}
#filterBtn:hover {
  background-color: #8b7754;
  border-color: #8b7754;
}

#filter_from,
#filter_to,
#filter_utas {
  background-color: #fbf6ed;
}

/* A törlés gomb szélessége legyen két sort gomb szélessége + gap */
#clearFilterBtn {
  width: calc(33px * 2 + 0.25rem); /* 0.25rem = gap-1 */
}
#clearFilterBtn {
  font-weight: bold;
  color: rgb(139 120 65);
  background-color: #c3b08c;
}

@media (max-width: 768px) {
  #filterToggle,
  #filterBtn {
    width: 100%;
    font-size: 1rem;
    padding: 10px 0;
  }
}

/* Touch toolbar
.leaflet-touch .leaflet-control-zoom-display {
  width: 48px;
  height: 48px;
  font-size: 18px;
  line-height: 30px;
}
.leaflet-touch .leaflet-bar a,
.leaflet-touch .leaflet-toolbar-0 > li > a {
  width: 44px;
  height: 44px;
  font-size: 20px;
  line-height: 45px;
  background-size: 314px 30px;
}
.leaflet-touch .leaflet-draw-toolbar.leaflet-bar a {
  background-position-y: 6px;
}
.leaflet-touch .leaflet-draw-actions a,
.leaflet-touch
  .leaflet-control-toolbar
  .leaflet-toolbar-1
  > li
  > .leaflet-toolbar-icon {
  font-size: 20px;
  line-height: 44px;
  height: 44px;
}
.leaflet-touch .leaflet-draw-actions,
.leaflet-touch .leaflet-toolbar-1 {
  left: 45px;
}
*/

.leaflet-bar a,
.leaflet-draw-toolbar a {
  width: 35px !important;
  height: 35px !important;
  line-height: 35px !important;
}
.leaflet-draw-toolbar a {
  background-size: 390px 39px !important; /* 300*1.3 = 390, 30*1.3 = 39 */
  background-repeat: no-repeat;
}
/* Draw toolbar - eredeti pozíciók */
.leaflet-draw-draw-polyline {
  background-position: -21px -2px !important;
}
.leaflet-draw-draw-polygon {
  background-position: -59px -2px !important;
}
.leaflet-draw-draw-rectangle {
  background-position: -99px -2px !important;
}
.leaflet-draw-draw-marker {
  background-position: -177px -2px !important;
}
.leaflet-draw-edit-edit {
  background-position: -293px -2px !important;
  background-color: #827b7b !important;
}
.leaflet-draw-edit-remove {
  background-position: -333px -2px !important;
  background-color: #9d6868 !important;
}

/* Csak az edit ikonokat erősítjük 
.leaflet-draw-edit-edit,
.leaflet-draw-edit-remove {
  background-color: transparent !important;
  filter: brightness(0) grayscale(1) brightness(9);
}
*/

/* Rajzolás tooltip elrejtése */
.leaflet-draw-tooltip {
  display: none !important;
}

#sortDesc {
  background-color: #806e5b;
}
#sortAsc {
  background-color: #806e5b;
}
.sort-btn.active {
  background-color: #36310c !important;
  color: rgb(248, 244, 7);
}
/* Feltételezzük, hogy a sort gombok kb. 38px szélesek */
.sort-btn {
  width: 33px;
}

/*
.leaflet-draw-toolbar .leaflet-draw-draw-polygon {
  background-image: url(images/downloading.png);
  background-image: no-repeat;
  background-color: #fff;
}
*/

/* =======================================
   BEÚSZÓ – ÖSSZECSUKHATÓ OLDALSÁV (UPDATE)
   toggle gomb mindig a resizer mellett!
   ======================================= */

:root {
  --panel-width: 300px;
  --panel-collapsed: 40px;
  --resizer-width: 12px;
}

/* Oldalsáv */
#sidePanel {
  position: relative;
  width: var(--panel-width);
  transform: translateX(0);
  transition: transform 0.35s ease, width 0.35s ease;
  z-index: 500;
}

/* Collapsed mód */
#sidePanel.collapsed {
  width: var(--panel-collapsed) !important;
  min-width: var(--panel-collapsed) !important;
  max-width: var(--panel-collapsed) !important;
  overflow: hidden;
}

/* =======================================
     Toggle gomb – mindig a resizer mellett!
     ======================================= */
#sideToggleBtn {
  position: absolute;
  top: 5px;
  right: 12px; /* resizer szélesség + kis hézag = pl. 12px */
  width: 26px;
  height: 40px;
  background: #c0a879;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  z-index: 2000;
  transition: transform 0.35s ease;
  user-select: none;
}

/* Collapsed: új pozíció */
#sidePanel.collapsed ~ #sideToggleBtn {
  left: calc(var(--panel-collapsed) + var(--resizer-width));
}

#sidePanel.collapsed ~ #sideToggleBtn i {
  transform: rotate(180deg);
}

/* Hidden: ugyanez */
#sidePanel.hidden ~ #sideToggleBtn {
  left: calc(var(--panel-collapsed) + var(--resizer-width));
}

#sidePanel.hidden ~ #sideToggleBtn i {
  transform: rotate(180deg);
}

/* MAP eltolás */
#map {
  transition: margin-left 0.35s ease;
}

.merge-btn {
  position: absolute;
  top: 15px;
  left: 10px;
  z-index: 1000;
  background-color: #808080; /* szürke */
  color: white;
  border: none;
  padding: 5px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-weight: bold;
}

.merge-btn.active {
  background-color: #a71d2a;
}



/* Térképre görgethető oldalsáv, ha nem fér el a képernyőn */
@media (max-width: 768px) {
  #map {
    flex: 1;
    height: calc(100vh - 200px);
    overflow-x: auto; /* vízszintes görgetés engedélyezése */
    overflow-y: hidden; /* függőleges görgetés kikapcsolása, ha nem szükséges */
    -webkit-overflow-scrolling: touch; /* sima görgetés iOS-en */
  }
}

@media (max-width: 768px) {
  #map > .leaflet-container {
    min-width: 500px; /* például a teljes térkép szélessége, ami scrollozható lesz */
  }
}
