/* ════════════════════════════════════════════════════════════════════════════
   AppRobotWebcam – gemeinsames Theme für Viewer (index.html) und Konfiguration
   (config.html). Haus-Stil: helle Fläche, system-ui, weiche Karten mit Schatten,
   dunkler Blur-Header. Video-/Bildflächen bleiben bewusst dunkel (Kontrast).
   ════════════════════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #f5f6f8;
  color: #1c1e21;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
header {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 10;
  color: #fff;
  background: rgba(20, 22, 26, 0.85);
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
header .logo { font-weight: bold; letter-spacing: 0.03em; }
header .status { font-size: 0.85rem; color: rgba(255, 255, 255, 0.6); 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: #fff;
  padding: 8px 12px; border-radius: 6px;
  font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: none;
}
.hbtn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.hbtn:disabled { opacity: 0.4; cursor: default; }
.hbtn.primary { background: rgba(80, 180, 120, 0.30); }
.hbtn.primary:hover:not(:disabled) { background: rgba(80, 180, 120, 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: #11131a;                 /* dunkle Karte für das Bild */
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

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

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

/* 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: #d8d8d8;
}
.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: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18); 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: #8cf; }
.cam-toggle:hover { background: rgba(60, 60, 60, 0.85); }
.cam-hdtest:hover:not(:disabled) { background: rgba(40, 60, 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.7);
}

/* ── Karte / Tabelle (config.html) ───────────────────────────────────────── */
.card {
  background: #fff; border-radius: 10px; padding: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); 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 #eceef1; }
th { color: #65676b; font-weight: 600; }
tr:last-child td { border-bottom: none; }

select {
  font: inherit; padding: 6px 10px;
  border: 1px solid #ccd0d5; border-radius: 6px; background: #fff; cursor: pointer;
}
.warn-badge { color: #e08500; cursor: help; }
.cur { color: #8a8d91; }

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

#status { font-size: 0.85rem; color: #65676b; }
#status.ok  { color: #2e7d46; }
#status.err { color: #c0392b; }

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