/* screenroom.css – Guggli Screen Share Room v2.2 */

#screenroom-wrap {
  display: flex;
  height: calc(100vh - 60px);
  overflow: hidden;
  background: #111;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sr-sidebar {
  width: 210px;
  min-width: 180px;
  background: #1a1a1a;
  border-right: 1px solid rgba(255,255,255,.07);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 10px 0;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.sr-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.sr-sidebar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #555;
  margin-bottom: 4px;
}

.sr-room-badge {
  background: rgba(229,57,53,.15);
  color: #ef9a9a;
  border: 1px solid rgba(229,57,53,.3);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}

.sr-back-link {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  color: #555;
  text-decoration: none;
  font-size: 12px;
  text-align: center;
  border: 1px solid rgba(255,255,255,.06);
}
.sr-back-link:hover { color: #aaa; border-color: rgba(255,255,255,.15); }

/* Peer-Liste */
.sr-peer-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 4px; border-radius: 6px;
  font-size: 12px; color: #bbb; transition: background .12s;
}
.sr-peer-item:hover { background: rgba(255,255,255,.05); }
.sr-peer-dot { width: 7px; height: 7px; border-radius: 50%; background: #4caf50; flex-shrink: 0; }
.sr-peer-dot.streaming { background: #e53935; }

/* ── Voice Panel ─────────────────────────────────────────── */
#sr-voice-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
#sr-voice-panel.sr-voice-active {
  background: rgba(76,175,80,.04);
  border-left: 2px solid rgba(76,175,80,.35);
}
#sr-voice-status { font-size: 11px; color: #555; margin-bottom: 2px; }

/* Voice Buttons */
.sr-voice-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 10px; border-radius: 8px; border: none;
  cursor: pointer; font-size: 12px; font-weight: 600;
  transition: background .15s, transform .1s; white-space: nowrap;
}
.sr-voice-btn:active { transform: scale(.97); }

#btn-voice-join        { background: rgba(76,175,80,.25);  color: #a5d6a7; border: 1px solid rgba(76,175,80,.35); }
#btn-voice-join:hover  { background: rgba(76,175,80,.4); }
#btn-voice-leave       { background: rgba(229,57,53,.25);  color: #ef9a9a; border: 1px solid rgba(229,57,53,.35); }
#btn-voice-leave:hover { background: rgba(229,57,53,.4); }

#btn-mute              { background: rgba(255,255,255,.1);  color: #ddd;    border: 1px solid rgba(255,255,255,.1); }
#btn-mute:hover        { background: rgba(255,255,255,.18); }
#btn-mute.sr-voice-muted { background: rgba(229,57,53,.25); color: #ef9a9a; border-color: rgba(229,57,53,.4); }

#btn-ptt               { background: rgba(33,150,243,.15);  color: #90caf9; border: 1px solid rgba(33,150,243,.3); }
#btn-ptt:hover         { background: rgba(33,150,243,.3); }
#btn-ptt.sr-voice-ptt-active { background: rgba(33,150,243,.3);  color: #bbdefb; }
#btn-ptt.sr-voice-ptt-held   { background: rgba(76,175,80,.55); color: #fff; border-color: #4caf50; box-shadow: 0 0 8px rgba(76,175,80,.5); }

/* Gate Button */
#btn-gate              { background: rgba(156,39,176,.15); color: #ce93d8; border: 1px solid rgba(156,39,176,.3); }
#btn-gate:hover        { background: rgba(156,39,176,.3); }
#btn-gate.sr-voice-gate-active { background: rgba(156,39,176,.35); color: #e1bee7; border-color: rgba(156,39,176,.6); box-shadow: 0 0 6px rgba(156,39,176,.3); }

/* Gate Controls (Slider) */
#gate-controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 10px;
  background: rgba(156,39,176,.08);
  border: 1px solid rgba(156,39,176,.2);
  border-radius: 8px;
  margin-top: 2px;
}

