/* heimdall-cloud — dark theme matching heimdall-sky aesthetic */
:root {
  --bg-0: #0b0e14;
  --bg-1: #11151c;
  --bg-2: #1a1f29;
  --bg-3: #232a36;
  --line: #2a313e;
  --line-strong: #3a4252;
  --text-0: #e6e8eb;
  --text-1: #b6bcc7;
  --text-2: #7e8694;
  --accent: #6cb6ff;       /* light azure (heimdall-sky vibe) */
  --accent-2: #8ce0c0;
  --warn: #f5a25b;
  --bad: #e57373;
  --good: #87d49e;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg-0); color: var(--text-0); font-family: var(--sans); font-size: 14px; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 6px; color: var(--bg-0);
  font-weight: 700; display: grid; place-items: center;
  font-family: var(--mono); font-size: 16px;
}
.brand-text { font-weight: 600; letter-spacing: 0.4px; }

.topbar-status { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-2);
  box-shadow: 0 0 0 2px transparent;
}
.status-dot.ok { background: var(--good); box-shadow: 0 0 8px rgba(135, 212, 158, 0.5); }
.status-dot.bad { background: var(--bad); }

/* ---- Layout ---- */
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 260px;
  flex: 0 0 auto;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  padding: 16px 0;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-section { padding: 0 12px 12px; }
.sidebar-bottom { margin-top: auto; }
.sidebar-title {
  text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px;
  color: var(--text-2); padding: 4px 6px 8px;
}
.muted { color: var(--text-2); font-size: 11px; padding: 4px 6px; }

.camera-list { list-style: none; margin: 0; padding: 0; }
.camera-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.camera-list li:hover { background: var(--bg-2); }
.camera-list li.active { background: var(--bg-3); }
.cam-name { font-weight: 500; }
.cam-state {
  font-family: var(--mono); font-size: 11px;
  display: flex; align-items: center; gap: 6px;
  color: var(--text-2);
}
.cam-state .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-2);
}
.cam-state .dot.live { background: var(--good); box-shadow: 0 0 6px rgba(135, 212, 158, 0.5); }
.cam-state .dot.off { background: var(--text-2); }
.cam-state .dot.stale { background: var(--warn); }

/* ---- Content area ---- */
.content { flex: 1; min-width: 0; padding: 18px 24px; overflow-y: auto; }
.empty-state {
  display: grid; place-items: center; height: 100%; color: var(--text-2);
  text-align: center;
}
.empty-title { font-size: 18px; margin-bottom: 6px; }
.empty-hint { font-size: 13px; color: var(--text-2); }

.cam-page { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }
@media (max-width: 980px) { .cam-page { grid-template-columns: 1fr; } }

.cam-header {
  display: flex; align-items: baseline; justify-content: space-between;
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 6px;
}
.cam-title { font-size: 22px; font-weight: 600; }
.cam-meta { color: var(--text-2); font-family: var(--mono); font-size: 12px; }
.cam-meta strong { color: var(--text-0); font-weight: 500; }

.preview-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.preview-frame { display: block; width: 100%; height: auto; background: black; }
.preview-empty {
  display: grid; place-items: center; aspect-ratio: 1/1; color: var(--text-2);
  background: var(--bg-1);
}
.preview-stats {
  display: flex; gap: 14px; padding: 8px 12px;
  font-family: var(--mono); font-size: 12px;
  border-top: 1px solid var(--line); color: var(--text-1);
}
.preview-stats .k { color: var(--text-2); margin-right: 4px; }

/* ---- Settings panel ---- */
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 6px; margin-bottom: 14px; }
.panel-title {
  text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px;
  color: var(--text-2); margin: -2px 0 12px;
}
.panel-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.panel-row + .panel-row { border-top: 1px dashed var(--line); }
.panel-label {
  display: flex; flex-direction: column;
  font-size: 13px; font-weight: 500;
}
.panel-label small { color: var(--text-2); font-weight: 400; font-size: 11px; }
.panel-row input[type=text],
.panel-row input[type=number],
.panel-row select {
  background: var(--bg-2); color: var(--text-0);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 5px 8px; font-family: var(--mono); font-size: 13px;
  min-width: 140px;
}
.panel-row input[type=range] { width: 200px; }
.panel-row input:disabled { opacity: 0.5; }

/* Toggle switch */
.toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--bg-3); border-radius: 22px; transition: 0.2s;
}
.toggle .slider::before {
  content: ""; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--text-1); border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(16px); background: white; }

/* Buttons */
.btn {
  padding: 7px 14px;
  background: var(--bg-2); color: var(--text-0);
  border: 1px solid var(--line); border-radius: 5px;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-strong); }
.btn-primary { background: var(--accent); color: var(--bg-0); border-color: var(--accent); }
.btn-primary:hover { background: #8cc6ff; border-color: #8cc6ff; }
.btn-warn { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn-warn:hover { background: rgba(245, 162, 91, 0.1); }

.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Number value next to slider */
.num-display { display: inline-block; min-width: 56px; padding-left: 10px; font-family: var(--mono); color: var(--text-1); }
