/* AIS Trail canlı harita: Liman İkizi / site tasarım dili (Inter, beyaz kartlar, mavi vurgu); gece: konsolun Gece ailesi. */
:root {
  /* gündüz: sitenin açık eşi (beyaz kartlar, koyu turkuaz vurgu, siyah hap düğme) */
  /* --accent ve --faint beyaz ve --accent-w üzerinde küçük metin için ≥ 4.5:1 (WCAG AA) */
  --bg: #F4F6F6; --card: #FFFFFF; --topbar: #FFFFFF; --ink: #0A0A0A; --ink2: #333A3D; --muted: #5F686C; --faint: #6B7377;
  --line: #E3E7E8; --line2: #EEF1F1; --hover: #F2F5F5; --surface-2: #F2F5F5;
  --accent: #08766D; --accent-w: #E2F5F3; --on-accent: #FFFFFF;
  --btn-bg: #0A0A0A; --btn-ink: #FFFFFF; --btn-hover-bg: #2BFFEA; --btn-hover-ink: #050505;
  --green-d: #12B5A6; --amber: #B45309; --red: #C9302C;
  --shadow: 0 1px 2px rgba(10, 20, 20, .05), 0 6px 16px -4px rgba(10, 20, 20, .08), 0 22px 44px -16px rgba(10, 20, 20, .14);
  --overlay: rgba(255, 255, 255, .86); --tip-bg: #0A0A0A; --tip-ink: #FFFFFF;
  --r: 16px; --tb-h: 64px; --side-w: 380px; --g: 16px;
  color-scheme: light;
}
:root[data-theme="night"] {
  /* gece: sitenin kendisi (siyah zemin, #0F0F0F kartlar, ince beyaz çizgiler, #2BFFEA vurgu, beyaz hap düğme) */
  --bg: #000000; --card: #0F0F0F; --topbar: #000000; --ink: #FFFFFF; --ink2: #CCCCCC; --muted: #9A9A9A; --faint: #808080;
  --line: #242424; --line2: #1A1A1A; --hover: #1A1A1A; --surface-2: #161616;
  --accent: #2BFFEA; --accent-w: #0C2826; --on-accent: #050505;
  --btn-bg: #FFFFFF; --btn-ink: #050505; --btn-hover-bg: #2BFFEA; --btn-hover-ink: #050505;
  --green-d: #2BFFEA; --amber: #F5B451; --red: #F87171;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 8px 24px -6px rgba(0, 0, 0, .6), 0 24px 48px -16px rgba(0, 0, 0, .7);
  --overlay: rgba(0, 0, 0, .8); --tip-bg: #1A1A1A; --tip-ink: #FFFFFF;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
b { font-weight: 600; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd { font: 500 11px/1 Inter, sans-serif; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; background: var(--card); }
.lnk { color: var(--accent); font-weight: 600; font-size: 12.5px; border-radius: 6px; padding: 2px 6px; }
.lnk:hover { background: var(--accent-w); }

/* ------------------------------------------------------------ üst çubuk */
.search { position: relative; display: flex; align-items: center; gap: 10px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: var(--ink2); }
.icon-btn:hover { background: var(--hover); }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, color .2s, box-shadow .2s; }
.btn.primary { background: var(--btn-bg); color: var(--btn-ink); }
.btn.primary:hover { background: var(--btn-hover-bg); color: var(--btn-hover-ink); box-shadow: 0 0 18px rgba(43, 255, 234, .35); }
.btn.ghost { color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); background: var(--card); }
.btn.ghost:hover { background: var(--hover); }
.btn.ghost[aria-pressed="true"] { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.dropdown { position: absolute; z-index: 60; top: 50px; left: 0; right: 0; background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  border: 1px solid var(--line); overflow: auto; max-height: 60vh; padding: 6px; }
.res { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.res:hover, .res[aria-selected="true"] { background: var(--hover); }
.res .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.res b { display: block; font-size: 13.5px; color: var(--ink); }
.res small { color: var(--muted); font-size: 12px; }
.res-empty { padding: 10px; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ harita ve yüzen kartlar */
#main { position: fixed; inset: var(--tb-h) 0 0 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
.stats { position: absolute; z-index: 10; top: var(--g); left: var(--g); display: flex; align-items: center; gap: 0; height: 40px; padding: 0 6px; border-radius: 12px; }
.stats > div { display: flex; align-items: baseline; gap: 6px; padding: 0 12px; border-right: 1px solid var(--line); white-space: nowrap; }
.stats > div:last-child { border-right: 0; }
.stats b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12.5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-d); align-self: center; }
.st-dot.wait { background: var(--amber); } .st-dot.err { background: var(--red); }
.more-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--muted); }
.more-grid input { height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13px; min-width: 0; }
.more-grid input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.maplibregl-ctrl-attrib .nfn-a { font-weight: 600; color: var(--ink2); }
.maplibregl-ctrl-bottom-right { right: calc(var(--pr, 0px) + 6px); transition: right .25s; }
.maplibregl-ctrl-top-right { right: calc(var(--pr, 0px) + 6px); transition: right .25s; top: 4px; }
.maplibregl-ctrl-attrib.maplibregl-compact { background: var(--overlay); }
.maplibregl-ctrl-attrib-inner, .maplibregl-ctrl-attrib a { font-size: 11px; color: var(--muted); }
.maplibregl-ctrl-group { background: var(--card); box-shadow: var(--shadow); border-radius: 12px; }
:root[data-theme="night"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(.9); }
:root[data-theme="night"] .maplibregl-ctrl-attrib-button { filter: invert(.85); }

