.zfsm {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  align-items: stretch;
  padding-left: 12px;
  padding-right: 12px;
}

.zfsm__list {
  max-height: 78vh;
  overflow-y: auto;
  padding-right: 6px;
}

.zfsm-controls {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.zfsm-controls__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.zfsm-controls__input {
  width: 100%;
  border: 1px solid #d7d7d7;
  border-radius: 6px;
  height: 40px;
  padding: 0 10px;
  font-size: 0.92rem;
  box-sizing: border-box;
}

.zfsm-controls__button {
  border: 1px solid #d89216;
  background: #d89216;
  color: #fff;
  border-radius: 6px;
  height: 40px;
  padding: 0 12px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.zfsm-controls__button--ghost {
  margin-top: 8px;
  width: 100%;
  background: #fff;
  color: #d89216;
}

.zfsm-controls__status {
  display: none;
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #555;
}

.zfsm-controls__status:not(:empty) {
  display: block;
}

#zfsm-cards {
  display: block;
}

.zfsm__map-wrap {
  min-height: 78vh;
}

.zfsm__map {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border-radius: 8px;
  overflow: hidden;
}

.zfsm-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.zfsm-card:hover,
.zfsm-card:focus-visible,
.zfsm-card.is-active {
  border-color: #d89216;
  box-shadow: 0 0 0 2px rgba(216, 146, 22, 0.15);
  outline: none;
}

.zfsm-card__media {
  width: 100px;
  height: 100px;
  overflow: hidden;
  border-radius: 6px;
}

.zfsm-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.zfsm-card__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.2;
  color: #d89216;
}

.zfsm-card__distance {
  display: inline-block;
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: #555;
  background: #f8f8f8;
  border-radius: 999px;
  padding: 2px 8px;
}

.zfsm-card__line {
  margin: 0 0 6px;
  font-size: 0.92rem;
  line-height: 1.35;
}

.zfsm-card__link {
  font-weight: 600;
  text-decoration: underline;
}

.zfsm-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d89216;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(216, 146, 22, 0.35);
}

/* Popup styling */
.maplibregl-popup-content {
  padding: 8px;
  border-radius: 8px;
}

.zfsm-popup-card {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 10px;
  min-width: 250px;
}

.zfsm-popup-card__media {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
}

.zfsm-popup-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zfsm-popup-card__title {
  margin: 0 0 4px;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #d89216;
}

.zfsm-popup-card__line {
  margin: 0 0 4px;
  font-size: 0.86rem;
  line-height: 1.3;
}

@media (min-width: 1024px) {
  .zfsm {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 980px) {
  .zfsm {
    grid-template-columns: 1fr;
    padding-left: 10px;
    padding-right: 10px;
  }

  .zfsm__list {
    max-height: 42vh;
    order: 1;
    padding-right: 0;
  }

  .zfsm-controls__row {
    grid-template-columns: 1fr;
  }

  .zfsm__map-wrap {
    order: 2;
    min-height: 52vh;
  }
}
