/* Map panels */
.map-legend {
  position: absolute;
  /* Keep attribution visible (bottom-right) for licensing/compliance. */
  bottom: 44px;
  right: 12px;
  z-index: 800;
  background: var(--wing-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 9px;
  min-width: 180px;
}

.map-legend .lt {
  font-size: 8px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 1px;
}

.map-legend .li {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}

.map-legend .ls {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.map-info {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 800;
  background: var(--wing-glass-dense);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  width: 270px;
}

.map-info .ir {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  padding: 2px 0;
  border-bottom: 1px solid var(--wing-subtle);
}

.map-info .il {
  color: var(--muted);
}

.map-info .iv {
  font-weight: 600;
}

/* ── Ship image gallery ── */
.ship-image-gallery-wrap {
  position: relative;
  margin: 4px 0 6px;
}

.ship-image-gallery {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
}

.ship-image-gallery__thumb {
  flex-shrink: 0;
  width: 76px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: var(--wing-subtle);
  transition: border-color 0.15s;
  scroll-snap-align: start;
}

.ship-image-gallery__thumb:hover {
  border-color: var(--accent);
}

.ship-image-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ship-image-gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 22px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
}

.ship-image-gallery__arrow:hover {
  background: rgba(0, 0, 0, 0.85);
}

.ship-image-gallery__arrow--left { left: 0; }
.ship-image-gallery__arrow--right { right: 0; }

/* ── Ship image modal ── */
.ship-image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.ship-image-modal__content {
  position: relative;
  width: min(92vw, 900px);
  height: min(90vh, 680px);
  display: flex;
  flex-direction: column;
  background: var(--wing-glass-dense);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.ship-image-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--wing-subtle);
}

.ship-image-modal__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.ship-image-modal__counter {
  font-size: 11px;
  color: var(--muted);
}

.ship-image-modal__close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.ship-image-modal__close:hover {
  color: var(--text);
}

.ship-image-modal__body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 8px;
}

.ship-image-modal__img-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.ship-image-modal__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  object-fit: contain;
  transition: opacity 0.2s;
}

.ship-image-modal__spinner {
  position: absolute;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(148, 163, 184, 0.28);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: map-loader-spin 0.7s linear infinite;
}

.ship-image-modal__error {
  font-size: 12px;
  color: var(--muted);
}

.ship-image-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 28px;
  width: 36px;
  height: 48px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 2;
}

.ship-image-modal__nav:hover {
  background: rgba(0, 0, 0, 0.7);
}

.ship-image-modal__nav--prev { left: 8px; }
.ship-image-modal__nav--next { right: 8px; }



.ship-image-modal__footer {
  display: flex;
  gap: 12px;
  padding: 8px 14px;
  font-size: 10px;
  color: var(--muted);
  border-top: 1px solid var(--wing-subtle);
}

.map-loader-overlay {
  position: absolute;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wing-overlay);
  pointer-events: auto;
}

.map-loader-overlay__panel {
  width: min(72vw, 320px);
  background: var(--wing-glass-dense);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.map-loader-overlay__spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(148, 163, 184, 0.28);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: map-loader-spin 0.7s linear infinite;
}

.map-loader-overlay__text {
  font-size: 12px;
  color: var(--text);
  letter-spacing: 0.2px;
}

.map-loader-overlay__bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  position: relative;
}

.map-loader-overlay__fill {
  width: 28%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: map-loader-fill 1.2s ease-in-out infinite;
}

.maplibre-tooltip-popup .maplibregl-popup-content {
  color: #f8fafc !important;
  background: rgba(2, 6, 23, 0.98) !important;
  border: 1px solid rgba(148, 163, 184, 0.4) !important;
  box-shadow: 0 8px 26px rgba(2, 6, 23, 0.55) !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
  padding: 7px 9px !important;
  color: #f8fafc !important;
  min-width: 180px;
}

.maplibre-tooltip-popup .maplibregl-popup-tip {
  border-top-color: rgba(2, 6, 23, 0.97) !important;
}

.maplibre-tooltip-popup__content {
  color: #f8fafc;
  font-family: Pretendard, Inter, ui-sans-serif, -apple-system, Segoe UI, sans-serif;
  font-size: 11px;
  line-height: 1.35;
}

.maplibre-tooltip-popup__content div,
.maplibre-tooltip-popup__content span,
.maplibre-tooltip-popup__content p {
  color: inherit;
}

.maplibre-tooltip-popup__content div {
  word-break: break-word;
}

.maplibre-tooltip-popup .maplibregl-popup-content div,
.maplibre-tooltip-popup .maplibregl-popup-content span,
.maplibre-tooltip-popup .maplibregl-popup-content p {
  color: inherit !important;
}

.maplibre-tooltip-popup .maplibregl-popup-close-button {
  color: #94a3b8 !important;
}

@keyframes map-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes map-loader-fill {
  0% {
    transform: translateX(-40%);
  }

  50% {
    transform: translateX(220%);
  }

  100% {
    transform: translateX(-40%);
  }
}

.maplibregl-ctrl-group {
  border: 1px solid var(--border) !important;
  background: var(--wing-glass) !important;
  backdrop-filter: blur(8px);
}

.maplibregl-ctrl-group button {
  background: transparent !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--border) !important;
}

:root .maplibregl-ctrl-group button span,
[data-theme='dark'] .maplibregl-ctrl-group button span {
  filter: invert(1);
  opacity: 0.9;
}

[data-theme='light'] .maplibregl-ctrl-group button span {
  filter: none;
  opacity: 0.7;
}

.maplibregl-ctrl-attrib {
  font-size: 10px !important;
  background: var(--wing-glass) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px;
}
