@font-face {
  font-family: 'eurostile_roman';
  src: url('fonts/eurostile_roman.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: 'eurostile_roman', sans-serif;
  font-size: 14px;
  color: #ffffff;
}

/* === Сетка 3x3 === */
#layoutGrid {
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  grid-template-rows: 50px 1fr 50px;
  height: 100vh;
  width: 100vw;
  background: url("img/map/background.webp") no-repeat center center;
  background-size: cover;
}

.grid-cell {
  position: relative;
}

.grid-cell.top-left {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_ltl.png");
  background-repeat: no-repeat;
  background-size: 50px 50px;
}
.grid-cell.top {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_l.png");
  background-position: bottom left;
  background-repeat: repeat-x;
  background-size: 1px auto;
}
.grid-cell.top-right {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_ltr.png");
  background-repeat: no-repeat;
  background-size: 50px 50px;
}
.grid-cell.left {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_l.png");
  background-position: bottom right;
  background-repeat: repeat-y;
  background-size: 1px auto;
}
.grid-cell.center {
  position: relative;
  background: rgba(0, 0, 0, 0.8);
  background-image:
    url("img/ui/pda_ctl.png"),
    url("img/ui/pda_ctr.png"),
    url("img/ui/pda_cbl.png"),
    url("img/ui/pda_cbr.png");
  background-position:
    top left,
    top right,
    bottom left,
    bottom right;
  background-repeat: no-repeat;
  background-size: 50px 50px;
}
.grid-cell.right {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_l.png");
  background-position: bottom left;
  background-repeat: repeat-y;
  background-size: 1px auto;
}
.grid-cell.bottom-left {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_lbl.png");
  background-repeat: no-repeat;
  background-size: 50px 50px;
}
.grid-cell.bottom {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_l.png");
  background-position: top left;
  background-repeat: repeat-x;
  background-size: 1px auto;
}
.grid-cell.bottom-right {
  position: relative;
  background: rgba(0, 0, 0, 0);
  background-image: url("img/ui/pda_lbr.png");
  background-repeat: no-repeat;
  background-size: 50px 50px;
}

#mapContainer {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
}

#map {
  width: 100%;
  height: 100%;
  border-radius: 0px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(10px);
}

/* === Сайдбар === */
#sidebar {
  position: absolute;
  top: 20px;
  left: 20px;
  bottom: 20px;
  width: 280px;
  background: #0e0e0e;
  background-image:
    url("img/ui/map_ctl.png"),
    url("img/ui/map_ctr.png"),
    url("img/ui/map_cbl.png"),
    url("img/ui/map_cbr.png"),
    url("img/ui/pda_l.png"),
    url("img/ui/pda_l.png");
  background-position:
    top left,
    top right,
    bottom left,
    bottom right,
    top left,
    top right;
  background-repeat: 
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    repeat-y,
    repeat-y;
  background-size: 
    auto,
    auto,
    auto,
    auto,
    1px auto,  
    1px auto;
  border-radius: 0px;
  overflow-y: auto;
  z-index: 1000;
  padding: 10px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#sidebar.collapsed {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

#sidebarToggleWrapper {
  position: absolute;
  top: 20px;
  left: calc(280px + 30px);
  z-index: 1001;
  transition: left 0.3s ease;
}

#toggleSidebar {
  background-color: transparent;
  background-repeat: no-repeat;
  border: none;
  padding: 0;
  cursor: pointer;
}

#toggleSidebar.hide-icon {
  width: 175px;
  height: 25px;
  background-image: url("img/ui/button_HideSB.png");
}

#toggleSidebar.show-icon {
  width: 175px;
  height: 25px;
  background-image: url("img/ui/button_ShowSB.png");
}

#toggleSidebar:hover {
  filter: brightness(1.2);
}

/* === Категории и группы === */
.category-block {
  margin-bottom: 16px;
}

.category-header {
  font-size: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: normal;
  margin-bottom: 8px;
}

.btn-mini {
  width: 15px;
  height: 15px;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: none;
  padding: 0;
  margin-left: 4px;
  cursor: pointer;
}

.btn-mini.plus {
  background-image: url("img/ui/button_ShowAllMarkers.png");
}

.btn-mini.minus {
  background-image: url("img/ui/button_HideAllMarkers.png");
}

.btn-mini:hover {
  filter: brightness(1.2);
}

.marker-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.marker-icon {
  width: 36px;
  height: 36px;
  font-size: 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #e0e0e0;
  transition: background 0.2s;
}

.marker-icon:hover {
  background: #d0d0d0;
}

.marker-icon.inactive {
  opacity: 0.3;
}

.marker-group-separator {
  border: none;
  border-top: 1px solid #ccc;
  margin: 6px 8px;
}

/* === Рамка карты === */
.leaflet-image-layer {
  image-rendering: pixelated;
}

.frame-icon {
  image-rendering: pixelated;
  pointer-events: none;
}

/* === Кастомные подсказки для кнопок === */
.tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.5);
  background-image:
    url("img/ui/boreder_ctl.png"),
    url("img/ui/boreder_ctr.png"),
    url("img/ui/boreder_cbl.png"),
    url("img/ui/boreder_cbr.png"),
    url("img/ui/pda_l.png"),
    url("img/ui/pda_l.png"),
    url("img/ui/pda_l.png"),
    url("img/ui/pda_l.png");
  background-position:
    top left,
    top right,
    bottom left,
    bottom right,
    top left,
    top right,
    top left,
    bottom left;
  background-repeat: 
    no-repeat,
    no-repeat,
    no-repeat,
    no-repeat,
    repeat-y,
    repeat-y,
    repeat-x,
    repeat-x;
  background-size: 
    auto,
    auto,
    auto,
    auto,
    1px auto,  
    1px auto;
  color: #fff;
  padding: 4px 8px;
  border-radius: 0px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 99999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* === Кастомные кнопки управления === */
#customControls {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  z-index: 1001;
}

.zoom-btn {
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: filter 0.2s ease;
}

.zoom-btn:hover {
  filter: brightness(1.2);
}

/* Конкретные иконки */
.btn-zoom-in {
  width: 135px;
  height: 25px;
  background-image: url("img/ui/button_ZoomIn.png");
}

.btn-zoom-out {
  width: 115px;
  height: 25px;
  background-image: url("img/ui/button_ZoomOut.png");
}

.btn-fullscreen {
  width: 225px;
  height: 25px;
  background-image: url("img/ui/button_FullscreenOn.png");
}

.btn-exit-fullscreen {
  width: 225px;
  height: 25px;
  background-image: url("img/ui/button_FullscreenOff.png");
}

.btn-back {
  width: 200px;
  height: 25px;
  background-image: url("img/ui/button_BackToGlobal.png");
}

/* === Leaflet === */
.leaflet-control-attribution {
    display: none;
}