/* ===== Dark Theme (default) ===== */
:root,
[data-theme="dark"] {
  --bg: #12151d;
  --surface: #191e29;
  --surface2: #222939;
  --border: #2a3245;
  --text: #e8ecf4;
  --muted: #8b95a8;
  --green: #3ddc97;
  --greenSoft: rgba(61,220,151,0.12);
  --red: #ff6b6b;
  --redSoft: rgba(255,107,107,0.12);
  --amber: #f5b14c;
  --amberSoft: rgba(245,177,76,0.14);

  --accent: #6c7cff;
  --accentSoft: rgba(108,124,255,0.13);
}

/* ===== Accent Color Variants ===== */
[data-accent="indigo"]  { --accent: #6c7cff; --accentSoft: rgba(108,124,255,0.13); }
[data-accent="blue"]    { --accent: #3b82f6; --accentSoft: rgba(59,130,246,0.13); }
[data-accent="green"]   { --accent: #22c55e; --accentSoft: rgba(34,197,94,0.13); }
[data-accent="purple"]  { --accent: #a855f7; --accentSoft: rgba(168,85,247,0.13); }
[data-accent="rose"]    { --accent: #ef4466; --accentSoft: rgba(239,68,102,0.13); }

/* ===== Light Theme ===== */
[data-theme="light"] {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface2: #eef1f6;
  --border: #dfe4ee;
  --text: #1b2332;
  --muted: #66708a;
  --green: #16a36a;
  --greenSoft: rgba(22,163,106,0.12);
  --red: #dc4444;
  --redSoft: rgba(220,68,68,0.10);
}

/* ===== Base Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 15px;
  zoom: 1.25;
}
html[data-text-size="small"]  { zoom: 1.1; }
html[data-text-size="normal"] { zoom: 1.25; }
html[data-text-size="large"]  { zoom: 1.4; }
html[data-text-size="xlarge"] { zoom: 1.6; }
body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

.mono { font-family: 'IBM Plex Mono', monospace; }

/* ===== Topbar ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  height: 54px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
  overflow-x: auto;
}
.topbar-logo { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar-logo-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--accentSoft);
  display: grid;
  place-items: center;
  flex: none;
}
.topbar-brand { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; white-space: nowrap; }
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav a {
  font-size: 13.5px;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.topbar-nav a:hover { color: var(--text); }
.topbar-nav a.active { background: var(--accentSoft); color: var(--text); font-weight: 600; }
.topbar-spacer { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.topbar-scan-time { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.topbar-scan-time .mono { color: var(--text); }

/* ===== Buttons ===== */
.btn-theme-toggle {
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.btn-theme-toggle:hover { color: var(--text); border-color: var(--muted); }
.btn-scan {
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: opacity 0.12s;
}
.btn-scan:hover { opacity: 0.9; }
.btn-scan:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline {
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  transition: border-color 0.12s;
}
.btn-outline:hover { border-color: var(--accent); }
.btn-outline-danger { color: var(--red); border-color: var(--redSoft); }
.btn-outline-danger:hover { border-color: var(--red); }
.btn-accent {
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  transition: opacity 0.12s;
}
.btn-accent:hover { opacity: 0.9; }
.btn-accent:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-body { padding: 16px; }

/* ===== Badge/Pill ===== */
.badge { font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 5px; display: inline-block; }
.badge-lxc { background: var(--accentSoft); color: var(--accent); }
.badge-vm { background: var(--amberSoft); color: var(--amber); }
.badge-proxmox { background: var(--amberSoft); color: var(--amber); }
.badge-green { background: var(--greenSoft); color: var(--green); }
.badge-red { background: var(--redSoft); color: var(--red); }
.badge-muted { background: var(--surface2); color: var(--muted); }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.pill-accent { background: var(--accentSoft); color: var(--accent); }

/* ===== Status Dot ===== */
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-sm { width: 6px; height: 6px; }
.dot-lg { width: 9px; height: 9px; }

/* ===== Page Layout ===== */
.page { width: 100%; padding: 24px 32px 48px; }
.page-title { display: flex; align-items: baseline; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.page-title .subtitle { font-size: 12.5px; color: var(--muted); }

/* ===== Toggle Switch ===== */
.toggle { width: 38px; height: 22px; border-radius: 20px; border: none; cursor: pointer; position: relative; flex: none; background: var(--border); transition: background 0.15s; }
.toggle.on { background: var(--accent); }
.toggle .knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.toggle.on .knob { left: 19px; }

/* ===== Segmented Buttons ===== */
.seg-group { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-btn {
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 13px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  transition: all 0.12s;
}
.seg-btn.active { border-color: var(--accent); background: var(--accentSoft); color: var(--text); font-weight: 600; }

/* ===== Settings Layout ===== */
.settings-layout { display: flex; gap: 16px; align-items: flex-start; }
.settings-sidebar { width: 210px; flex: none; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.settings-tab-btn {
  text-align: left;
  font-size: 13.5px;
  cursor: pointer;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 400;
  transition: background 0.12s, color 0.12s;
}
.settings-tab-btn:hover { color: var(--text); }
.settings-tab-btn.active { background: var(--accentSoft); color: var(--text); font-weight: 600; }
.settings-content { flex: 1; min-width: 0; }
.settings-row { display: flex; align-items: center; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-label { font-size: 13.5px; font-weight: 600; }
.settings-row-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ===== Input ===== */
.input {
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  outline: none;
  transition: border-color 0.12s;
  width: 100%;
}
.input:focus { border-color: var(--accent); }
.input-mono { font-family: 'IBM Plex Mono', monospace; }
label.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

/* ===== Chip ===== */
.chip { font-size: 12px; color: var(--muted); background: var(--surface2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 6px; display: inline-block; }

/* ===== Swatch (accent picker) ===== */
.swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: none; transition: box-shadow 0.12s; }
.swatch.selected { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; }

/* ===== Hover ===== */
@media (hover: hover) {
  .host-card:hover { border-color: var(--accent); }
  .host-row:hover { background: var(--surface2); }
}

/* ===== Accordion (SSH creds / node forms) ===== */
.accordion-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.accordion-item:last-child { margin-bottom: 0; }
.accordion-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; cursor: pointer; gap: 12px; }
.accordion-header:hover { background: var(--surface2); }
.accordion-body { display: none; padding: 14px; background: var(--surface2); border-top: 1px solid var(--border); }
.accordion-item.open .accordion-body { display: block; }
.accordion-item.open .chevron { transform: rotate(180deg); }
.chevron { transition: transform 0.15s; color: var(--muted); font-size: 11px; }

/* ===== Alert / toast ===== */
.toast-success {
  background: var(--greenSoft);
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ===== Scan progress card ===== */
#scan-progress {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 280px;
  z-index: 50;
}
