* {
  box-sizing: border-box;
}

:root {
  --app-bar-height: calc(85px + env(safe-area-inset-top, 0px));
}

body {
  margin: 0;
  padding: 0;
  font: 14px Arial, sans-serif;
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #e8efe8;
}

/* Верхняя панель */
#top-bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--app-bar-height);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);

  display: flex;
  align-items: center;

  background-color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);

  z-index: 10;
}

/* Логотип */
#logo-container {
  width: 240px;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  flex-shrink: 0;
}

#tpu-logo {
  max-width: 190px;
  max-height: 60px;
  object-fit: contain;
}

h2 {
  margin: 0 0 4px;
  /*отсупы сверху, справа/слева, снизу*/
  font-size: 18px;
}

/* Поиск */
#search-container {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-right: 240px;
  z-index: 20000;
}

.search {
  display: flex;
  /* все дочерние элементы выстраваются в строку*/
  align-items: center;
  width: 100%;
  max-width: 550px;
  gap: 10px;
}

#building-search {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 15px;

  border: 1px solid #cccccc;
  border-radius: 6px;

  font-size: 15px;
  outline: none;
}

#building-search:focus-visible {
  border-color: #0e9243;
  outline: 2px solid #0e9243;
  outline-offset: 1px;
}

#search-button {
  height: 42px;
  padding: 0 25px;

  border: none;
  border-radius: 6px;

  background-color:#0E9243;
  color: white;

  font-size: 15px;
  cursor: pointer;
}

#search-button:hover {
  background-color: #28be46;
}


.app-feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 550px;
  min-height: 18px;
}

#search-message {
  margin: 0;
  font-size: 12px;
}

#install-app {
  min-height: 32px;
  padding: 3px 10px;
  border: 1px solid #b4dac0;
  border-radius: 6px;
  background: #edf8f0;
  color: #13592b;
  font: inherit;
  cursor: pointer;
}

.error-message {
  color: red;
}

p {
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* Элементы управления картой */
.maplibregl-ctrl-top-right {
  top: calc(var(--app-bar-height) + 5px);
  right: env(safe-area-inset-right, 0px);
}

.maplibregl-ctrl-bottom-right {
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
}

#map-status {
  position: absolute;
  z-index: 2;
  top: calc(var(--app-bar-height) + 12px);
  left: calc(12px + env(safe-area-inset-left, 0px));
  max-width: min(34ch, calc(100% - 88px));
  margin: 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: #263f2c;
  pointer-events: none;
}

@media (max-width: 700px) {
  #logo-container {
    width: min(22vw, 115px);
    padding: 0 8px;
  }

  #tpu-logo {
    max-width: 100%;
  }

  #search-container {
    padding-right: 10px;
  }

  #building-search,
  #search-button {
    height: 44px;
    padding-inline: 10px;
  }

  #building-search {
    font-size: 16px;
  }
}
