/* Live-flyg (projekt 6) — komplett stilmall. */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --special: #ef4444;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --topbar-h: 60px;
}
[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #131c2e;
  --surface-2: #0f1626;
  --border: #24314b;
  --text: #e6edf7;
  --muted: #93a4bd;
  --accent: #3b82f6;
  --accent-ink: #ffffff;
  --special: #f87171;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.flyg-page {
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Topbar ---------- */
.flyg-topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.flyg-topbar__inner {
  height: var(--topbar-h);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
}
.flyg-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); font-weight: 700; }
.flyg-brand__mark { font-size: 20px; color: var(--accent); }
.flyg-brand__name { white-space: nowrap; }
.flyg-nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.flyg-nav::-webkit-scrollbar { display: none; }
.flyg-nav__link {
  padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--muted); font-weight: 500; white-space: nowrap;
}
.flyg-nav__link:hover { background: var(--surface-2); color: var(--text); }
.flyg-topbar__actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.flyg-icon-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
}
.flyg-icon-btn:hover { border-color: var(--accent); }
.flyg-icon-btn__moon { display: none; }
[data-theme="dark"] .flyg-icon-btn__sun { display: none; }
[data-theme="dark"] .flyg-icon-btn__moon { display: inline; }
.flyg-user { display: flex; align-items: center; gap: 8px; }
.flyg-user__avatar { width: 30px; height: 30px; border-radius: 50%; }

.flyg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 600;
  text-decoration: none; cursor: pointer; font-size: 14px;
}
.flyg-btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.flyg-btn--ghost { background: transparent; }
.flyg-btn--sm { padding: 6px 12px; font-size: 13px; }
.flyg-btn:hover { filter: brightness(1.05); }

