/*
  DL2CC Web Configuration - styles
  Clean, dense, dark UI suitable for a configuration tool.
  No framework, no build step.
*/

:root {
  --bg: #14181d;
  --panel: #1d242c;
  --card: #232c35;
  --line: #34404c;
  --text: #e6edf3;
  --muted: #8b98a5;
  --accent: #2f9e6e;
  --accent-hi: #3ab981;
  --danger: #c0493b;
  --danger-hi: #d65a4b;
  --warn: #c9942f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand h1 { font-size: 18px; margin: 0; }
.brand .subtitle { font-size: 12px; color: var(--muted); }

.conn-summary { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge.off { background: #3a2a2a; color: #e8a39a; }
.badge.on  { background: #243a30; color: #7fe0b0; }

.muted { color: var(--muted); font-size: 12px; }
.mono  { font-family: "Cascadia Mono", Consolas, monospace; }

.warning-bar {
  background: var(--warn);
  color: #1a1205;
  padding: 8px 20px;
  font-weight: 600;
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--panel);
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding: 18px; max-width: 1100px; margin: 0 auto; }

.panel { display: none; }
.panel.active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }

.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

input[type=text], input[type=password], input[type=number], input:not([type]), select {
  width: 100%;
  background: #161c22;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}
input:disabled, select:disabled { opacity: 0.45; }
input:focus, select:focus { outline: 1px solid var(--accent); }

.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.row input { flex: 1; min-width: 160px; }

button {
  background: #2c3742;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
button:hover:not(:disabled) { background: #36434f; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover:not(:disabled) { background: var(--accent-hi); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.danger:hover:not(:disabled) { background: var(--danger-hi); }

/* Toggle switch */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  cursor: pointer;
  user-select: none;
}
.switch input { display: none; }
.switch .slider {
  position: relative;
  width: 40px; height: 22px;
  background: #3a4651;
  border-radius: 22px;
  flex: none;
  transition: background .15s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #cfd8e0;
  border-radius: 50%;
  transition: transform .15s;
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: 0.4; }
.switch .lbl { font-size: 13px; }

.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--muted); }

table.grid { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
table.grid th, table.grid td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.grid th { color: var(--muted); font-weight: 600; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: #2b343d; }

.notice {
  background: #3a2f1a;
  border: 1px solid var(--warn);
  color: #f0d9a8;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  grid-column: 1 / -1;
}

.log {
  background: #0f1318;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 380px;
  overflow-y: auto;
  margin: 0;
  padding: 10px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}
.log .tx { color: #6fd0a0; }
.log .rx { color: #cfd8e0; }
.log .sys { color: var(--muted); font-style: italic; }
.log .err { color: #e8a39a; }

code { background: #0f1318; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

#fwStatus { margin: 0 0 4px; font-size: 13px; }
#fwStatus.fw-outdated { color: #f0b86b; font-weight: 600; }
#fwStatus.fw-ok { color: #7fe0b0; }

/* ── Legal footer ────────────────────────────────────────────────
   Links to the shared bilingual legal pages. This tool's UI is
   English-only, so the links carry no ?lang= — the legal page
   auto-detects the browser language and still offers an EN/DE
   toggle, so a German visitor can read it in German. */
.legal-footer {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}
.legal-footer a, .legal-footer a:visited { color: inherit; text-decoration: none; }
.legal-footer a:hover { text-decoration: underline; }
.legal-footer .sep { color: var(--line); }
.legal-footer .copy { margin-left: auto; }
@media (max-width: 600px) {
  .legal-footer .copy { margin-left: 0; flex-basis: 100%; }
}
