@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: 'Inter', system-ui, "Segoe UI", Arial, sans-serif; color: #1e293b; background-color: #f8fafc; }
body { display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #fff; flex: 0 0 auto; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); z-index: 10; }
.topbar .brand { font-weight: 700; font-size: 20px; letter-spacing: -0.5px; }
.topbar nav a { color: #cbd5e1; text-decoration: none; margin-right: 20px; font-weight: 500; transition: all 0.2s; padding: 6px 0; }
.topbar nav a.active, .topbar nav a:hover { color: #fff; border-bottom: 2px solid #3b82f6; }

main { flex: 1 1 auto; min-height: 0; }

/* Viewer */
.viewer { display: flex; height: 100%; }
.sidebar { width: 340px; flex: 0 0 340px; padding: 24px; overflow-y: auto;
  background: #ffffff; border-right: 1px solid #e2e8f0; box-shadow: 2px 0 8px rgba(0,0,0,0.02); z-index: 5; }
.sidebar h2 { margin: 0 0 8px; font-size: 20px; font-weight: 600; color: #0f172a; letter-spacing: -0.5px; }
.sidebar h3 { margin: 24px 0 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: 0.05em; color: #64748b; font-weight: 600; }
.sidebar label { display: block; font-size: 14px; margin: 8px 0 4px; font-weight: 500; color: #334155; }
.sidebar select { width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 14px; color: #1e293b; background-color: #f8fafc; transition: border-color 0.2s, box-shadow 0.2s; outline: none; }
.sidebar select:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1); }
.sidebar .chk { font-weight: 500; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sidebar .chk input { margin: 0; width: 16px; height: 16px; accent-color: #3b82f6; cursor: pointer; }
.muted { color: #64748b; font-size: 13px; line-height: 1.5; }
.sidehead { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sidehead h2 { margin: 0; }
.paneltoggle { display: none; padding: 6px 10px; border: 1px solid #cbd5e1; background: #fff;
  border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 500;
  color: #334155; cursor: pointer; }
.framestat { margin-top: 6px; min-height: 18px; }
.fcbadge { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px;
  background: #7b2ff7; color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.row button { padding: 8px 14px; border: 1px solid #cbd5e1; background: #ffffff; border-radius: 8px; cursor: pointer; font-family: 'Inter', sans-serif; font-weight: 500; color: #334155; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.row button:hover { background: #f1f5f9; border-color: #94a3b8; }
.frametime { flex: 1; text-align: center; font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 500; color: #0f172a; }

/* Radar overlay çapraz geçiş (crossfade) animasyonu */
.radar-ovl { transition: opacity 0.25s linear; }

.mapwrap { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
#map { flex: 1 1 auto; min-height: 0; }
/* İlk radar görüntüsü gelene kadar harita gizli tutulur. */
#map.map-hidden { visibility: hidden; }

/* Döngü animasyonu çubuğu (harita altı) — son 6 sa gözlem + 1 sa nowcast */
.animbar { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 8px 16px 6px;
  background: #fff; border-top: 1px solid #e2e8f0; box-shadow: 0 -2px 8px rgba(0,0,0,.03); }
.animbar[hidden] { display: none; }
.anim-play { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #cbd5e1;
  background: #eff6ff; color: #2563eb; font-size: 14px; cursor: pointer; display: grid; place-items: center; }
.anim-play:hover { background: #dbeafe; }
.anim-zaman { flex: 0 0 230px; min-width: 0; }
.anim-saat { font-size: 16px; font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; white-space: nowrap; }
.anim-ek { font-size: 12px; color: #64748b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-height: 1.4em; font-variant-numeric: tabular-nums; }
.anim-tahmin { display: inline-block; padding: 0 7px; border-radius: 999px; background: #7b2ff7; color: #fff;
  font-weight: 600; font-size: 11px; margin-right: 4px; }
.anim-serit { flex: 1 1 auto; min-width: 0; }
.anim-spark { display: block; width: 100%; height: 26px; }
.anim-kaydir { display: block; width: 100%; margin: 2px 0 0; accent-color: #3b82f6; cursor: pointer; }
.anim-saatler { position: relative; height: 15px; font-size: 10.5px; color: #64748b; font-variant-numeric: tabular-nums; }
.anim-saatler span { position: absolute; top: 1px; transform: translateX(-50%); white-space: nowrap; }
.animbar.statik .anim-zaman, .animbar.statik .anim-serit { opacity: .55; }
.anim-canvas { pointer-events: none; }

/* Harita kapısı (gate): görüntü hazır olana kadar bilgilendirme ekranı */
.mapgate { position: absolute; inset: 0; z-index: 1100; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); color: #e2e8f0; }
.mapgate.hidden { display: none; }
.mapgate.error { background: linear-gradient(135deg, #3b0d0d 0%, #5a1e1e 100%); }
.mapgate-box { text-align: center; max-width: 320px; }
.mapgate-msg { font-size: 18px; font-weight: 600; margin-top: 16px; letter-spacing: -0.3px; }
.mapgate-sub { font-size: 13px; color: #94a3b8; margin-top: 6px; line-height: 1.5; }
.spinner { width: 42px; height: 42px; margin: 0 auto; border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.18); border-top-color: #3b82f6;
  animation: spin 0.9s linear infinite; }
.mapgate.error .spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.result { margin-top: 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px;
  font-size: 14px; line-height: 1.5; min-height: 48px; color: #475569; }
.result .big { font-size: 24px; font-weight: 700; color: #0f172a; letter-spacing: -0.5px; margin-bottom: 4px; }
.rawlink { display: inline-flex; align-items: center; margin-top: 8px; font-size: 14px; color: #3b82f6; font-weight: 500; transition: color 0.2s; text-decoration: none; }
.rawlink:hover { color: #2563eb; text-decoration: underline; }
.rawlink.disabled { color: #94a3b8; pointer-events: none; text-decoration: none; }

/* Lejant — MGM radar lejantı düzeni: siyah kutu, yatay renk çubuğu, dikey sayılar */
.legend .mgmbar { background: #000; border: 2px solid #fff; border-radius: 4px;
  box-shadow: 0 0 0 1px #cbd5e1; padding: 6px 8px 8px; }
.legend .mgm-row { display: flex; height: 30px; }
.legend .mgm-row span { flex: 1 1 0; min-width: 0; display: flex;
  align-items: center; justify-content: center; }
/* writing-mode + 180° dönüş: sayılar MGM'deki gibi aşağıdan yukarı okunur. */
.legend .mgm-row i { writing-mode: vertical-rl; transform: rotate(180deg);
  font-style: normal; font-size: 11px; line-height: 1; color: #fff;
  font-variant-numeric: tabular-nums; }
.legend .mgm-strip { display: flex; height: 22px; margin: 2px 0; }
.legend .mgm-strip div { flex: 1 1 0; min-width: 0; }
.legend .mgm-cap { margin-top: 6px; text-align: center; color: #fff; font-size: 12px; }

/* Doc / alert page */
.doc { max-width: 860px; margin: 0 auto; padding: 28px 22px 60px; }
.doc h1 { margin-top: 0; }
.doc .lead { font-size: 16px; color: #33485c; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 20px 0; }
.card { position: relative; background: #f4f7fa; border: 1px solid #dde5ec; border-radius: 10px; padding: 14px; }
.card .num { position: absolute; top: -10px; left: -10px; width: 26px; height: 26px;
  background: #0d2b45; color: #fff; border-radius: 50%; display: grid; place-items: center; font-size: 13px; }
.card h3 { margin: 4px 0 6px; font-size: 15px; }
.card p { margin: 0; font-size: 13px; color: #44586b; line-height: 1.45; }
table.thr { border-collapse: collapse; margin: 8px 0; }
table.thr th, table.thr td { border: 1px solid #d6dee6; padding: 6px 14px; text-align: left; font-size: 14px; }
.sev-yellow td:first-child { color: #b59a00; font-weight: 700; }
.sev-orange td:first-child { color: #d97600; font-weight: 700; }
.sev-red td:first-child { color: #cc0000; font-weight: 700; }
code { background: #eef3f8; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
code.topic { background: #fff3cd; }
pre.msg { background: #0d2b45; color: #e8f0f8; padding: 12px 14px; border-radius: 8px;
  font-size: 13px; overflow-x: auto; }
.doc a { color: #1769aa; }

/* ── Mobil ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar { padding: 10px 14px; gap: 12px; }
  .topbar .brand { font-size: 16px; }
  .topbar nav a { margin-right: 12px; font-size: 14px; }

  .viewer { flex-direction: column; }
  .sidebar { width: 100%; flex: 0 0 auto; max-height: 45vh; overflow-y: auto;
    padding: 12px 14px; border-right: none; border-bottom: 1px solid #e2e8f0; }
  .paneltoggle { display: inline-block; }
  /* "Detayları Gizle" → sadece kare seçimi + sorgu sonucu kalır. */
  .sidebar.compact #sidebarExtra { display: none; }
  .sidebar h2 { font-size: 17px; }

  /* Parmakla kullanım için daha büyük dokunma hedefleri. */
  .row button { padding: 12px 18px; font-size: 16px; }
  .sidebar select { padding: 12px; font-size: 16px; } /* 16px → iOS zoom engellenir */
  .sidebar .chk { padding: 6px 0; }
  .sidebar .chk input { width: 20px; height: 20px; }

  .mapwrap { min-height: 55vh; }
  .animbar { flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; }
  .anim-zaman { flex: 1 1 0; }
  .anim-serit { flex: 1 1 100%; order: 3; }
  .anim-saatler span.tek { display: none; }
  .result { padding: 12px; }
  .result .big { font-size: 20px; }
}
