/* ════════════════════════════════════════════════════════════════════════════
   AppRobotWebcam – gemeinsames Theme für Viewer (index.html) und Konfiguration
   (config.html). Haus-Stil: dunkler Verlauf-Hintergrund, navyblaue Karten,
   hellblauer Akzent – passend zum AppRobot-Control-Panel-Design.
   ════════════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: linear-gradient(135deg, #5e7080 0%, #8fa2b2 45%, #5e7080 100%);
  min-height: 100vh;
  color: #c8d8e8;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 10;
  background: #0c1824;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
header .logo { font-weight: bold; letter-spacing: 0.03em; color: #7ec8e3; }
header .status { font-size: 0.85rem; color: rgba(180, 210, 235, 0.55); margin-right: auto; }

.ml-auto { margin-left: auto; }

/* Buttons / Links im Header */
.hbtn {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  background: transparent; border: none; color: #c8d8e8;
  padding: 8px 12px; border-radius: 6px;
  font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: none;
}
.hbtn:hover:not(:disabled) { background: rgba(100, 160, 220, 0.18); }
.hbtn:disabled { opacity: 0.4; cursor: default; }
.hbtn.primary { background: rgba(60, 160, 100, 0.30); color: #a8e8c0; }
.hbtn.primary:hover:not(:disabled) { background: rgba(60, 160, 100, 0.48); }

main { padding: 20px; }

/* ── Kamera-Grid (index.html) ────────────────────────────────────────────── */
#cameras {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.cam-box {
  position: relative;
  background: #0d1b2e;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(80, 140, 200, 0.18);
}

/* Live-MJPEG bzw. Snapshot-Bild – responsiv */
.cam-img {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  background: #07101a; object-fit: contain;
}

.cam-label {
  position: absolute; top: 8px; left: 10px; z-index: 2;
  background: rgba(0, 0, 0, 0.65); padding: 3px 9px; border-radius: 6px;
  font-size: 0.75rem; color: #9abcd6;
}

/* Health-Anzeige unten links */
.cam-info {
  position: absolute; bottom: 8px; left: 10px; z-index: 2;
  background: rgba(0, 0, 0, 0.6); padding: 3px 9px; border-radius: 6px;
  font-size: 0.72rem; color: #7a9ab8;
}
.cam-info.ok   { color: #7ee29a; }
.cam-info.warn { color: #ffc861; }
.cam-info.crit { color: #ff8080; }

/* Ein/Aus-Schalter + HD-Button (über dem Bild) */
.cam-toggle, .cam-hdtest {
  position: absolute; top: 8px; z-index: 2;
  background: rgba(0, 0, 0, 0.55); color: #c8d8e8;
  border: 1px solid rgba(80, 140, 200, 0.3); border-radius: 6px;
  font: inherit; cursor: pointer; backdrop-filter: blur(2px);
}
.cam-toggle { right: 10px; width: 30px; height: 26px; font-size: 0.72rem; }
.cam-hdtest { right: 48px; height: 26px; padding: 0 9px; font-size: 0.72rem; color: #7ec8e3; }
.cam-toggle:hover { background: rgba(30, 60, 100, 0.85); }
.cam-hdtest:hover:not(:disabled) { background: rgba(20, 50, 90, 0.85); }
.cam-hdtest:disabled { opacity: 0.4; cursor: default; }

/* Snapshot-Modus: gross + fett über dem Einzelbild */
.single-pic-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  text-align: center; padding: 8px 4px;
  font-size: 1.1rem; font-weight: bold; letter-spacing: 0.06em; text-transform: uppercase;
  color: #ffcf6b; background: rgba(0, 0, 0, 0.75);
}

/* ── Karte / Tabelle (config.html) ───────────────────────────────────────── */
.card {
  background: #0d1b2e;
  border: 1px solid rgba(80, 140, 200, 0.2);
  border-radius: 10px; padding: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); max-width: 760px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid rgba(80, 140, 200, 0.12); }
th { color: #7ec8e3; font-weight: 600; }
td { color: #c8d8e8; }
tr:last-child td { border-bottom: none; }

select {
  font: inherit; padding: 6px 10px;
  border: 1px solid rgba(80, 140, 200, 0.35); border-radius: 6px;
  background: #152538; color: #c8d8e8; cursor: pointer;
}
.warn-badge { color: #ffc861; cursor: help; }
.cur { color: #5a7a9a; }

.actions { margin-top: 18px; display: flex; align-items: center; gap: 14px; }
.btn-primary {
  background: #1a5a8a; color: #e0f0ff; border: none; border-radius: 6px;
  padding: 9px 18px; font: inherit; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: #1e6aa0; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

#status { font-size: 0.85rem; color: #7a9ab8; }
#status.ok  { color: #7ee29a; }
#status.err { color: #ff8080; }

.hint {
  margin-top: 18px; max-width: 760px;
  font-size: 0.8rem; color: #5a7a9a; line-height: 1.6;
}
