/* style.css — Netstat (netstat.wenest.se): styling for index.php and login.php. Light and dark theme via tokens. */

:root {
  --bg: #f3f6f7;
  --surface: #ffffff;
  --ink: #12202a;
  --muted: #5a6a75;
  --line: #dbe3e7;
  --accent: #0e7468;
  --accent-ink: #ffffff;
  --accent-soft: #e2f2ef;
  --old: #9aa7b0;
  --ok: #15803d;   --ok-bg: #e5f4ea;
  --warn: #a35a06; --warn-bg: #fbefdc;
  --bad: #b42318;  --bad-bg: #fbe6e3;
  --code: #eef2f4;
  --radius: 10px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1317; --surface: #131e24; --ink: #e2eaee; --muted: #93a3ad; --line: #22323b;
    --accent: #2cc5b0; --accent-ink: #062521; --accent-soft: #123a35; --old: #4d5d67;
    --ok: #4ade80; --ok-bg: #0f2e1c; --warn: #f5b04c; --warn-bg: #33240c; --bad: #f87171; --bad-bg: #3a1514;
    --code: #0f181d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--sans); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: .95rem; font-weight: 600; }
a { color: var(--accent); }
.mono { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { margin: 0 0 .2rem; font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }
.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-block: 14px 4px; }
.who { display: flex; gap: 14px; align-items: center; font-size: .9rem; color: var(--muted); }

main.wrap { padding-block: 22px 48px; }
.panel { display: grid; gap: 18px; }

/* Tabs under the header */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs [role="tab"] { font: inherit; font-size: .93rem; font-weight: 500; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px 11px; cursor: pointer; white-space: nowrap; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card > h3 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head.sub { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; }

/* Hero: place + map */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 22px; padding: 0; overflow: hidden; }
.hero-text { padding: 22px 0 20px 22px; }
.place { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 600; letter-spacing: -.01em; margin-bottom: 16px; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0 0 14px; }
.facts dt { font-size: .75rem; color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.map { min-height: 300px; border-left: 1px solid var(--line); }
.map iframe { width: 100%; height: 100%; min-height: 300px; border: 0; display: block; }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; }
  .hero-text { padding: 20px 20px 0; }
  .map { border-left: 0; border-top: 1px solid var(--line); }
}

/* Spec lists */
.spec { margin: 0; display: grid; }
.spec > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.spec > div:last-child { border-bottom: 0; }
.spec dt { color: var(--muted); font-size: .88rem; }
.spec dd { margin: 0; overflow-wrap: anywhere; }

/* Buttons */
.btn { font: inherit; font-weight: 500; border: 0; border-radius: 8px; padding: 9px 18px; background: var(--accent); color: var(--accent-ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .65; cursor: default; }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn:focus-visible, button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Test results */
.status { min-height: 1.5em; margin: 0 0 8px; }
table { border-collapse: collapse; width: 100%; }
.res th, .res td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.res th { font-weight: 500; color: var(--muted); width: 34%; }
.res td:nth-child(2) { font-family: var(--mono); font-size: .9rem; font-variant-numeric: tabular-nums; }
.res td:last-child { text-align: right; white-space: nowrap; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 500; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.warn { color: var(--warn); background: var(--warn-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }

.compare { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) 4.5rem; align-items: center; gap: 10px; font-size: .9rem; }
.bar { height: 12px; background: var(--code); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .6s ease; }
.bar.old i { background: var(--old); }
.bar-val { text-align: right; }

.trace { background: var(--code); border-radius: 8px; padding: 14px; overflow-x: auto; font: .82rem/1.5 var(--mono); margin: 12px 0 0; white-space: pre; }

/* Admin tables */
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
input { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 0; flex: 1 1 180px; }
.table-wrap { overflow-x: auto; }
.list th, .list td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: .88rem; vertical-align: top; white-space: nowrap; }
.list th { color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.list tr.off td { opacity: .5; }
.link-copy, .link-toggle { font: inherit; font-size: .85rem; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; }

/* Price comparison modal */
.modal { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: var(--surface); color: var(--ink); }
.modal::backdrop { background: rgba(10, 18, 22, .55); }
.modal > * + * { margin-top: 12px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-x { font: inherit; font-size: 1.5rem; line-height: 1; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.modal-x:hover { background: var(--code); color: var(--ink); }
.prices { min-width: 560px; }
.prices th, .prices td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.prices thead th { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.prices tbody tr:last-child td { border-bottom: 0; }
.prices .r { text-align: right; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.prices thead .r { font-family: var(--sans); }
.prices .size { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.prices tr.ours td { background: var(--accent-soft); font-weight: 600; }
.prices tr.ours .size { font-weight: 400; }
.ssd { color: var(--bad); font-weight: 600; }

/* Spinner */
.ring { width: 13px; height: 13px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; vertical-align: -2px; margin-right: 7px; animation: spin .8s linear infinite; }
.ring.light { border-color: rgba(255,255,255,.35); border-top-color: var(--accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ring { animation-duration: 3s; } .bar i { transition: none; } }

/* Login */
body.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-box { width: min(100%, 360px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; gap: 10px; }
.login-box h1 { font-size: 1.6rem; }
.login-box form { display: grid; gap: 8px; margin-top: 6px; }
.login-box label { font-size: .85rem; color: var(--muted); }
.login-box .btn { justify-content: center; margin-top: 4px; }
.error { color: var(--bad); background: var(--bad-bg); padding: 8px 12px; border-radius: 8px; margin: 0; }
