/* ==========================================================================
   Cloud-Browser Panel — einfaches, responsives Design (Dark Mode)
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Wichtig: Elemente mit hidden-Attribut IMMER ausblenden — sonst würde
   z.B. unser display:flex das hidden überschreiben und der Platzhalter
   läge unsichtbar über dem Stream und würde Klicks/Touch abfangen! */
[hidden] { display: none !important; }

:root {
  --hintergrund: #12151c;
  --flaeche: #1c212c;
  --rand: #2c3342;
  --text: #e6e9f0;
  --text-gedimmt: #8b93a5;
  --akzent: #3b82f6;
  --gefahr: #dc2626;
  --gruen: #22c55e;
  --gelb: #eab308;
  --rot: #6b7280;
}

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--hintergrund);
  color: var(--text);
}

/* --- Login-Seite ---------------------------------------------------------- */

.login-seite {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-box {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}

.login-box h1 { font-size: 1.4rem; margin-bottom: 1.5rem; text-align: center; }

.login-box label { display: block; margin-bottom: .4rem; color: var(--text-gedimmt); }

.login-box input {
  width: 100%;
  padding: .7rem .9rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid var(--rand);
  background: var(--hintergrund);
  color: var(--text);
  font-size: 1rem;
}

.login-box .btn { width: 100%; }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  padding: .6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--rand);
  background: var(--flaeche);
  color: var(--text);
  font-size: .95rem;
  cursor: pointer;
  /* Touch-freundlich: keine 300ms-Verzögerung, ausreichend große Fläche */
  touch-action: manipulation;
  min-height: 42px;
}

.btn:hover { border-color: var(--akzent); }
.btn:disabled { opacity: .5; cursor: default; }

.btn-primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.btn-gefahr { background: var(--gefahr); border-color: var(--gefahr); color: #fff; }
.btn-klein { padding: .3rem .7rem; font-size: .85rem; min-height: 34px; }

/* --- Dashboard: Kopfleiste ------------------------------------------------- */

.dashboard-seite {
  display: flex;
  flex-direction: column;
  height: 100dvh; /* dvh: berücksichtigt mobile Browserleisten */
}

.leiste {
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
  padding: .6rem .8rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.leiste-zeile {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap; /* auf schmalen Bildschirmen umbrechen */
}

.titel { font-weight: 600; }

#logout { margin-left: auto; }

.status-punkt {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--rot);
  display: inline-block;
}
.status-punkt.gruen { background: var(--gruen); box-shadow: 0 0 6px var(--gruen); }
.status-punkt.gelb  { background: var(--gelb); }
.status-punkt.rot   { background: var(--rot); }

.status-text { color: var(--text-gedimmt); font-size: .9rem; }

.modus-schalter { display: flex; }
.modus-schalter .modus-btn { border-radius: 0; }
.modus-schalter .modus-btn:first-child { border-radius: 8px 0 0 8px; }
.modus-schalter .modus-btn:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.modus-btn.aktiv { background: var(--akzent); border-color: var(--akzent); color: #fff; }

.profil-schalter {
  display: flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-gedimmt);
  font-size: .9rem;
  cursor: pointer;
}
.profil-schalter input { width: 18px; height: 18px; }

.fehlermeldung { color: #f87171; font-size: .9rem; }

/* --- Stream-Bereich -------------------------------------------------------- */

.stream-bereich {
  flex: 1;
  position: relative;
  background: #000;
  /* Wichtig für Touch: keine Overlays, kein pointer-events-Gefummel —
     das iframe bekommt alle Eingaben direkt. */
}

.stream {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.platzhalter {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--text-gedimmt);
}

.platzhalter .hinweis { font-size: .85rem; }

/* --- Laufender Browser: Bedienung eindampfen ------------------------------- */

/* Modus + Profil sind nur VOR dem Start relevant — bei laufendem Browser
   ausblenden, damit (vor allem am Handy) mehr Platz für den Stream bleibt */
.laeuft .modus-schalter,
.laeuft .profil-schalter { display: none; }

/* --- Pseudo-Vollbild (iPhone: kein echtes Vollbild möglich) ---------------- */

.pseudo-vollbild .leiste { display: none; }

.vollbild-exit {
  display: none;
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(28, 33, 44, .75);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}

/* Nur im Pseudo-Vollbild einblenden — sonst liegt nichts über dem Stream */
.pseudo-vollbild .vollbild-exit {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Scroll-Knöpfe --------------------------------------------------------- */

.scroll-btn {
  display: none;
  position: absolute;
  right: 8px;
  z-index: 10;
  width: 44px;
  height: 44px;
  border: 1px solid var(--rand);
  border-radius: 50%;
  background: rgba(28, 33, 44, .7);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  touch-action: none;    /* Halten soll scrollen, nicht die Seite bewegen */
  user-select: none;
}

.scroll-hoch   { top: 42%; }
.scroll-runter { top: calc(42% + 54px); }

/* Nur anzeigen, wenn der Browser läuft */
.laeuft .scroll-btn { display: flex; align-items: center; justify-content: center; }

/* --- Schmale Bildschirme (Handy) ------------------------------------------ */

@media (max-width: 600px) {
  .leiste { padding: .5rem; }
  .status-text { font-size: .8rem; }
  .btn { font-size: .85rem; padding: .5rem .7rem; }
}