.sr-gate-label {
  font-size: 11px;
  color: #ce93d8;
  display: flex;
  justify-content: space-between;
}
.sr-gate-label span { font-weight: 700; }

.sr-gate-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(156,39,176,.3);
  outline: none;
  cursor: pointer;
}
.sr-gate-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ce93d8;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(156,39,176,.5);
}
.sr-gate-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ce93d8;
  cursor: pointer;
  border: none;
}

.sr-gate-hint {
  font-size: 9px;
  color: #7a5f8a;
  line-height: 1.4;
}

/* Voice Mitglieder */
#sr-voice-members { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.sr-voice-empty   { font-size: 11px; color: #444; font-style: italic; }

.sr-voice-member {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 6px; border-radius: 7px;
  background: rgba(255,255,255,.04);
  border: 1px solid transparent;
  transition: border-color .2s, background .2s, box-shadow .2s;
}
.sr-voice-member.speaking {
  border-color: rgba(76,175,80,.7);
  background: rgba(76,175,80,.12);
  box-shadow: 0 0 8px rgba(76,175,80,.3);
}
.sr-voice-member.speaking .sr-voice-avatar {
  animation: speak-pulse .6s ease-in-out infinite alternate;
  box-shadow: 0 0 0 2px rgba(76,175,80,.8);
}
@keyframes speak-pulse {
  from { box-shadow: 0 0 0 2px rgba(76,175,80,.6); }
  to   { box-shadow: 0 0 0 4px rgba(76,175,80,.9), 0 0 8px rgba(76,175,80,.4); }
}
.sr-voice-avatar {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #1976d2, #42a5f5);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
  transition: box-shadow .15s;
}
.sr-voice-name { flex: 1; font-size: 11px; color: #bbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-voice-icon { font-size: 12px; flex-shrink: 0; }

/* ── Hauptbereich ────────────────────────────────────────── */
#sr-main {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; min-width: 0; position: relative;
}

#sr-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #1a1a1a;
  border-bottom: 1px solid rgba(255,255,255,.07);
  gap: 12px; flex-shrink: 0;
}
.sr-title { margin: 0; font-size: 16px; font-weight: 700; color: #eee; }
.sr-title span { color: #f7b24b; }

#sr-toolbar {
  display: flex; gap: 12px; align-items: center;
  background: rgba(0,0,0,.35); padding: 7px 12px;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.07);
}

/* ── Stream Grid ─────────────────────────────────────────── */
.sr-stream-grid { flex: 1; display: flex; overflow: hidden; min-height: 0; }

.sr-layout-single { padding: 12px; }
.sr-layout-single .sr-tile { flex: 1; border-radius: 14px; }

.sr-layout-focus  { flex-direction: row; }
.sr-focus-wrap    { flex: 1; display: flex; padding: 10px 6px 10px 10px; min-width: 0; }
.sr-focus-wrap .sr-tile { flex: 1; border-radius: 12px; }

.sr-thumb-strip {
  width: 190px; min-width: 150px; max-width: 210px;
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 10px 10px 6px;
  overflow-y: auto; overflow-x: hidden;
  background: rgba(0,0,0,.2);
  border-left: 1px solid rgba(255,255,255,.05);
  scrollbar-width: thin;
}

