/* Tours map view: list/map toggle, map panel, pins, clusters and popups.
   Loaded by app/views/tours/list.php; Leaflet assets load only in map view. */

.tours-view {
  max-width: 1200px;
  margin: 18px auto 0;
  padding: 0 20px;
}

.tours-view__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tours-view__count {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.tours-view__count strong {
  color: var(--text);
}

.tours-view__count-split {
  padding: 0 3px;
  opacity: 0.45;
}

.tours-view__toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(15, 27, 45, 0.1);
  border-radius: 999px;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(15, 27, 45, 0.05);
}

.tours-view__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.tours-view__btn svg {
  width: 17px;
  height: 17px;
}

.tours-view__btn:hover {
  color: var(--text);
}

.tours-view__btn.is-active {
  background: var(--accent-2);
  color: #fff;
}

.tours-view__btn:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.tours-view__note,
.tours-view__empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.tours-view__empty {
  padding: 18px;
  border: 1px dashed rgba(15, 27, 45, 0.16);
  border-radius: 14px;
  background: var(--card);
}

/* Map panel ---------------------------------------------------------- */

.tours-map {
  position: relative;
  isolation: isolate; /* keeps Leaflet's pane z-indexes below the site header */
  margin-top: 14px;
  border: 1px solid rgba(15, 27, 45, 0.1);
  border-radius: 18px;
  overflow: hidden;
  background: var(--card);
  box-shadow: 0 6px 24px rgba(15, 27, 45, 0.08);
}

.tours-map__canvas {
  height: 560px;
  width: 100%;
}

.tours-map__canvas.leaflet-container {
  font: inherit;
  background: #eef2f6;
}

.tours-map__fit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 500;
  padding: 8px 14px;
  border: 1px solid rgba(15, 27, 45, 0.12);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(15, 27, 45, 0.14);
}

.tours-map__fit:hover {
  background: #fff;
}

.tours-map__fit:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Pins and clusters --------------------------------------------------- */

.tours-map__pin-wrap {
  background: none;
  border: 0;
}

.tours-map__pin {
  display: block;
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(15, 27, 45, 0.35));
}

.tours-map__pin svg {
  width: 28px;
  height: 28px;
  fill: var(--accent-2);
}

.tours-map__pin svg circle {
  fill: #fff;
}

.tours-map__pin--featured svg {
  fill: #dd9b1f;
}

.tours-map__cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: rgba(31, 102, 179, 0.92);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(15, 27, 45, 0.28);
}

.tours-map__cluster--md {
  width: 48px;
  height: 48px;
  font-size: 0.9rem;
}

.tours-map__cluster--lg {
  width: 56px;
  height: 56px;
  background: rgba(16, 68, 124, 0.95);
  font-size: 0.95rem;
}

/* Popups -------------------------------------------------------------- */

.tours-map__popup-shell .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 27, 45, 0.22);
}

.tours-map__popup-shell .leaflet-popup-content {
  margin: 0;
}

/* Fixed width so the card keeps its shape when a cover image is missing and
   removes itself. Leaflet sizes the popup from this. */
.tours-map__popup {
  display: block;
  width: 240px;
  color: var(--text);
  text-decoration: none;
}

/* The global a:hover underline outranks a plain class rule. */
.tours-map__popup:hover,
.tours-map__popup:focus {
  text-decoration: none;
}

.tours-map__popup-img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  background: #e7edf3;
}

.tours-map__popup-holder {
  display: block;
  min-width: 160px;
}

.tours-map__popup-loading {
  display: block;
  padding: 16px 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

.tours-map__popup-body {
  display: block;
  padding: 12px 14px 14px;
}

.tours-map__popup-title {
  display: block;
  font-size: 0.98rem;
  line-height: 1.3;
}

.tours-map__popup-meta {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.83rem;
}

.tours-map__popup-cta {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 700;
}

.tours-map__popup:hover .tours-map__popup-cta {
  text-decoration: underline;
}

@media (max-width: 720px) {
  .tours-view__bar {
    justify-content: flex-start;
  }

  .tours-map__canvas {
    height: 420px;
  }
}

/* Viewport loading, cap hint and the touch veil ------------------------ */

.tours-map__canvas.is-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 600;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent);
  animation: tours-map-progress 1s linear infinite;
}

@keyframes tours-map-progress {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .tours-map__canvas.is-loading::after {
    animation: none;
    opacity: 0.6;
  }
}

.tours-map__hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  z-index: 500;
  margin: 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 27, 45, 0.82);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

/* One finger scrolls the page until the visitor opts into the map. */
.map-veil {
  position: absolute;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(15, 27, 45, 0.28);
  color: #fff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
}

/* Numbered itinerary stops on the tour detail map ---------------------- */

.tours-map__stop {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  background: var(--accent-2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(15, 27, 45, 0.3);
}

.tours-map__stop-popup {
  display: block;
  padding: 10px 12px;
  font-size: 0.9rem;
}

.tours-map__stop-popup strong {
  display: block;
}

.tours-map__stop-popup span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.83rem;
}

/* Tour detail and destination hub panels ------------------------------- */

.tour-map-panel {
  position: relative;
  isolation: isolate;
  margin-top: 14px;
  border: 1px solid rgba(15, 27, 45, 0.1);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
}

.tour-map-panel .tours-map__canvas {
  height: 340px;
}

@media (max-width: 720px) {
  .tour-map-panel .tours-map__canvas {
    height: 260px;
  }
}
