:root {
  --layout-max-width: 100%;
  --filter-max-width: 850px;
  --page-gutter: 20px;
  --btn-hover-bg: #cfcfcf;
  --btn-active-bg: #757575;
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  font-family: "Outfit", sans-serif;
  font-size: 0.875rem;
  color: #888;
  letter-spacing: 0.02em;
}

#loading.hidden {
  display: none;
}

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fafafa;
  font-family: "Outfit", sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fafafa;
}

#filter-panel {
  flex: 0 0 auto;
  width: 100%;
  max-width: var(--filter-max-width);
  padding: 8px var(--page-gutter) 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

#filter {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 8px 20px;
  border-radius: 30px;
  outline: 1px solid #cccccc;
  outline-offset: -1px;
  background: #fafafa;
}

.filter-group-btn,
.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 8px 16px;
  border: none;
  border-radius: 30px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.filter-group-btn::before,
.filter-chip::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--btn-hover-bg);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.28s ease;
  z-index: -1;
}

.filter-group-btn-label,
.filter-group-btn > *,
.filter-chip > * {
  position: relative;
  z-index: 1;
}

.filter-group-btn {
  color: #616161;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.18px;
  text-align: center;
  width: 220px;
  white-space: nowrap;
}

.filter-group-btn-label {
  color: #616161;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.18px;
  text-align: center;
  white-space: nowrap;
  transition: color 0.16s ease;
}

.filter-group-btn.is-active,
.filter-chip.is-active {
  color: #ffffff;
  outline: 1px solid #e8e8e8;
  outline-offset: -1px;
}

.filter-group-btn.is-active .filter-group-btn-label,
.filter-chip.is-active .filter-chip-label {
  color: #ffffff;
}

.filter-group-btn:active,
.filter-chip:active,
.reset-filter:active {
  color: #ffffff;
}

.filter-group-btn:active .filter-group-btn-label,
.filter-chip:active .filter-chip-label {
  color: #ffffff;
}

.filter-group-btn.is-active::before,
.filter-chip.is-active::before {
  background: var(--btn-active-bg);
  transform: scaleX(1);
}

.filter-group-btn:hover:not(.is-active)::before,
.filter-chip:hover:not(.is-active)::before {
  transform: scaleX(1);
}

.filter-group-btn:active:not(.is-active)::before,
.filter-chip:active:not(.is-active)::before {
  background: var(--btn-active-bg);
  transform: scaleX(1);
  transition-duration: 0.16s;
}

.filter-chip-dot {
  width: 13px;
  height: 13px;
  border-radius: 9999px;
  flex-shrink: 0;
}

.filter-chip-label {
  color: #616161;
  font-size: 16px;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
  transition: color 0.16s ease;
}

.reset-filter {
  margin: 20px 0 0;
  padding: 6px 10px;
  border: none;
  border-radius: 100px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: #616161;
  transition: color 0.16s ease;
}

.reset-filter::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--btn-hover-bg);
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.28s ease;
  z-index: -1;
}

.reset-filter > * {
  position: relative;
  z-index: 1;
}

.reset-filter.is-active {
  color: #ffffff;
  outline: 1px solid #e8e8e8;
  outline-offset: -1px;
}

.reset-filter.is-active::before {
  background: var(--btn-active-bg);
  transform: scaleX(1);
}

.reset-filter:hover:not(.is-active)::before {
  transform: scaleX(1);
}

.reset-filter:active:not(.is-active)::before {
  background: var(--btn-active-bg);
  transform: scaleX(1);
  transition-duration: 0.16s;
}

.reset-filter-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
  background-color: currentColor;
  mask: url("imgs/autorenew.svg") center / contain no-repeat;
  -webkit-mask: url("imgs/autorenew.svg") center / contain no-repeat;
}

.reset-filter-label {
  color: inherit;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.18px;
  white-space: nowrap;
}

#main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: var(--layout-max-width);
  padding: 0 var(--page-gutter) 4px;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  background: #fafafa;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font-family: "Outfit", sans-serif;
  background: #fafafa;
}

.leaflet-popup-content-wrapper {
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.leaflet-popup-content {
  margin: 8px 12px;
  font-size: 13px;
  color: #333;
  line-height: 1.4;
}

.popup-category,
.popup-postal {
  color: #666;
  font-size: 12px;
}

.popup-missing {
  color: #aaa;
  font-size: 12px;
  font-style: italic;
}

@media (min-width: 901px) {
  .filter-row {
    flex-wrap: nowrap;
    padding: 6px 16px;
    gap: 12px;
  }

  .filter-group-btn,
  .filter-chip {
    padding: 6px 14px;
  }

  .filter-group-btn {
    width: 200px;
  }
}

@media (max-width: 900px) {
  .filter-group-btn {
    width: 100%;
  }

  .filter-chip-label {
    white-space: normal;
  }
}

@media (max-width: 480px) {
  :root {
    --page-gutter: 12px;
  }

  #filter {
    gap: 8px;
  }

  .filter-row {
    padding: 8px 12px;
    gap: 10px;
  }

  .filter-group-btn,
  .filter-chip {
    padding: 6px 12px;
  }

  .filter-group-btn {
    width: 100%;
    min-width: 0;
  }

  .filter-chip-label,
  .filter-group-btn-label,
  .reset-filter-label {
    font-size: 14px;
  }
}

@media (max-height: 700px) {
  #filter-panel {
    padding-top: 8px;
  }

  #filter {
    gap: 8px;
  }

  .filter-row {
    padding: 6px 12px;
  }

  .filter-group-btn,
  .filter-chip {
    padding: 6px 12px;
  }

  .filter-group-btn {
    width: 100%;
    min-width: 0;
  }

  .filter-chip-label,
  .filter-group-btn-label,
  .reset-filter-label {
    font-size: 13px;
  }
}
