/* ═══════════════════════════════════════════════════════
   FLOTTEN-MANAGER – Frontend Karte CSS
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@600;700&family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500&display=swap');

.fm-map-wrap {
  --fm-bg:     #0c1d33;
  --fm-sf:     #102238;
  --fm-bd:     rgba(255,255,255,.07);
  --fm-tx:     #d8eaf8;
  --fm-mu:     #4e7295;
  --fm-sk:     #4fa8e0;
  --fm-tl:     #2a9d8f;
  font-family: 'DM Sans', system-ui, sans-serif;
  background:  var(--fm-bg);
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--fm-bd);
  box-shadow: 0 8px 48px rgba(0,0,0,.45),
              0 0 0 1px rgba(255,255,255,.03) inset;
}

/* ── Header ── */
.fm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.2rem; background: var(--fm-sf);
  border-bottom: 1px solid var(--fm-bd);
  gap: .8rem; flex-wrap: wrap; min-height: 56px;
}
.fm-header__l { display: flex; align-items: center; gap: .65rem; }
.fm-header__r { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

.fm-anchor-icon { font-size: 1.3rem; opacity: .65; flex-shrink: 0; }

.fm-map-title {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: .9rem; font-weight: 700;
  color: var(--fm-tx); margin: 0; line-height: 1.25;
}
.fm-map-sub {
  font-size: .6rem; color: var(--fm-mu);
  text-transform: uppercase; letter-spacing: .1em;
  display: block; margin-top: 1px;
}

/* Karten-Switch */
.fm-sw {
  display: flex;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px; overflow: hidden;
}
.fm-sw-btn {
  background: transparent; border: none;
  color: var(--fm-mu); font-family: 'DM Sans', sans-serif;
  font-size: .68rem; font-weight: 500;
  padding: .3rem .7rem; cursor: pointer;
  transition: background .2s, color .2s;
}
.fm-sw-btn + .fm-sw-btn { border-left: 1px solid rgba(255,255,255,.09); }
.fm-sw-btn--on { background: rgba(255,255,255,.11); color: var(--fm-tx); }
.fm-sw-btn:hover:not(.fm-sw-btn--on) { background: rgba(255,255,255,.06); color: #8ab8d8; }

/* Status Dot */
.fm-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #2a3e55; flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.fm-dot--ok {
  background: var(--fm-tl);
  box-shadow: 0 0 0 3px rgba(42,157,143,.2);
  animation: fmPulse 3s ease-in-out infinite;
}
.fm-dot--loading { background: #e9a03a; animation: none; }
.fm-dot--err     { background: #e63946; animation: none; }

@keyframes fmPulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(42,157,143,.2); }
  50%     { box-shadow: 0 0 0 7px rgba(42,157,143,.0); }
}

.fm-ship-count {
  font-family: 'DM Mono', monospace;
  font-size: .72rem; font-weight: 500;
  color: var(--fm-sk); min-width: 50px;
}
.fm-upd-time {
  font-family: 'DM Mono', monospace;
  font-size: .65rem; color: var(--fm-mu);
}

.fm-refresh-btn {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  color: var(--fm-mu); border-radius: 7px;
  width: 28px; height: 28px; font-size: .92rem;
  cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center;
  transition: color .2s, background .2s; flex-shrink: 0;
}
.fm-refresh-btn:hover { color: var(--fm-tx); background: rgba(255,255,255,.1); }
.fm-refresh-btn--spin { animation: fmSpin .75s linear infinite; }
@keyframes fmSpin { to { transform: rotate(360deg); } }

/* ── Leaflet-Karte ── */
.fm-leaflet-map { width: 100%; display: block; z-index: 0; }

.leaflet-control-zoom a {
  background: #102238 !important; color: #8ab8d8 !important;
  border-color: rgba(255,255,255,.1) !important;
}
.leaflet-control-zoom a:hover { background: #1a3a5c !important; }
.leaflet-control-attribution {
  background: rgba(8,16,28,.82) !important;
  color: #2e4a62 !important; font-size: 9px !important;
}
.leaflet-control-attribution a { color: #3a82b0 !important; }

/* ── Popup ── */
.fm-leaflet-popup .leaflet-popup-content-wrapper {
  background: #0f2542;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.55);
  padding: 0;
  overflow: hidden;
}
.fm-leaflet-popup .leaflet-popup-content {
  margin: 0;
  width: 272px !important;
  color: #d8eaf8;
}
.fm-leaflet-popup .leaflet-popup-tip { background: #0f2542; }
.fm-leaflet-popup .leaflet-popup-close-button {
  color: rgba(255,255,255,.4) !important;
  top: 10px !important; right: 10px !important;
  font-size: 18px !important; z-index: 10;
  line-height: 1;
}
.fm-leaflet-popup .leaflet-popup-close-button:hover {
  color: #fff !important;
}

/* Popup Inhalt */
.fm-popup { font-family: 'DM Sans', sans-serif; }

.fm-popup__img {
  width: 100%; height: 120px;
  object-fit: cover; display: block;
}

.fm-popup__body { padding: 1rem 1.1rem 1.1rem; }

/* Name + Badge */
.fm-popup__head {
  display: flex; align-items: center;
  justify-content: space-between;
  gap: .5rem; margin-bottom: .75rem;
}
.fm-popup__name {
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 1rem; font-weight: 700;
  color: #fff; line-height: 1.2;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.fm-popup__badge {
  font-size: .6rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 20px;
  color: #fff; white-space: nowrap; flex-shrink: 0;
}

/* Position + MMSI */
.fm-popup__pos,
.fm-popup__mmsi {
  display: flex; align-items: center; gap: .4rem;
  font-family: 'DM Mono', monospace;
  font-size: .7rem; color: #5a8ab0;
  margin: 0 0 .25rem;
}
.fm-popup__mmsi {
  padding-bottom: .65rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
  margin-bottom: .75rem;
}
.fm-popup__pos-icon { font-size: .8rem; flex-shrink: 0; }

/* Daten-Karten (Fahrt / Kurs) */
.fm-popup__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .8rem;
}
.fm-popup__card {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  padding: .6rem .7rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.fm-popup__card-icon  { font-size: .9rem; line-height: 1; }
.fm-popup__card-label {
  font-size: .6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: #4e7295;
}
.fm-popup__card-val {
  font-family: 'DM Mono', monospace;
  font-size: .95rem; font-weight: 500;
  color: #d8eaf8; line-height: 1;
}

/* Info-Text */
.fm-popup__info {
  font-size: .75rem; color: #5a8ab0;
  font-style: italic;
  margin: 0 0 .75rem; line-height: 1.5;
}

/* Link-Button */
.fm-popup__link {
  display: flex; align-items: center; justify-content: center;
  gap: .45rem; width: 100%;
  background: #1a6eb5;
  color: #fff !important;
  font-size: .8rem; font-weight: 600;
  padding: .6rem 1rem; border-radius: 9px;
  text-decoration: none !important;
  transition: background .2s, transform .15s;
  letter-spacing: .02em;
}
.fm-popup__link:hover {
  background: #4fa8e0;
  transform: translateY(-1px);
  color: #fff !important;
  text-decoration: none !important;
}

/* ── Schiff-Pin Puls-Animation ── */
.fm-ring {
  animation: fmRingPulse 1.8s ease-out infinite;
}
@keyframes fmRingPulse {
  0%   { stroke-width: 2; stroke-opacity: 0.6; r: 7; }
  100% { stroke-width: 1; stroke-opacity: 0;   r: 18; }
}
@keyframes fmPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(255,255,255,.0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,.0); }
}

/* ── Schiffsliste ── */
.fm-ship-bar {
  background: var(--fm-sf);
  border-top: 1px solid var(--fm-bd);
  padding: .65rem 1rem; min-height: 52px;
}
.fm-bar-grid { display: flex; flex-wrap: wrap; gap: .4rem; }
.fm-bar-item-wrap { display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden; }
.fm-bar-item {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.07);
  border-right: none;
  border-left: 3px solid;
  border-radius: 8px 0 0 8px;
  padding: .33rem .7rem .33rem .52rem;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: background .2s, transform .18s;
}
.fm-bar-item-wrap:has(.fm-bar-link) .fm-bar-item { border-radius: 8px 0 0 8px; }
.fm-bar-item-wrap:not(:has(.fm-bar-link)) .fm-bar-item { border-right: 1px solid rgba(255,255,255,.07); border-radius: 8px; }
.fm-bar-item:hover { background: rgba(255,255,255,.08); }
.fm-bar-link {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.07);
  border-left: 1px solid rgba(255,255,255,.12);
  border-radius: 0 8px 8px 0;
  padding: .33rem .55rem;
  font-size: .8rem; text-decoration: none;
  transition: background .2s;
  cursor: pointer;
}
.fm-bar-link:hover { background: rgba(79,168,224,.25); }
.fm-bar-arr  { font-size: .62rem; color: var(--fm-sk); opacity: .85; }
.fm-bar-anc  { font-size: .62rem; opacity: .38; }
.fm-bar-name { font-size: .74rem; font-weight: 600; color: #a8c8e4; }

/* ── Fehler ── */
.fm-error {
  background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.22);
  color: #d07075; border-radius: 9px; padding: .85rem 1.1rem; font-size: .82rem;
}

/* ── Responsive ── */
@media (max-width: 520px) {
  .fm-header { padding: .65rem .9rem; }
  .fm-sw-btn { padding: .27rem .55rem; font-size: .64rem; }
  .fm-upd-time { display: none; }
}