/* ---------- Flash ---------- */
.flyg-flash-wrap { max-width: 1000px; margin: 12px auto 0; padding: 0 16px; display: grid; gap: 8px; }
.flyg-flash { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.flyg-flash--error { border-color: var(--special); color: var(--special); }
.flyg-flash--success { border-color: var(--accent); }

/* ---------- Layout ---------- */
.flyg-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.flyg-page--map .flyg-main { max-width: none; margin: 0; padding: 0; }
.flyg-page-head { margin: 8px 0 20px; }
.flyg-page-head--split { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.flyg-page-title { margin: 0 0 6px; font-size: 28px; }
.flyg-page-lead { margin: 0; color: var(--muted); }
.flyg-section-title { font-size: 18px; margin: 0 0 12px; }
.flyg-muted { color: var(--muted); }

.flyg-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.flyg-card__title { margin: 0 0 14px; font-size: 18px; }

/* ---------- Forms ---------- */
.flyg-form { display: grid; gap: 14px; max-width: 560px; }
.flyg-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.flyg-field { display: grid; gap: 6px; }
.flyg-field__label { font-size: 13px; color: var(--muted); font-weight: 600; }
.flyg-input {
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: 14px; font-family: inherit;
}
.flyg-input:focus { outline: none; border-color: var(--accent); }
.flyg-login { display: grid; gap: 12px; max-width: 420px; }
.flyg-home-current { display: grid; gap: 8px; margin-bottom: 20px; max-width: 560px; }

/* ---------- Map ---------- */
.flyg-map-root { position: relative; height: calc(100vh - var(--topbar-h)); }
.flyg-map { position: absolute; inset: 0; z-index: 1; }
.flyg-map-toolbar {
  position: absolute; top: 12px; left: 12px; z-index: 500;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.flyg-loc {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow);
}
.flyg-loc__label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.flyg-loc__btn {
  padding: 4px 12px; border-radius: 999px; text-decoration: none;
  color: var(--text); font-weight: 600; font-size: 13px;
}
.flyg-loc__btn.is-active { background: var(--accent); color: var(--accent-ink); }
.flyg-map-count {
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}

/* ---------- Plane markers ---------- */
.flyg-plane svg { width: 26px; height: 26px; fill: var(--accent); filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); transition: transform .3s ease; }
.flyg-plane--special svg { fill: var(--special); }

/* ---------- Panel ---------- */
.flyg-panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; z-index: 600;
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-y: auto;
}
.flyg-panel__close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.5); color: #fff; font-size: 20px; cursor: pointer; line-height: 1;
}
.flyg-panel__photo { width: 100%; aspect-ratio: 16/10; background: var(--surface-2); display: flex; align-items: center; justify-content: center; }
.flyg-panel__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flyg-panel__noimg { color: var(--muted); font-size: 14px; }
.flyg-photo-credit { margin: 8px 16px 0; font-size: 12px; color: var(--muted); }
.flyg-panel__body { padding: 14px 16px 20px; }
.flyg-panel__callsign { margin: 8px 0 6px; font-size: 22px; }
.flyg-panel__type { margin: 6px 0; color: var(--text); font-weight: 500; }
.flyg-panel__owner { margin: 4px 0; color: var(--muted); }
.flyg-panel__country { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.flyg-badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-2);
  border: 1px solid var(--border); color: var(--muted);
}
.flyg-badge--heavy, .flyg-badge--military, .flyg-badge--special { background: var(--special); color: #fff; border-color: var(--special); }
.flyg-badge--large { background: var(--accent); color: #fff; border-color: var(--accent); }
.flyg-badge--light { background: #16a34a; color: #fff; border-color: #16a34a; }

/* Reg menu */
.flyg-reg-menu { position: relative; display: inline-block; margin: 4px 0; }
.flyg-reg-btn {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 700; font-size: 14px;
}
.flyg-reg-menu__dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; min-width: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); overflow: hidden;
}
.flyg-reg-menu__item { display: block; padding: 10px 14px; text-decoration: none; color: var(--text); font-size: 14px; }
.flyg-reg-menu__item:hover { background: var(--surface-2); }

/* Route */
.flyg-route { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 0 4px; }
.flyg-route__ap { font-weight: 700; font-size: 16px; }
.flyg-route__arrow { color: var(--muted); }
.flyg-route__names { width: 100%; font-size: 12px; color: var(--muted); }
.flyg-route__eta { margin: 2px 0 0; font-size: 13px; color: var(--accent); font-weight: 600; }

/* Stats */
.flyg-stats, .tv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.flyg-stat, .tv-stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.flyg-stat__label, .tv-stat__label { display: block; font-size: 12px; color: var(--muted); }
.flyg-stat__value, .tv-stat__value { font-size: 16px; font-weight: 700; }

/* ---------- Närmaste (TV) ---------- */
.tv-root { max-width: 1000px; margin: 0 auto; }
.tv-main { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.tv-visual { padding: 0; overflow: hidden; }
.tv-photo { width: 100%; aspect-ratio: 16/10; background: var(--surface-2); }
.tv-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tv-photo .flyg-panel__noimg { display: flex; align-items: center; justify-content: center; height: 100%; }
.tv-compass-wrap { display: flex; align-items: center; gap: 16px; padding: 16px; }
.tv-compass { position: relative; width: 70px; height: 70px; border-radius: 50%; border: 2px solid var(--border); }
.tv-compass__n { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.tv-compass__arrow { position: absolute; top: 50%; left: 50%; width: 3px; height: 30px; background: var(--accent); transform-origin: bottom center; transform: translate(-50%, -100%); border-radius: 2px; transition: transform .5s ease; }
.tv-bearing { font-size: 18px; font-weight: 700; margin: 0; }
.tv-info { }
.tv-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); margin: 0 0 4px; }
.tv-callsign { font-size: 30px; margin: 4px 0; }
.tv-type { margin: 6px 0; }
.tv-country { color: var(--muted); margin: 8px 0 0; }
.tv-plane-heading { font-size: 40px; text-align: center; margin-top: 16px; transition: transform .5s ease; }
.tv-empty { text-align: center; padding: 48px 20px; }
.tv-empty__title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.tv-empty__sub { color: var(--muted); margin: 0; }

/* ---------- Startsida ---------- */
.flyg-hero { text-align: center; padding: 40px 0 12px; max-width: 680px; margin: 0 auto; }
.flyg-hero__kicker { display: inline-block; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); padding: 5px 12px; border-radius: 999px; }
.flyg-hero__title { font-size: clamp(28px, 5vw, 42px); margin: 16px 0 12px; line-height: 1.1; }
.flyg-hero__lead { color: var(--muted); font-size: 17px; line-height: 1.6; margin: 0 auto 24px; }
.flyg-hero__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.flyg-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin: 32px 0; }
.flyg-feature { text-align: left; }
.flyg-feature__icon { font-size: 28px; margin-bottom: 10px; }
.flyg-feature__title { font-size: 17px; margin: 0 0 6px; }
.flyg-feature__desc { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }

/* ---------- Photo admin ---------- */
.flyg-photo-grid { margin-top: 28px; display: grid; gap: 16px; }
.flyg-photo-card { display: flex; gap: 14px; align-items: center; padding: 12px; }
.flyg-photo-card img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; }
.flyg-photo-card__body { display: grid; gap: 6px; }

/* ---------- Fullscreen ---------- */
body.flyg-fullscreen .flyg-topbar { display: none; }
body.flyg-fullscreen .flyg-map-root { height: 100vh; }
body.flyg-fullscreen.flyg-page--map .flyg-flash-wrap { display: none; }

/* ---------- Responsivt ---------- */
@media (max-width: 760px) {
  .flyg-brand__name { display: none; }
  .flyg-topbar__inner { gap: 8px; padding: 0 10px; }
  .tv-main { grid-template-columns: 1fr; }
  .flyg-panel { top: auto; bottom: 0; right: 0; left: 0; width: 100%; max-height: 55vh; border-radius: var(--radius) var(--radius) 0 0; }
  .flyg-form-row { grid-template-columns: 1fr; }
}