/* ------------------------------------------------------------ gemi kartı */
body.card-open { --pr: calc(var(--side-w) + var(--g)); }
.side { position: absolute; z-index: 20; top: var(--g); right: var(--g); bottom: var(--g); width: var(--side-w); display: flex; flex-direction: column; overflow: hidden; }
.sd-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line2); }
.sd-top { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.sd-top .tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--ink2);
  background: var(--surface-2); }
.sd-top .tag i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.sd-top .icon-btn { margin-left: auto; width: 34px; height: 34px; }
.sd-name { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.sd-ids { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.sd-ids span { display: inline-block; white-space: nowrap; }
.sd-ids span + span::before { content: "·"; margin: 0 6px; color: var(--faint); }
.sd-status { display: inline-flex; align-items: center; gap: 7px; margin: 10px 0 0; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--accent-w); color: var(--accent); }
/* bayat konum (STALE_S üstü ya da kapsama dışı): kehribar; gündüz zemini açık tutulur (kehribar metin ≥ 4.5:1) */
.sd-status.stale { background: color-mix(in srgb, var(--amber) 6%, var(--card)); color: var(--amber); }
:root[data-theme="night"] .sd-status.stale { background: color-mix(in srgb, var(--amber) 12%, var(--card)); }
.sd-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sd-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 18px 18px; scrollbar-width: thin; }
.sd-sum { margin: 0 0 14px; color: var(--ink2); font-size: 13.5px; line-height: 1.55; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0 0 14px; }
.tile { padding: 10px 11px; border-radius: 11px; box-shadow: inset 0 0 0 1px var(--line); }
.tile small { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.tile b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile b small { display: inline; font-size: 12px; letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--muted); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0 0 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kv dd small { display: block; color: var(--faint); font-weight: 400; font-size: 11.5px; }
.sd-actions { display: flex; gap: 8px; margin: 0 0 14px; }
.sd-actions .btn { flex: 1; justify-content: center; height: 38px; }
.sd-src { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12px; line-height: 1.5; }
.upsell { padding: 12px; border-radius: 11px; box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; color: var(--ink2); line-height: 1.5; }
.upsell a { color: var(--accent); font-weight: 600; text-decoration: none; }

#toasts { position: fixed; z-index: 80; top: calc(var(--tb-h) + 12px); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--tip-bg); color: var(--tip-ink); padding: 9px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow); transition: opacity .25s; }

/* ------------------------------------------------------------ dar ekran */
@media (max-width: 900px) {
  :root { --tb-h: 58px; --g: 10px; }
  .search kbd { display: none; }
  .stats > div:nth-child(3) { display: none; }   /* durum stDot ile görünür kalır */
  .stats > div:nth-child(2) { border-right: 0; }          /* "updated" gizli: son ayırıcı çizgi kalmasın */
  .side { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62%; border-radius: 16px 16px 0 0; }
  body.card-open { --pr: 0px; }
  body.card-open .fbar { display: none; }
}

/* 2B / 3B düğmesi (Liman İkizi'ndeki gibi) */
.ctl-dim { width: 29px; height: 29px; display: grid; place-items: center; font: 700 11px/1 Inter, sans-serif; color: var(--ink2); }
.ctl-dim[aria-pressed="true"] { color: var(--accent); }
:root[data-theme="night"] .maplibregl-ctrl-group .ctl-dim { color: var(--ink2); }
:root[data-theme="night"] .maplibregl-ctrl-group .ctl-dim[aria-pressed="true"] { color: var(--accent); }

/* ------------------------------------------------------------ süzgeçler: tek düğme + açılır panel (haritada yer kaplamaz) */
.fbar { position: absolute; z-index: 12; top: var(--g); left: calc(var(--g) + var(--stats-w, 420px) + 8px); display: flex; gap: 6px; }
.fbtn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 13px; border-radius: 12px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.fbtn:hover, .fbtn[aria-expanded="true"] { color: var(--accent); }
.fbtn.on { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent), var(--shadow); }
.fcount { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; display: grid; place-items: center; }
.fclr { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.fclr:hover { color: var(--ink); }
.filters { position: absolute; z-index: 15; top: calc(var(--g) + 50px); left: var(--g); width: 372px; max-height: calc(100% - 2 * var(--g) - 50px); overflow: auto;
  padding: 14px 16px 12px; overscroll-behavior: contain; }
.f-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; }
.f-head .lnk { margin-left: auto; }
.f-head .icon-btn { width: 32px; height: 32px; }
.f-sec { margin: 0 0 14px; }
.f-l { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin: 0 0 7px; }
.types { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px 8px; }
.type { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 32px; padding: 5px 8px; border-radius: 8px; font-size: 13px; line-height: 1.25; color: var(--ink); text-align: left; }
.type:hover { background: var(--hover); }
.type i { width: 14px; height: 14px; border-radius: 4px; flex: none; background: var(--c); box-shadow: inset 0 0 0 1.5px var(--c); }
.type[aria-pressed="false"] { color: var(--faint); }
.type[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--faint); }
.type span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.type small { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills button { height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line); }
.pills button[aria-checked="true"] { color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); background: var(--accent-w); }
.more-grid { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.more-grid input { width: 100%; }
.f-foot { margin: 2px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line2); color: var(--muted); font-size: 12px; }
.f-check { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; font-size: 13px; cursor: pointer; }
.f-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.f-check span { display: flex; flex-direction: column; gap: 2px; }
.f-check small { color: var(--muted); font-size: 11.5px; }
/* dar ekran: süzgeç paneli alt sayfa, Filters düğmesi istatistiğin altında, not solda (sağdaki denetimlere binmesin);
   temel kurallardan SONRA gelmeli */
