/* Server104 Hub: één stylesheet voor de hub en de uitleenpagina's. */

:root {
  color-scheme: light;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --text: #14181f;
  --muted: #5b6575;
  --border: #dde1e9;
  --accent: #3b6df0;
  --accent-text: #ffffff;
  --accent-soft: #e7edfe;
  --ok: #14683d;
  --ok-soft: #e3f5ea;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --warn: #8a5200;
  --warn-soft: #fff1d6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 6px 18px rgba(16, 24, 40, .05);
}

/* Donker volgens de systeeminstelling, tenzij je met de knop licht hebt gekozen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1117;
    --surface: #171b23;
    --text: #e8ebf1;
    --muted: #98a2b3;
    --border: #262c38;
    --accent: #86a8ff;
    --accent-text: #0e1117;
    --accent-soft: #1d2848;
    --ok: #6fdba5;
    --ok-soft: #12301f;
    --bad: #ff9a90;
    --bad-soft: #3a1714;
    --warn: #f5c26b;
    --warn-soft: #35280e;
    --shadow: none;
  }
}

/* Handmatig gekozen donkere modus (dezelfde kleuren als hierboven). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1117;
  --surface: #171b23;
  --text: #e8ebf1;
  --muted: #98a2b3;
  --border: #262c38;
  --accent: #86a8ff;
  --accent-text: #0e1117;
  --accent-soft: #1d2848;
  --ok: #6fdba5;
  --ok-soft: #12301f;
  --bad: #ff9a90;
  --bad-soft: #3a1714;
  --warn: #f5c26b;
  --warn-soft: #35280e;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 40px 16px 48px;
}

a { color: var(--accent); }
h1 { margin: 0; font-size: clamp(1.7rem, 5vw, 2.4rem); letter-spacing: -0.02em; line-height: 1.15; }
h2 { margin: 0 0 12px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.muted { color: var(--muted); }
.tagline { margin: 6px 0 0; color: var(--muted); font-size: 1.05rem; }
.note { margin: 24px 0 0; color: var(--muted); font-size: .88rem; }
.empty { padding: 28px 0; color: var(--muted); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Kop en account ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 24px;
  margin-bottom: 28px;
}

.account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  font-size: .95rem;
}
.account form { margin: 0; }

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 20px;
}
.topbar .brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: .95rem; }
.topbar form { margin: 0; }
.topbar + main { padding-top: 28px; }

/* ---------- Knoppen ---------- */

button,
.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  cursor: pointer;
}
button:hover,
.btn:hover { filter: brightness(1.06); }

.btn.secondary,
button.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: 400;
}
button.link:hover { text-decoration: underline; filter: none; }

/* ---------- Statusbolletjes en labels ---------- */

.summary { min-height: 1.5em; margin: 0 0 20px; color: var(--muted); font-size: .95rem; }
.summary strong { color: var(--text); }

.badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.badge,
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.badge.busy { background: var(--warn-soft); border-color: transparent; color: var(--warn); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.status[data-state="up"] { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.status[data-state="up"] .dot { background: var(--ok); }
.status[data-state="down"] { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.status[data-state="down"] .dot { background: var(--bad); }
.status[data-state="checking"] .dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Kaarten ---------- */

.group { margin-bottom: 28px; }

.grid {
  display: grid;
  /* auto-fill: een categorie met één kaart houdt de normale kaartbreedte. */
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
a.card:hover { transform: translateY(-2px); border-color: var(--accent); }

.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }

.icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
.icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card strong { font-size: 1.1rem; }
.card .desc { color: var(--muted); font-size: .95rem; }
.card .host {
  margin-top: 10px;
  color: var(--muted);
  font: .8rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.copyrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.copyrow code,
code {
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: .9rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.copy { padding: 6px 12px; font-size: .9rem; }

/* ---------- Formulieren ---------- */

label { display: block; margin: 14px 0 4px; font-weight: 600; font-size: .95rem; }
input[type="text"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="number"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
.helptext,
.field-help { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.form-error,
.errorlist { margin: 6px 0 0; padding: 0; list-style: none; color: var(--bad); font-size: .9rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

.login { max-width: 380px; margin: 8vh auto 0; }
.login-form { margin-top: 20px; padding: 8px 20px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.login-form .primary { width: 100%; margin-top: 20px; }

/* ---------- Meldingen ---------- */

.messages { margin: 0 0 20px; padding: 0; list-style: none; }
.messages li { margin-bottom: 8px; padding: 10px 14px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.messages li.error { background: var(--bad-soft); color: var(--bad); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }

/* ---------- Uitleen ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 260px; }
.search input { flex: 1 1 180px; width: auto; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tabs a {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
}
.tabs a[aria-current="page"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }

.items { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
a.item:hover { border-color: var(--accent); }
.item strong { display: block; font-size: 1.05rem; }
.item .where { color: var(--muted); font-size: .9rem; }

.panel { margin-bottom: 20px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.panel h2 { margin-bottom: 8px; }
.panel form { margin: 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.history { margin: 0; padding: 0; list-style: none; }
.history li { padding: 12px 0; border-top: 1px solid var(--border); }
.history li:first-child { border-top: 0; padding-top: 0; }
.history .when { color: var(--muted); font-size: .88rem; }
.history .quote { margin-top: 2px; color: var(--muted); font-size: .9rem; }

@media (max-width: 520px) {
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  a.card:hover { transform: none; }
  .status[data-state="checking"] .dot { animation: none; }
}

/* ---------- Diensten beheren ---------- */

.manage-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; margin-bottom: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.manage-row .where { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.manage-row .actions { display: flex; gap: 8px; }
.manage-row.off { opacity: .6; }
.checkbox-field { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-field label { margin: 0; }
button.danger { background: var(--bad); color: var(--accent-text); }
