/* Saved-map context stays available independently of the filter panel. */
.map-page .saved-mode-card {
  position: absolute;
  z-index: 750;
  top: 94px;
  right: auto;
  left: var(--saved-mode-left, 428px);
  width: var(--saved-mode-width, 390px);
  max-width: 390px;
  padding: 0;
  border: 0;
  border-radius: 13px;
  background: #fff;
  color: #172033;
  box-shadow: 0 0 0 1px #eeebf6, 0 5px 20px rgba(48, 37, 109, .11);
  container-type: inline-size;
}

.map-page .saved-mode-card[hidden],
.map-page .saved-mode-card [hidden],
.map-page.embedded-event-editor .saved-mode-card {
  display: none !important;
}

.map-page .saved-mode-card-content {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 0;
  min-width: 0;
  min-height: 40px;
}

.map-page .saved-mode-card-copy {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
  padding: 0 10px;
}

.map-page .saved-mode-card-copy h2 {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.map-page .saved-mode-card-copy h2 > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-page .saved-mode-card-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #fff1f5;
  color: #e11d48;
}

.map-page .saved-mode-card-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-page .saved-mode-card h2 {
  margin: 0;
  color: #172033;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

.map-page .saved-mode-card .saved-mode-visible-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 0;
  border-radius: 999px;
  background: var(--outlo-brand-soft);
  color: var(--outlo-brand-text);
  box-shadow: none;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.map-page .saved-mode-card .saved-mode-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  align-self: stretch;
  min-width: 0;
  min-height: 40px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  border-radius: 0 13px 13px 0;
  background: var(--outlo-action-fill, linear-gradient(135deg, #7c3aed 0%, #4f46e5 55%, #2563eb 100%)) no-repeat border-box;
  color: #fff;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  transform: none;
  transition: filter .16s ease;
}

.map-page .saved-mode-return-short {
  display: none;
}

.map-page .saved-mode-return svg {
  width: var(--outlo-icon-sm, 16px);
  height: var(--outlo-icon-sm, 16px);
  flex: 0 0 var(--outlo-icon-sm, 16px);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--outlo-icon-stroke, 1.8);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-page .saved-mode-card .saved-mode-return:hover {
  background: var(--outlo-action-hover, linear-gradient(135deg, #6d28d9 0%, #4338ca 56%, #1d4ed8 100%)) no-repeat border-box;
  filter: none;
  color: #fff;
  box-shadow: none;
  transform: none;
}

.map-page .saved-mode-card-empty {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid #eeebf5;
}

.map-page .saved-mode-card-empty p {
  margin: 0;
  color: #77738d;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.map-page .saved-mode-card:has(.saved-mode-card-empty:not([hidden])) .saved-mode-return {
  border-bottom-right-radius: 0;
}

.map-page .saved-mode-card .saved-mode-clear {
  justify-self: start;
  min-height: 32px;
  margin: 0;
  padding: 5px 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--outlo-brand-text);
  box-shadow: none;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  transform: none;
}

.map-page .saved-mode-card .saved-mode-clear:hover {
  color: var(--outlo-brand-text-hover);
  background: transparent;
  transform: none;
}

.map-page .saved-mode-card .saved-mode-clear:focus-visible {
  outline: 3px solid var(--outlo-brand-accent);
  outline-offset: 3px;
}

.map-page .saved-mode-card .saved-mode-retry {
  min-height: 44px;
}

.map-page .saved-mode-card .saved-mode-retry:disabled {
  opacity: .65;
  cursor: wait;
}

.map-page .saved-mode-card .saved-mode-return:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

@container (max-width: 340px) {
  .map-page .saved-mode-card-copy {
    gap: 6px;
    padding-inline: 8px;
  }

  .map-page .saved-mode-return-label,
  .map-page .saved-mode-return svg {
    display: none;
  }

  .map-page .saved-mode-return-short {
    display: inline;
  }
}

@container (max-width: 260px) {
  .map-page .saved-mode-return-short {
    display: none;
  }

  .map-page .saved-mode-return svg {
    display: block;
  }

  .map-page .saved-mode-card .saved-mode-return {
    width: 44px;
    padding: 0;
  }
}

@media (min-width: 1121px) {
  .map-page .map-layout.filter-panel-collapsed .saved-mode-card {
    left: var(--saved-mode-left, 18px);
  }
}

@media (max-width: 1120px) {
  .map-page .saved-mode-card {
    z-index: 900;
    top: var(--saved-mode-top, calc(var(--topbar-height) + 12px));
    right: auto;
    left: var(--saved-mode-left, 12px);
    width: var(--saved-mode-width, calc(100% - 24px));
    max-width: 390px;
    padding: 0;
  }

  .map-page .saved-mode-card-content,
  .map-page .saved-mode-card .saved-mode-return {
    min-height: 44px;
  }

  .map-page .map-layout.is-saved-mode .leaflet-top.leaflet-left,
  .map-page .map-layout.is-saved-mode.detail-open .leaflet-top.leaflet-left {
    top: var(--saved-mode-bottom, calc(var(--topbar-height) + 160px)) !important;
    right: auto !important;
    bottom: auto !important;
    left: 14px !important;
  }


}

@media (pointer: coarse) {
  .map-page .saved-mode-card-content,
  .map-page .saved-mode-card .saved-mode-return {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-page .saved-mode-card .saved-mode-return {
    transition: none;
  }
}