/* ── Kacheln ─────────────────────────────────────────────── */
.sr-tile {
  position: relative; background: #000; overflow: hidden;
  display: flex; flex-direction: column;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.sr-tile-focus { border-radius: 12px; }
.sr-tile-thumb {
  border-radius: 9px; flex-shrink: 0; width: 100%; aspect-ratio: 16/9;
  border: 2px solid rgba(255,255,255,.06);
  transition: border-color .2s, box-shadow .2s;
}
.sr-tile-thumb:hover {
  border-color: rgba(33,150,243,.6);
  box-shadow: 0 0 0 2px rgba(33,150,243,.2);
}

.sr-tile-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  background: linear-gradient(to bottom, rgba(0,0,0,.75), transparent);
}
.sr-tile-badge {
  font-size: 9px; font-weight: 700; flex-shrink: 0;
  background: rgba(229,57,53,.85); padding: 2px 6px;
  border-radius: 999px; color: #fff; letter-spacing: .04em;
}
.sr-tile-badge.local { background: rgba(33,150,243,.85); }
.sr-tile-name {
  font-size: 11px; font-weight: 600; color: #eee; flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-tile-close {
  margin-left: auto; border: 0;
  background: rgba(255,255,255,.12); color: #fff;
  border-radius: 5px; width: 20px; height: 20px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.sr-tile-close:hover { background: rgba(229,57,53,.7); }
.sr-tile-pin {
  border: 0; background: rgba(255,255,255,.10); color: #bbb;
  border-radius: 5px; width: 20px; height: 20px; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  margin-left: auto; transition: background .15s;
}
.sr-tile-pin:hover { background: rgba(76,175,80,.5); color: #fff; }
.sr-tile video { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }

.sr-thumb-hint {
  position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%);
  background: rgba(33,150,243,.85); color: #fff;
  font-size: 10px; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; opacity: 0; transition: opacity .18s;
  pointer-events: none; white-space: nowrap;
}
.sr-tile-thumb:hover .sr-thumb-hint { opacity: 1; }

/* Leer-Hinweis */
#sr-empty-hint {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; color: #444; font-size: 15px; text-align: center;
  padding: 40px; pointer-events: none;
}
#sr-empty-hint strong { color: #666; }
.sr-empty-icon { font-size: 52px; opacity: .25; }

/* Toast */
#rtcToast {
  position: fixed; right: 16px; bottom: 16px;
  background: rgba(20,20,20,.95); color: #fff;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,.08);
  z-index: 10001; opacity: 0; transition: opacity .2s;
  font-size: 13px; pointer-events: none;
}
#rtcToast.err { background: rgba(120,20,20,.95); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 800px) {
  #screenroom-wrap  { flex-direction: column; }
  #sr-sidebar       { width: 100%; min-width: unset; flex-direction: row; flex-wrap: wrap; height: auto; overflow-y: visible; padding: 6px; }
  .sr-sidebar-section { border: none; padding: 6px 10px; }
  .sr-layout-focus  { flex-direction: column; }
  .sr-thumb-strip   { width: 100%; max-width: unset; flex-direction: row; border-left: none; border-top: 1px solid rgba(255,255,255,.05); padding: 6px; overflow-x: auto; overflow-y: hidden; }
  .sr-tile-thumb    { width: 140px; flex-shrink: 0; }
}

/* ── Unmute-Button für Remote-Streams ── */
/* ── Stream Volume Bar ── */
.sr-stream-vol {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px; padding: 4px 10px;
  z-index: 10; white-space: nowrap;
  opacity: 0.35; transition: opacity .2s;
}
.sr-tile:hover .sr-stream-vol,
.sr-tile-grid:hover .sr-stream-vol { opacity: 1; }
.sr-stream-mute-btn {
  background: none; border: none; color: #fff; font-size: 14px;
  cursor: pointer; padding: 0; line-height: 1;
}
.sr-stream-vol-slider {
  -webkit-appearance: none; appearance: none;
  width: 72px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.4); cursor: pointer; outline: none;
}
.sr-stream-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; cursor: pointer;
}
.sr-stream-vol-slider.hidden { display: none; }

