:root {
  --bg-page: #020617;
  --bg-card: #020617;
  --border-subtle: rgba(15, 23, 42, 0.8);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --accent: #38bdf8;
  --accent-soft: #a855f7;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: radial-gradient(circle at top left, #0b1120 0, #020617 55%);
  color: var(--text-main);
}

.ais-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.8rem;
}

.ais-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

.ais-subtitle {
  margin: 0.15rem 0 0.8rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ais-main {
  display: grid;
  grid-template-columns: minmax(0, 2.5fr) minmax(260px, 1fr);
  gap: 0.8rem;
}

.ais-map-wrapper {
  background: radial-gradient(circle at top left, #0b1120 0, #020617 70%);
  border-radius: 0.8rem;
  border: 1px solid var(--border-subtle);
  padding: 0.6rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.85);
  position: relative;
}

#ais-map {
  width: 100%;
  height: 420px;
  border-radius: 0.6rem;
  overflow: hidden;
}

.ais-updated {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ais-side {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.ais-card {
  background: radial-gradient(circle at top left, #0b1120 0, #020617 70%);
  border-radius: 0.8rem;
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 0.7rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.85);
  font-size: 0.8rem;
}

.ais-card-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  margin-bottom: 0.4rem;
}

/* toolbar boven de filterlijst */
.ais-filter-toolbar {
  margin-bottom: 0.4rem;
}

.ais-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.ais-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

.ais-filter-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ais-filter-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ais-filter-item span {
  font-size: 0.8rem;
}

.ais-status-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 320px;
  overflow-y: auto;
}

.ais-status-row {
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  padding: 0.2rem 0;
}

.ais-status-row:last-child {
  border-bottom: none;
}

.ais-status-row strong {
  color: var(--accent-soft);
}

.ais-status-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.leaflet-container {
  background: #020617;
}

/* --- Pijl-icoontjes + labels --- */

.ais-ship-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  background: transparent;
  border: none;
}

.ais-ship-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* wrapper die we roteren; SVG zit hierbinnen */
.ais-ship-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 50%;
  transition: transform 0.15s linear;
}

/* oude kleur-classes zijn niet meer nodig, maar kunnen geen kwaad */
.ais-ship-arrow-main {
  border-bottom-color: #22c55e; /* niet meer in gebruik */
}

.ais-ship-arrow-other {
  border-bottom-color: #facc15; /* niet meer in gebruik */
}

.ais-ship-label {
  margin-top: 2px;
  padding: 1px 4px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.1;
  white-space: nowrap;
  background: rgba(15, 23, 42, 0.8);
  color: #e5e7eb;
}

/* --- Trails --- */

.ais-trail {
  stroke-width: 2px;
  opacity: 0.7;
}

.ais-trail-main {
  stroke: #22c55e;
}

.ais-trail-other {
  stroke: #facc15;
}

/* --- Filter-paneel: top-balk + dropdown overige schepen --- */

.ais-filter-top {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
  .ais-filter-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.ais-filter-heading {
  margin-top: 0.25rem;
  margin-bottom: 0.15rem;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #9ca3af);
}

.ais-filter-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  margin: 0.15rem 0;
  cursor: pointer;
}

.ais-filter-row input[type="checkbox"] {
  accent-color: #22c55e;
  cursor: pointer;
}

/* status-lijst (tekst) – optioneel wat strakker maken */

.ais-status-item {
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.4);
}

.ais-status-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.ais-status-line {
  font-size: 0.85rem;
}