@media (max-width: 900px) {
  .filters { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72%; border-radius: 16px 16px 0 0; z-index: 40; }
  .fbar { top: calc(var(--g) + 48px); left: var(--g); }
}
/* orta genişlik ve kart açık: Filters düğmesi sağdaki denetimlere ve karta binmesin */
@media (min-width: 901px) and (max-width: 1180px) {
  body.card-open .fbar { top: calc(var(--g) + 48px); left: var(--g); }
}
#stUpd { display: inline-block; min-width: 13ch; font-variant-numeric: tabular-nums; }   /* metin değiştikçe Filters düğmesi kaymasın */
/* ölçek çubuğu: varsayılan beyaz zemin koyu temada parlıyordu; temanın kaplama rengi */
.maplibregl-ctrl-scale { background: var(--overlay); color: var(--ink2); border-color: var(--faint); }


/* ------------------------------------------------------------ header (site ile aynı dil)
   üç bölme: sol logo + "Live Map" (sitedeki turkuaz çerçeveli canlı etiket) · orta hap arama · sağ tema · Sign in · Get started (fiyat ve doküman ana sitede; harita çubuğu sade).
   Tüm denetimler 36-40px ve hap biçiminde; zemin tema rengi, altta ince çizgi. */
:root { --acc-rgb: 11, 143, 132; --search-bg: #F3F5F5; }
:root[data-theme="night"] { --acc-rgb: 43, 255, 234; --search-bg: #0C0C0C; }
#topbar { position: fixed; z-index: 30; top: 0; left: 0; right: 0; height: var(--tb-h);
  display: grid; grid-template-columns: minmax(max-content, 1fr) clamp(260px, 34vw, 520px) minmax(max-content, 1fr); align-items: center; gap: 24px;
  padding: 0 24px; background: var(--topbar); border-bottom: 1px solid var(--line); }
.tb-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.tb-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.tb-right > * { flex: none; }
.brand { display: flex; align-items: center; flex: none; text-decoration: none; color: var(--ink); }
/* sitenin logosu (beyaz yazılı); gündüzde ters çevrilir: yazı siyah, cam paneller koyu turkuaz */
.brand-logo { display: block; height: 32px; width: auto; }
:root:not([data-theme="night"]) .brand-logo { filter: invert(1) hue-rotate(180deg); }
.tb-live { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: 999px; flex: none;
  border: 1px solid rgba(var(--acc-rgb), .4); color: var(--ink); font-size: 13px; font-weight: 500; letter-spacing: -.005em; white-space: nowrap; }
.tb-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: tb-pulse 2.4s ease-out infinite; }
@keyframes tb-pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--acc-rgb), .55); } 70%, 100% { box-shadow: 0 0 0 7px rgba(var(--acc-rgb), 0); } }
/* veri gecikince ya da alınamayınca nokta istatistik kartındaki gibi: bekleme kehribar, hata kırmızı, ikisi de durağan (renderStats) */
.tb-live.wait i, .tb-live.err i { animation: none; }
.tb-live.wait i { background: var(--amber); }
.tb-live.err i { background: var(--red); }
@media (prefers-reduced-motion: reduce) { .tb-live i { animation: none; } }
#topbar .search { width: 100%; margin: 0; height: 40px; padding: 0 8px 0 14px; border-radius: 999px; background: var(--search-bg); border: 1px solid var(--line); }
#topbar .search:focus-within { background: var(--card); border-color: rgba(var(--acc-rgb), .7); box-shadow: 0 0 0 3px rgba(var(--acc-rgb), .14); }
#topbar .search kbd { border-radius: 999px; padding: 3px 8px; background: transparent; }
.tb-signin { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 500;
  color: var(--ink2); text-decoration: none; white-space: nowrap; transition: color .15s, background-color .15s; }
.tb-signin:hover { color: var(--ink); background: var(--hover); }
#themeBtn { width: 36px; height: 36px; border-radius: 999px; color: var(--ink2); }
#themeBtn:hover { color: var(--ink); background: var(--hover); }
#startBtn { height: 36px; padding: 0 16px; margin-left: 4px; font-size: 14px; }
@media (max-width: 900px) {
  /* dar ekranda: logodan yalnız cam panel simgesi + arama + tema + Get started; gemi sayısı istatistik kartında */
  #topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 0 10px; }
  #topbar .search { width: auto; min-width: 0; height: 38px; }
  .tb-live, .tb-signin { display: none; }
  .brand-logo { width: 36px; height: 34px; object-fit: cover; object-position: left center; }   /* yalnız cam panel simgesi */
  #startBtn { height: 34px; padding: 0 14px; font-size: 13px; margin-left: 0; }
  /* arama sonuçları dar arama kutusuna sıkışmasın: çubuğun altında tam genişlik */
  #results.dropdown { position: fixed; top: calc(var(--tb-h) + 6px); left: 10px; right: 10px; }
}