/* ── Mikrofon-Selector ── */
.sr-mic-select {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 7px; color: #ccc; font-size: 11px; padding: 5px 7px;
  cursor: pointer; outline: none; appearance: none; -webkit-appearance: none;
}
.sr-mic-select:focus { border-color: rgba(229,57,53,.5); }
.sr-mic-select option { background: #222; color: #ccc; }

/* ── Lautstärke-Slider im Voice-Channel ── */
.sr-vol-slider {
  -webkit-appearance: none; appearance: none;
  width: 52px; height: 3px; border-radius: 2px; outline: none;
  background: rgba(255,255,255,.2); cursor: pointer; flex-shrink: 0;
}
.sr-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 10px; height: 10px;
  border-radius: 50%; background: #aaa; cursor: pointer;
}
.sr-vol-slider:hover { background: rgba(229,57,53,.4); }
.sr-vol-slider:hover::-webkit-slider-thumb { background: #fff; }

/* ── Layout-Switcher Buttons ── */
.sr-layout-switcher { gap: 3px; }
.sr-layout-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  color: #888; border-radius: 6px; padding: 3px 7px; font-size: 13px;
  cursor: pointer; line-height: 1; transition: all .15s;
}
.sr-layout-btn:hover  { background: rgba(255,255,255,.15); color: #ccc; }
.sr-layout-btn.active { background: rgba(229,57,53,.25); border-color: rgba(229,57,53,.6); color: #fff; }
/* Auto-Layout-Button: grün wenn aktiv, sonst grau */
.sr-layout-auto       { font-size: 11px; font-weight: 700; letter-spacing: .03em; }
.sr-layout-auto.active { background: rgba(76,175,80,.25); border-color: rgba(76,175,80,.6); color: #81c784; }

/* ── Grid-2 Layout: 2 gleichgroße Streams nebeneinander ── */
.sr-layout-grid2 {
  display: flex; flex-direction: column; gap: 4px; height: 100%;
}
.sr-grid2-main {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; min-height: 0;
}

/* ── Grid-4 Layout: 2×2 Raster, Vorschau rechts ── */
.sr-layout-grid4 {
  display: flex; flex-direction: row; gap: 4px; height: 100%;
}
.sr-grid4-main {
  flex: 1; display: grid;
  grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 4px; min-height: 0;
}
.sr-thumb-strip-right {
  display: flex; flex-direction: column; gap: 4px;
  width: 140px; flex-shrink: 0; overflow-y: auto;
}
.sr-thumb-strip-right .sr-tile-thumb { width: 100%; height: auto; aspect-ratio: 16/9; }

/* ── Grid-Tile (gleichgroß, kein Fokus-Unterschied) ── */
.sr-tile-grid {
  position: relative; overflow: hidden; border-radius: 8px;
  background: #111; border: 1px solid rgba(255,255,255,.06); min-height: 0;
}
.sr-tile-grid video { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ── Radio-Bot Panel ─────────────────────────────────────────────────────── */
.sr-radio-section { border-top: 1px solid rgba(255,255,255,.07); padding-top: 10px; }
.sr-radio-input {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 7px; color: #ccc; font-size: 11px; padding: 5px 7px;
  outline: none; margin-bottom: 6px;
}
.sr-radio-input:focus { border-color: rgba(229,57,53,.5); }
.sr-radio-input:disabled { opacity: .5; }
.sr-radio-controls { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 6px; }
.sr-radio-btn {
  flex: 1; min-width: 0; padding: 5px 8px; border: 0; border-radius: 7px;
  font-size: 11px; font-weight: 600; cursor: pointer; transition: background .15s;
  white-space: nowrap;
}
.sr-radio-start  { background: rgba(76,175,80,.25);  color: #81c784; }
.sr-radio-start:hover  { background: rgba(76,175,80,.45); }
.sr-radio-stop   { background: rgba(229,57,53,.25);  color: #ef9a9a; }
.sr-radio-stop:hover   { background: rgba(229,57,53,.45); }
.sr-radio-unmute { background: rgba(255,193,7,.2);   color: #ffe082;  }
.sr-radio-unmute:hover { background: rgba(255,193,7,.4); }
.sr-radio-vol-row { display: flex; align-items: center; gap: 7px; }
.sr-radio-vol {
  -webkit-appearance: none; appearance: none; flex: 1;
  height: 3px; border-radius: 2px; background: rgba(255,255,255,.3); cursor: pointer; outline: none;
}
.sr-radio-vol::-webkit-slider-thumb {
  -webkit-appearance: none; width: 12px; height: 12px;
  border-radius: 50%; background: #aaa; cursor: pointer;
}