.ais-status-extra {
  font-size: 0.8rem;
  color: var(--text-muted, #9ca3af);
}

/* Popup-styling */

.ais-popup-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.ais-popup-line {
  font-size: 0.85rem;
  margin-bottom: 2px;
}

/* === Nieuwe helpers voor "Overige schepen" inklappen === */

.hidden {
  display: none;
}

.ais-filter-block {
  margin-bottom: 0.5rem;
}

.ais-filter-title {
  margin-top: 0.25rem;
  margin-bottom: 0.2rem;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #9ca3af);
}

.ais-other-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.ais-other-chevron {
  margin-left: 0.25rem;
  font-size: 0.8rem;
}

.ais-other-list {
  margin-top: 0.25rem;
  padding-left: 0.5rem;
  border-left: 1px solid rgba(148, 163, 184, 0.4);
  max-height: 180px;
  overflow-y: auto;
}

.ais-other-list label {
  display: block;
  font-size: 0.8rem;
  margin: 0.1rem 0;
}


/* === Embed-mode: alleen de kaart tonen (voor iframe) === */

body.ais-embed .ais-header,
body.ais-embed .ais-side,
body.ais-embed .ais-updated {
  display: none;
}

body.ais-embed .ais-main {
  grid-template-columns: minmax(0, 1fr);
}

body.ais-embed .ais-map-wrapper {
  padding: 0;
  border: none;
  box-shadow: none;
}

/* === Compact mode: kaart vult volledige breedte === */
body.ais-compact .ais-main {
  grid-template-columns: minmax(0, 1fr);
}

body.ais-compact .ais-side {
  display: none;
}
/* =========================
   FULL mode: alles onder de kaart
   ========================= */

body.ais-full .ais-main {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* kaart iets hoger in full */
body.ais-full #ais-map {
  height: 520px;
}

/* de “onderblok” cards in een responsive grid */
body.ais-full .ais-below {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
}

/* =========================
   COMPACT mode: alleen kaart
   ========================= */
body.ais-compact .ais-below {
  display: none;
}
/* Full modal layout: onderblokken dezelfde hoogte + interne scroll */
body.ais-full .ais-below {
  align-items: stretch;
}

/* Geef de cards een vaste (maar responsive) hoogte */
body.ais-full .ais-below .ais-card {
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

/* Filterlijst en statuslijst mogen intern scrollen */
body.ais-full #ais-filter-list {
  overflow: auto;
  max-height: 260px;
}

body.ais-full #ais-status-list {
  overflow: auto;
  max-height: 260px;
}

/* Events / ETA: intern scrollen, zodat de modal niet mega-lang wordt */
body.ais-full .ais-events-scroll {
  overflow: auto;
  max-height: 260px;
}

/* Kleine extra: zorg dat lange regels netjes afbreken */
body.ais-full .ais-events-scroll,
body.ais-full #ais-status-list {
  word-break: break-word;
}
/* nette tabel voor events */
.ais-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.ais-table th,
.ais-table td {
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  vertical-align: top;
}

.ais-table thead th {
  position: sticky;
  top: 0;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(6px);
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  color: rgba(229, 231, 235, 0.9);
}

.ais-table tbody tr:hover td {
  background: rgba(56, 189, 248, 0.06);
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.ais-events-scroll {
  overflow: auto;
  max-height: 260px;
}
/* ===== AIS events tabel: leesbaar + sticky header + nette kolommen ===== */

/* alleen in full */
body.ais-full .ais-events-scroll{
  max-height: 260px;
  overflow: auto;
  border-radius: 0.6rem;
}

/* maak de tabel compact en stabiel */
body.ais-full table.ais-events-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;            /* voorkomt rare kolomsprongen */
  font-size: 0.78rem;
  line-height: 1.25;
}

/* sticky header */
body.ais-full table.ais-events-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(6px);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  color: rgba(229, 231, 235, 0.9);
  border-bottom: 1px solid rgba(148, 163, 184, 0.20);
}

/* cell styling */
body.ais-full table.ais-events-table th,
body.ais-full table.ais-events-table td{
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  vertical-align: top;
  word-break: break-word;
}

/* zebra + hover */
body.ais-full table.ais-events-table tbody tr:nth-child(2n){
  background: rgba(148, 163, 184, 0.04);
}
body.ais-full table.ais-events-table tbody tr:hover td{
  background: rgba(56, 189, 248, 0.06);
}

/* kolombreedtes (tweak naar smaak) */
body.ais-full table.ais-events-table th:nth-child(1),
body.ais-full table.ais-events-table td:nth-child(1){ width: 118px; } /* tijd */
body.ais-full table.ais-events-table th:nth-child(2),
body.ais-full table.ais-events-table td:nth-child(2){ width: 120px; } /* schip */
body.ais-full table.ais-events-table th:nth-child(3),
body.ais-full table.ais-events-table td:nth-child(3){ width: 90px; }  /* haven */
body.ais-full table.ais-events-table th:nth-child(4),
body.ais-full table.ais-events-table td:nth-child(4){ width: 80px; }  /* type */

