/* Issues #59/#60: the shared TripMap component (Components/Shared/TripMap) and the pages around it.
   Width/margins come from the context class (.sights-map, .planner-map, .trip-map-page-map). */

.trip-map {
  height: min(70vh, 32rem);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #e9eef3;
}

.trip-map-hint {
  color: #6c7580;
  font-size: 0.9rem;
}

.trip-map-popup {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.trip-map-popup a {
  color: rgb(5, 39, 103);
  font-weight: 600;
}

.trip-map-popup-detail {
  color: #6c7580;
}

/* Numbered pin for a day's plan. Built by tripMap.js; the number is set with textContent. */
.trip-map-number-pin {
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  border: 2px solid white;
  background: rgb(5, 39, 103);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

/* ── Trip map page ── */
.trip-map-page-toolbar,
.trip-map-page-map,
.trip-map-legend,
.trip-map-page-map + .sights-map-hint,
.trip-map-legend + .sights-map-hint {
  margin: 0 auto 1rem;
  max-width: 70rem;
  width: calc(100% - 2.5rem);
}

.trip-map-page-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.trip-map-page-toolbar select {
  max-width: 20rem;
}

.trip-map.trip-map-page-map {
  height: min(72vh, 40rem);
}

.trip-map-legend {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.trip-map-legend li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.trip-map-legend-number {
  flex: 0 0 auto;
  min-width: 1.6rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgb(5, 39, 103);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
}

.trip-map-legend-title {
  font-weight: 600;
}

.trip-map-legend-detail {
  color: #6c7580;
  font-size: 0.85rem;
}

/* ── DayPlanner day map ── */
.planner-day-map-btn {
  margin-left: auto;
  margin-right: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 999px;
}

.planner-day-map-btn:hover,
.planner-day-map-btn:focus-visible {
  background: #fff;
  color: #343a40;
}

.planner-modal.planner-map-modal {
  max-width: 56rem;
  width: 94%;
}

.planner-map-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 12px;
}

.planner-map-modal-header h3 {
  margin: 0;
}

.trip-map.planner-map {
  height: min(65vh, 34rem);
}

.planner-map-unpinned {
  margin: 0.6rem 0 0;
  color: #6c7580;
  font-size: 0.85rem;
}

/* ── Offline map panel (issue #61) ── */
.offline-map-panel {
  margin: 0 auto 1.5rem;
  max-width: 70rem;
  width: calc(100% - 2.5rem);
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.offline-map-panel-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: rgb(5, 39, 103);
}

.offline-map-panel-text {
  margin: 0 0 0.6rem;
}

.offline-map-panel-ok {
  color: #1e7a3c;
  font-weight: 600;
}

.offline-map-panel-hint {
  margin: 0.5rem 0 0;
  color: #6c7580;
  font-size: 0.85rem;
}

.offline-map-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.offline-map-download-btn {
  font-weight: 600;
}

.offline-map-progress {
  height: 0.6rem;
  margin-bottom: 0.5rem;
  border-radius: 999px;
  background: #e3e8ef;
  overflow: hidden;
}

.offline-map-progress-bar {
  height: 100%;
  background: rgb(5, 39, 103);
  transition: width 0.3s;
}

/* .btn-edit is a fixed 5rem, no-wrap button sized for "Edit"; the map's longer labels ("Save map
   offline (175 MB)", "Delete from device", "Remove pin") overflowed it. Size to the text instead,
   and allow wrapping on narrow phones. */
.offline-map-panel-actions .btn-edit,
.sights-map-placing-actions .btn-edit {
  width: auto;
  max-width: 100%;
  white-space: normal;
  padding: 0.4rem 0.9rem;
  text-align: center;
}
