html,
body {
  height: 100%;
  margin: 0;
  font-family: "Arial Narrow", "Roboto Condensed", "Arial", sans-serif;
  color: #f5f7fa;
  background: #050607;
  letter-spacing: 0.04em;
}

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(93, 207, 255, 0.12), transparent 26%),
    radial-gradient(circle at 90% 80%, rgba(255, 72, 164, 0.10), transparent 28%),
    linear-gradient(135deg, #050607 0%, #101318 45%, #050607 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.10) 1px, transparent 1px),
    linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 40%, rgba(255, 255, 255, 0.03));
  background-size: 12px 12px, 100% 100%;
  opacity: 0.28;
  mix-blend-mode: screen;
}

body::after {
  content: "WEBGIS";
  position: fixed;
  right: 16px;
  bottom: -18px;
  z-index: 0;
  font-size: 112px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.045);
  pointer-events: none;
}

#topNav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 2200;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  box-sizing: border-box;
  background: rgba(5, 6, 7, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

.nav-brand {
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-brand::before {
  content: "";
  display: inline-block;
  width: 34px;
  height: 11px;
  margin-right: 10px;
  background: #5dcfff;
  vertical-align: -1px;
}

.nav-spacer {
  flex: 1;
}

.nav-auth {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.nav-auth button {
  width: auto;
  min-width: 86px;
  margin: 0;
  padding: 9px 12px;
  font-size: 11px;
}

#authStatus {
  color: #b8c1cc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

#reviewBtn {
  background: #ff4aa2;
  color: #ffffff;
}

#logoutBtn {
  background: #2b3038;
  color: #ffffff;
}

#topHelpChatBtn {
  order: 99;
  width: auto;
  min-width: 130px;
  margin: 0 0 0 4px !important;
  padding: 9px 12px;
  font-size: 11px;
  background: #d75cff;
  color: #ffffff;
}

#app {
  position: relative;
  z-index: 1;
  height: calc(100% - 58px);
  padding-top: 58px;
  display: flex;
}

#sidebar {
  display: flex;
  flex-direction: column;
  width: 360px;
  min-width: 360px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(14, 17, 22, 0.96), rgba(4, 5, 7, 0.98)),
    radial-gradient(circle at 0% 0%, rgba(93, 207, 255, 0.12), transparent 30%);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.42);
  z-index: 1000;
}

#sidebar::-webkit-scrollbar {
  width: 8px;
}

#sidebar::-webkit-scrollbar-track {
  background: #0b0e12;
}

#sidebar::-webkit-scrollbar-thumb {
  background: #5dcfff;
}

#sidebarSourceNote {
  margin-top: auto;
  padding: 10px 22px 16px 22px;
  color: #9ca8b6;
  font-size: 11px;
  letter-spacing: 0.05em;
}

#map {
  flex: 1;
  height: calc(100vh - 58px);
  background: #090b0f;
  filter: saturate(1.05) contrast(1.02);
}

.dark-osm {
  filter: grayscale(1) invert(1) brightness(0.76) contrast(1.12) saturate(0.35);
}

.app-header {
  padding: 28px 24px 22px 24px;
  background:
    linear-gradient(135deg, rgba(93, 207, 255, 0.16), rgba(255, 255, 255, 0.02)),
    #080a0e;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.app-header h1 {
  font-size: 25px;
  line-height: 1.1;
  margin: 0 0 12px 0;
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.app-header h1::before {
  content: "";
  display: inline-block;
  width: 42px;
  height: 14px;
  margin-right: 10px;
  background: #5dcfff;
  vertical-align: -1px;
}

.app-header p {
  margin: 0;
  line-height: 1.55;
  font-size: 12px;
  color: #b8c1cc;
  letter-spacing: 0.05em;
}

.panel {
  margin: 18px 22px;
  padding: 17px;
  background: rgba(12, 15, 20, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 4px solid #5dcfff;
  border-radius: 0;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.24);
}

.panel:nth-of-type(2) {
  border-left-color: #b5ff61;
}

.panel:nth-of-type(3) {
  border-left-color: #ff9b35;
}

.panel:nth-of-type(4) {
  border-left-color: #d75cff;
}

.panel h2 {
  font-size: 15px;
  margin: 0 0 14px 0;
  color: #ffffff;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.panel h2::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  margin-top: 10px;
  background: linear-gradient(90deg, rgba(93, 207, 255, 0.75), rgba(255, 255, 255, 0.12), transparent);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin: 11px 0 6px 0;
  color: #d9e1ea;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 0;
  font-size: 13px;
  color: #ffffff;
  background: rgba(3, 5, 8, 0.84);
  outline: none;
  letter-spacing: 0.04em;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #5dcfff;
  box-shadow: 0 0 0 2px rgba(93, 207, 255, 0.14);
}

input::placeholder,
textarea::placeholder {
  color: #6f7a86;
}

select option {
  background: #080a0e;
  color: #ffffff;
}

textarea {
  resize: vertical;
}

button {
  width: 100%;
  padding: 11px 12px;
  margin-top: 10px;
  border: none;
  border-radius: 0;
  background: #5dcfff;
  color: #031017;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, background 0.12s ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateX(3px);
}

#keywordSearchBtn,
#openRegisterBtn {
  background: #d75cff;
  color: #ffffff;
}