/* ETA-cell: min + tijd netjes onder elkaar op smalle cards */
body.ais-full table.ais-events-table td.eta-cell{
  width: auto;
}
body.ais-full table.ais-events-table td.eta-cell .eta-min,
body.ais-full table.ais-events-table td.eta-cell .eta-at{
  display: block;
  margin-left: 0 !important;
}

/* monospace voor tijdkolommen */
body.ais-full table.ais-events-table td:nth-child(1),
body.ais-full table.ais-events-table td.eta-cell{
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
/* FULL: onder de kaart -> events full width -> controls 2 kolommen */
body.ais-full .ais-below {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

body.ais-full .ais-row-events {
  width: 100%;
}

body.ais-full .ais-row-controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  gap: 0.8rem;
}

@media (max-width: 900px) {
  body.ais-full .ais-row-controls {
    grid-template-columns: 1fr;
  }
}

/* events scroll */
body.ais-full .ais-events-scroll{
  max-height: 320px;
  overflow: auto;
  border-radius: 0.6rem;
}

/* === maak de events tabel echt leesbaar === */
body.ais-full table.ais-events-table{
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;        /* <-- belangrijk: niet fixed */
  font-size: 0.82rem;
  line-height: 1.25;
}

body.ais-full table.ais-events-table th,
body.ais-full table.ais-events-table td{
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  vertical-align: middle;
  white-space: nowrap;       /* standaard compact */
}

/* laatste kolom mag wrappen */
body.ais-full table.ais-events-table td.eta-cell{
  white-space: normal;
}

/* sticky header */
body.ais-full table.ais-events-table thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.20);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.70rem;
}

/* maak ETA (min + tijd) netjes */
body.ais-full table.ais-events-table td.eta-cell .eta-min,
body.ais-full table.ais-events-table td.eta-cell .eta-at{
  display: inline-block;
}
/* Titel + knop naast elkaar */
.ais-card-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

/* Betonning knop */
.ais-btn-toggle{
  padding:6px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #e8eefc;
  cursor:pointer;
  font-size: 0.9rem;
  line-height: 1;
  white-space: nowrap;
}

.ais-btn-toggle:hover{
  background: rgba(255,255,255,0.10);
}

.ais-btn-toggle.is-on{
  border-color: rgba(56,189,248,0.8);
  background: rgba(56,189,248,0.18);
}


/* Header: links titel/subtitle, rechts "Ga naar de complete site" */
.ais-header-bar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}

.ais-header-left{
  min-width:0; /* voorkomt rare overflow */
}

.ais-header-right{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  white-space:nowrap;
}

.ais-header-link{
  display:inline-block;
  padding:10px 12px;
  border-radius:10px;
  text-decoration:none;
  font-weight:600;
  opacity:0.95;
  /* geen vaste kleur opgelegd; gebruikt jouw thema-kleuren */
}


.ais-header-link:hover{
  opacity:1;
  text-decoration:underline;
}

/* Mobiel: link onder de titel/subtitle */
@media (max-width: 700px){
  .ais-header-bar{
    flex-direction:column;
    align-items:stretch;
  }
  .ais-header-right{
    justify-content:flex-start;
    white-space:normal;
  }
}

/* Header layout */
.ais-header-bar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
}

.ais-header-left{
  min-width:0;
}

.ais-header-right{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
}

/* Subtiele call-to-action */
.ais-header-link{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 14px;
  border-radius:999px;
  font-weight:600;
  font-size:0.9rem;
  text-decoration:none;
  opacity:0.85;

  color: inherit; /* ← zelfde kleur als <p> */
  background:rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
}


.ais-header-link:hover{
  opacity:1;
  background:rgba(255,255,255,0.12);
}

/* Mobiel: knop onder de titel */
@media (max-width: 700px){
  .ais-header-bar{
    flex-direction:column;
  }
  .ais-header-right{
    margin-top:6px;
    justify-content:flex-start;
  }
}


/* === Mobile overlay layout fix === */
@media (max-width: 700px) {
  .leaflet-bottom.leaflet-left {
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .leaflet-bottom.leaflet-right {
    bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .leaflet-control-attribution {
    display: none;
  }

  .tide-ctl {
    max-width: calc(100vw - 150px) !important;
  }

  .rv-timeline {
    max-width: 220px !important;
  }
}