#nearestBtn,
#submitRegisterBtn {
  background: #b5ff61;
  color: #031017;
}

#reportBtn {
  background: #ff9b35;
}

#closureReportBtn,
#submitReportBtn {
  background: #ff4aa2;
  color: #ffffff;
}

#reportBtn.report-active,
#closureReportBtn.report-active {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(255, 155, 53, 0.26);
}

hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  margin: 16px 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  color: #f4f7fb;
}

.checkbox-row input {
  width: auto;
  accent-color: #5dcfff;
}

.small-text {
  font-size: 12px;
  color: #9ca8b6;
  line-height: 1.55;
  letter-spacing: 0.04em;
}

.result-item {
  padding: 12px;
  margin-bottom: 9px;
  border-radius: 0;
  background: rgba(4, 7, 11, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-left: 4px solid #5dcfff;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease, border-color 0.12s ease;
}

.result-item:nth-child(3n) {
  border-left-color: #b5ff61;
}

.result-item:nth-child(3n + 1) {
  border-left-color: #ff9b35;
}

.result-item:hover {
  background: rgba(93, 207, 255, 0.12);
  border-color: rgba(93, 207, 255, 0.45);
  transform: translateX(3px);
}

.result-title {
  font-weight: 900;
  margin-bottom: 5px;
  color: #ffffff;
  letter-spacing: 0.08em;
}

.result-meta {
  font-size: 12px;
  color: #bbc5d1;
  line-height: 1.5;
}

.results-panel {
  position: fixed;
  top: 58px;
  right: 0;
  width: 370px;
  height: calc(100vh - 58px);
  z-index: 1700;
  overflow-y: auto;
  background: #080a0e;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.46);
}

.results-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px 18px;
  background: #080a0e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.results-header h2 {
  margin: 0;
}

#closeResultsBtn,
#closeHelpChatBtn {
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  background: #2b3038;
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}

#results {
  padding: 16px;
}

.layer-legend {
  position: fixed !important;
  left: 370px !important;
  right: auto !important;
  bottom: 62px !important;
  width: 255px !important;
  padding: 15px;
  box-sizing: border-box;
  z-index: 1600 !important;
  background: rgba(8, 10, 14, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 4px solid #5dcfff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.42);
}

.layer-legend h2 {
  margin: 0 0 12px 0;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.legend-row {
  display: grid;
  grid-template-columns: 18px 18px 1fr;
  align-items: center;
  gap: 8px;
  margin: 9px 0;
  color: #f4f7fb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.legend-row input {
  width: 14px;
  height: 14px;
  accent-color: #5dcfff;
}

.legend-symbol {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid #ffffff;
}

.symbol-ground {
  background: #5dcfff;
}

.symbol-centre {
  background: #b5ff61;
}

.symbol-report {
  background: #ff4aa2;
}

.leaflet-control-scale {
  margin-left: 10px !important;
  margin-bottom: 10px !important;
}

.leaflet-control-scale-line {
  margin: 0 !important;
  border-radius: 0 !important;
  background: rgba(8, 10, 14, 0.92) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.leaflet-control-zoom a,
.leaflet-control-layers {
  border-radius: 0 !important;
  background: rgba(8, 10, 14, 0.92) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.leaflet-control-zoom a {
  color: #5dcfff !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #080a0e;
  color: #ffffff;
  border-radius: 0;
  border: 1px solid rgba(93, 207, 255, 0.45);
}

.leaflet-popup-content {
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: 0.04em;
}

.closure-note {
  margin-top: 8px;
  padding: 7px 8px;
  border-left: 4px solid #ff2d55;
  color: #ff4a63;
  background: rgba(255, 45, 85, 0.12);
  font-weight: 900;
}

.popup-action-btn {
  width: auto;
  margin-top: 9px;
  padding: 7px 9px;
  font-size: 11px;
  background: #ff9b35;
  color: #080a0e;
}

.modal {
  position: fixed;
  z-index: 2500;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.hidden {
  display: none !important;
}

.modal-content {
  width: 440px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(18, 22, 29, 0.98), rgba(5, 6, 9, 0.98));
  padding: 22px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-top: 5px solid #ff4aa2;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
}

.auth-modal-content {
  border-top-color: #5dcfff;
}

.modal-header,
.help-chat-header,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header {
  margin-bottom: 14px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  color: #ffffff;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.close-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  margin: 0;
  border-radius: 0;
  font-size: 24px;
  line-height: 1;
  background: #2b3038;
  color: #ffffff;
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.target-box {
  margin: 8px 0 14px 0;
  padding: 10px;
  border-left: 4px solid #ff9b35;
  background: rgba(255, 155, 53, 0.12);
  color: #ffffff;
  font-size: 13px;
  line-height: 1.4;
}

.loading {
  position: fixed;
  top: 76px;
  right: 18px;
  z-index: 2300;
  background: #5dcfff;
  color: #031017;
  padding: 11px 15px;
  border-radius: 0;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

#helpChatBtn {
  display: none !important;
}

.help-chat-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2400;
  width: 370px;
  height: 33vh;
  min-height: 250px;
  max-height: 330px;
  display: flex;
  flex-direction: column;
  background: rgba(8, 10, 14, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 4px solid #d75cff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.58);
}

.help-chat-header {
  padding: 14px 14px 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.help-chat-header h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
}

.help-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.chat-message {
  max-width: 88%;
  padding: 9px 10px;
  margin-bottom: 9px;
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.03em;
}

.bot-message {
  background: rgba(93, 207, 255, 0.13);
  border-left: 3px solid #5dcfff;
  color: #ffffff;
}

.user-message {
  margin-left: auto;
  background: rgba(215, 92, 255, 0.18);
  border-right: 3px solid #d75cff;
  color: #ffffff;
}

.help-chat-input-row {
  display: grid;
  grid-template-columns: 1fr 78px;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

#helpChatInput {
  margin: 0;
}

#sendHelpChatBtn {
  width: auto;
  margin: 0;
  padding: 10px 8px;
  background: #5dcfff;
  color: #031017;
}

.admin-page {
  min-height: 100vh;
  padding: 28px;
  background: #050607;
  color: #ffffff;
}

.admin-header {
  margin-bottom: 24px;
}

.admin-header h1 {
  margin: 0;
  font-size: 28px;
}

.admin-header a {
  color: #5dcfff;
  text-decoration: none;
  font-weight: 900;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: #080a0e;
  color: #ffffff;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 9px;
  vertical-align: top;
}

.admin-table th {
  background: #111827;
  color: #5dcfff;
  text-align: left;
}

.admin-table span {
  color: #9ca8b6;
}

.admin-action-form button {
  width: 100%;
  margin: 3px 0;
  padding: 7px;
  font-size: 11px;
}

@media (max-width: 1027px) {
  #sidebar {
    width: 340px;
    min-width: 340px;
  }

  .layer-legend,
  .leaflet-control-scale {
    left: 362px !important;
  }
}

@media (max-width: 900px) {
  body::after {
    font-size: 70px;
  }

  #topNav {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .nav-auth {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  #app {
    flex-direction: column;
    padding-top: 88px;
    height: calc(100% - 88px);
  }

  #sidebar {
    width: 100%;
    min-width: 0;
    height: 40vh;
  }

  #map {
    height: 60vh;
  }

  .results-panel {
    top: 88px;
    width: 100%;
    height: calc(100vh - 88px);
  }

  .layer-legend {
    left: 18px !important;
    bottom: 105px !important;
    width: 255px !important;
  }
.help-chat-panel {
    width: calc(100% - 36px);
    right: 18px;
    bottom: 18px;
    height: 33vh;
    min-height: 240px;
  }

  .loading {
    top: 106px;
  }
}

.leaflet-control-scale {
  margin-left: 10px !important;
  margin-bottom: 10px !important;
  position: static !important;
}

.leaflet-control-scale-line {
  margin: 0 !important;
  border-radius: 0 !important;
  background: rgba(8, 10, 14, 0.92) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.layer-legend {
  position: fixed !important;
  left: 370px !important;
  right: auto !important;
  bottom: 62px !important;
  width: 255px !important;
}

@media (max-width: 1027px) {
  .layer-legend {
    left: 350px !important;
  }
}

@media (max-width: 900px) {
  .layer-legend {
    left: 18px !important;
    bottom: 62px !important;
    width: 255px !important;
  }

  .leaflet-control-scale {
    margin-left: 10px !important;
    margin-bottom: 10px !important;
    position: static !important;
  }
}

.legend-toggle-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  min-width: 0;
  margin: 0;
  padding: 0;
  z-index: 2;
  background: #5dcfff;
  color: #031017;
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.layer-legend {
  transition: width 0.18s ease, padding 0.18s ease, background 0.18s ease;
  overflow: hidden;
}

.layer-legend .legend-content {
  transition: opacity 0.12s ease;
}

.layer-legend.collapsed {
  width: 46px !important;
  min-width: 46px !important;
  padding: 8px !important;
  border-left-width: 4px;
}

.layer-legend.collapsed .legend-content {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.layer-legend.collapsed .legend-toggle-btn {
  position: static;
  display: block;
  width: 30px;
  height: 30px;
}

.layer-legend {
  height: 154px !important;
  min-height: 154px !important;
  max-height: 154px !important;
  transition: width 0.18s ease, padding 0.18s ease, background 0.18s ease;
  overflow: hidden;
}

.layer-legend.collapsed {
  width: 46px !important;
  min-width: 46px !important;
  height: 154px !important;
  min-height: 154px !important;
  max-height: 154px !important;
  padding: 8px !important;
}

.layer-legend.collapsed .legend-content {
  display: none !important;
}

.layer-legend.collapsed .legend-toggle-btn {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  display: block !important;
  width: 30px !important;
  height: 30px !important;
}
