/* ============================================================
   screenroom.css - Stream Room UI
   Theme: hartwaretotal.de (Marken-Rot #a32119 auf Dark)
   ============================================================ */

:root{
  --bg:#0d1117; --panel:#141922; --panel2:#1c2430; --elevated:#374151;
  --border:#2c3644; --border2:#475569;
  --txt:#f5f7fa; --txt-dim:#d1d5db; --txt-mute:#9ca3af;
  --accent:#a32119; --accent-hover:#c0281f; --accent-dark:#7a1811;
  --accent-soft:rgba(163,33,25,.9);
  --green:#22c55e; --green-soft:rgba(34,197,94,.18);
  --live:#e11d1d; --danger:#991b1b; --danger-text:#fca5a5;
  --font-base:'Inter','Segoe UI',system-ui,-apple-system,Roboto,Arial,sans-serif;
  --radius:12px;
}

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

/* ---------- Grundlayout ---------- */
#screenroom-wrap{ display:flex; height:100vh; width:100vw; }

#sr-sidebar{
  width:290px; min-width:290px; height:100vh; overflow-y:auto;
  background:var(--panel); border-right:1px solid var(--border);
  padding:14px; display:flex; flex-direction:column; gap:14px;
}
#sr-sidebar::-webkit-scrollbar{ width:8px; }
#sr-sidebar::-webkit-scrollbar-thumb{ background:var(--elevated); border-radius:4px; }

.sr-sidebar-section{
  background:var(--panel2); border:1px solid var(--border);
  border-radius:var(--radius); padding:12px;
}
.sr-sidebar-label{
  font-size:11px; text-transform:uppercase; letter-spacing:.06em;
  color:var(--txt-mute); margin-bottom:8px; font-weight:700;
}
.sr-room-badge{
  background:rgba(163,33,25,.18); color:#f0a6a0; border:1px solid rgba(163,33,25,.55);
  border-radius:8px; padding:6px 10px; font-size:13px; font-weight:600; display:inline-block;
}
#sr-voice-status{ font-size:13px; color:var(--txt-dim); }

/* ---------- Buttons allgemein ---------- */
.sr-voice-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  width:100%; margin-bottom:8px; padding:9px 12px; cursor:pointer;
  background:rgba(255,255,255,.06); color:var(--txt);
  border:1px solid var(--border2); border-radius:9px; font-size:13px; font-weight:600;
  transition:background .15s,border-color .15s;
}
.sr-voice-btn:hover{ background:rgba(255,255,255,.12); }
#btn-voice-join{ background:var(--accent); border-color:transparent; color:#fff; }
#btn-voice-join:hover{ background:var(--accent-hover); }
.sr-voice-btn.sr-voice-muted{ background:rgba(153,27,27,.35); border-color:rgba(225,29,29,.55); color:var(--danger-text); }
.sr-voice-btn.sr-voice-ptt-active,
.sr-voice-btn.sr-voice-gate-active{ background:var(--green-soft); border-color:rgba(34,197,94,.5); color:#86efac; }
.sr-voice-btn.sr-voice-ptt-held{ background:rgba(34,197,94,.4); border-color:var(--green); color:#fff; }

/* ---------- Gate ---------- */
#gate-controls{ flex-direction:column; gap:6px; margin:6px 0 4px; }
.sr-gate-label{ font-size:12px; color:var(--txt-dim); }
.sr-gate-slider,.sr-radio-vol,.sr-vol-slider,.sr-stream-vol-slider{
  width:100%; accent-color:var(--accent); cursor:pointer; height:4px;
}
.sr-gate-hint{ font-size:10px; color:var(--txt-mute); line-height:1.4; }

/* ---------- Selects ---------- */
.sr-mic-select,#sel-mic{
  width:100%; background:var(--panel); color:var(--txt);
  border:1px solid var(--border2); border-radius:8px; padding:6px 8px; font-size:12px; outline:none;
}
.sr-mic-select option{ background:var(--panel2); }

/* ---------- Voice-Mitglieder ---------- */
#sr-voice-members{ display:flex; flex-direction:column; gap:6px; }
.sr-voice-empty{ font-size:12px; color:var(--txt-mute); }
.sr-voice-member{
  display:flex; align-items:center; gap:8px; padding:5px 6px; border-radius:8px;
  background:rgba(255,255,255,.04); position:relative;
}
.sr-voice-avatar{
  width:26px; height:26px; min-width:26px; border-radius:50%;
  background:linear-gradient(135deg,var(--accent),var(--accent-dark)); color:#fff;
  display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700;
  border:2px solid transparent; transition:border-color .12s,box-shadow .12s;
}
.sr-voice-name{ flex:1; font-size:13px; color:var(--txt); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sr-voice-icon{ font-size:13px; }
.sr-voice-member .sr-vol-slider{ width:70px; }
/* Sprecher-Puls-Ring */
.sr-voice-member.speaking .sr-voice-avatar{
  border-color:var(--green); box-shadow:0 0 0 0 rgba(34,197,94,.6);
  animation:sr-pulse 1.2s infinite;
}
@keyframes sr-pulse{
  0%{ box-shadow:0 0 0 0 rgba(34,197,94,.55); }
  70%{ box-shadow:0 0 0 8px rgba(34,197,94,0); }
  100%{ box-shadow:0 0 0 0 rgba(34,197,94,0); }
}

/* ---------- Radio ---------- */
.sr-radio-input{
  width:100%; background:var(--panel); color:var(--txt);
  border:1px solid var(--border2); border-radius:8px; padding:7px 9px; font-size:12px;
  margin-bottom:8px; outline:none;
}
.sr-radio-input:focus{ border-color:var(--accent-soft); }
.sr-radio-controls{ display:flex; gap:6px; flex-wrap:wrap; }
.sr-radio-btn{
  flex:1; min-width:80px; padding:7px 8px; cursor:pointer; font-size:12px; font-weight:600;
  border:1px solid var(--border2); border-radius:8px; background:rgba(255,255,255,.06); color:var(--txt);
}
.sr-radio-btn:hover{ background:rgba(255,255,255,.12); }
.sr-radio-start{ background:var(--green-soft); border-color:rgba(34,197,94,.45); color:#86efac; }
.sr-radio-stop{ background:rgba(153,27,27,.3); border-color:rgba(225,29,29,.5); color:var(--danger-text); }
.sr-radio-vol-row{ display:flex; align-items:center; gap:8px; margin-top:8px; }
.sr-radio-vol{ flex:1; }

/* ---------- Teilnehmerliste ---------- */
#sr-peer-list{ display:flex; flex-direction:column; gap:4px; }
.sr-peer-item{
  display:flex; align-items:center; gap:8px; padding:5px 6px; border-radius:7px;
  font-size:13px; color:var(--txt); background:rgba(255,255,255,.03);
}
.sr-peer-item:hover{ background:rgba(255,255,255,.07); }
.sr-peer-dot{ width:8px; height:8px; border-radius:50%; background:#556; min-width:8px; }
.sr-peer-dot.streaming{ background:var(--live); box-shadow:0 0 6px var(--live); }

#sr-current-name{ font-weight:600; }

/* ---------- Hauptbereich ---------- */
#sr-main{ flex:1; display:flex; flex-direction:column; min-width:0; height:100vh; position:relative; }
#sr-header{
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
  padding:12px 18px; border-bottom:2px solid var(--accent);
  background:linear-gradient(90deg,var(--accent-dark),var(--panel) 55%);
}
.sr-title{ font-size:18px; margin:0; font-weight:700; display:flex; align-items:center; gap:8px; color:#fff; }
.sr-title span{ color:#fff; }
#sr-toolbar{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; }

/* Toggle-Switches */
.rtc-switch-group{ display:inline-flex; align-items:center; gap:7px; }
.rtc-switch{ position:relative; display:inline-block; width:40px; height:22px; }
.rtc-switch input{ opacity:0; width:0; height:0; }
.rtc-slider{
  position:absolute; inset:0; cursor:pointer; background:#3a4756; border-radius:22px; transition:.2s;
}
.rtc-slider:before{
  content:""; position:absolute; height:16px; width:16px; left:3px; top:3px;
  background:#fff; border-radius:50%; transition:.2s;
}
.rtc-switch input:checked + .rtc-slider{ background:var(--accent); }
.rtc-switch input:checked + .rtc-slider-live{ background:var(--live); }
.rtc-switch input:checked + .rtc-slider:before{ transform:translateX(18px); }
.rtc-switch-label{ font-size:13px; color:#e5e7eb; white-space:nowrap; }

#selRes,#selCodec{
  background:rgba(255,255,255,.1); border:1px solid var(--border2); border-radius:7px;
  color:#e5e7eb; font-size:12px; padding:4px 8px; cursor:pointer; outline:none;
}
#selRes:focus,#selCodec:focus{ border-color:var(--accent-soft); }
#selRes option,#selCodec option{ background:var(--panel2); color:var(--txt-dim); }

/* Layout-Umschalter */
.sr-layout-switcher{ gap:4px; }
.sr-layout-btn{
  min-width:30px; height:28px; padding:0 6px; cursor:pointer; font-size:12px;
  background:rgba(255,255,255,.1); color:#e5e7eb;
  border:1px solid var(--border2); border-radius:7px;
}
.sr-layout-btn:hover{ background:rgba(255,255,255,.2); }
.sr-layout-btn.active{ background:var(--accent); color:#fff; border-color:transparent; }

/* ---------- Stream-Grid ---------- */
#overlay-dock{ flex:1; padding:16px; overflow:hidden; min-height:0; }
.sr-stream-grid{ display:flex; gap:12px; width:100%; height:100%; }
.sr-layout-single{ align-items:center; justify-content:center; }
.sr-layout-single .sr-tile{ width:100%; height:100%; }

.sr-layout-focus{ flex-direction:column; }
.sr-focus-wrap{ flex:1; min-height:0; }
.sr-focus-wrap .sr-tile{ width:100%; height:100%; }
.sr-thumb-strip{
  display:flex; gap:10px; height:130px; min-height:130px; overflow-x:auto; padding-top:2px;
}
.sr-thumb-strip .sr-tile{ width:210px; min-width:210px; height:100%; }
.sr-thumb-strip-right{ flex-direction:column; height:100%; width:220px; min-width:220px; overflow-y:auto; }

.sr-layout-grid2 .sr-grid2-main{ flex:1; display:grid; grid-template-columns:1fr 1fr; gap:12px; min-width:0; }
.sr-layout-grid4 .sr-grid4-main{ flex:1; display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; gap:12px; min-width:0; }
.sr-grid2-main .sr-tile,.sr-grid4-main .sr-tile{ width:100%; height:100%; }

/* ---------- Kacheln ---------- */
.sr-tile{
  position:relative; background:#000; border:1px solid var(--border);
  border-radius:10px; overflow:hidden; display:flex; min-height:0;
}
.sr-tile video{ width:100%; height:100%; object-fit:contain; background:#000; display:block; }
.sr-tile-header{
  position:absolute; top:0; left:0; right:0; z-index:3;
  display:flex; align-items:center; gap:8px; padding:7px 9px;
  background:linear-gradient(to bottom,rgba(0,0,0,.7),transparent);
}
.sr-tile-badge{
  font-size:10px; font-weight:800; letter-spacing:.05em; padding:2px 7px; border-radius:5px;
  background:var(--live); color:#fff;
}
.sr-tile-badge.local{ background:var(--accent); }
.sr-tile-name{ font-size:12px; color:#fff; text-shadow:0 1px 3px #000; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sr-tile-pin,.sr-tile-close{
  width:24px; height:24px; cursor:pointer; border:none; border-radius:6px;
  background:rgba(0,0,0,.5); color:#fff; font-size:14px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}
.sr-tile-pin:hover,.sr-tile-close:hover{ background:var(--accent); color:#fff; }

.sr-stream-vol{
  position:absolute; bottom:8px; right:8px; z-index:3;
  display:flex; align-items:center; gap:6px;
  background:rgba(0,0,0,.6); border-radius:8px; padding:4px 8px;
}
.sr-stream-mute-btn{ background:none; border:none; cursor:pointer; font-size:15px; }
.sr-stream-vol-slider{ width:80px; }
.sr-stream-vol-slider.hidden{ display:none; }

.sr-thumb-hint{
  position:absolute; bottom:6px; left:6px; z-index:3;
  font-size:10px; color:#fff; background:rgba(0,0,0,.6);
  padding:2px 6px; border-radius:5px;
}

/* ---------- Empty-Hint ---------- */
#sr-empty-hint{
  position:absolute; inset:0; pointer-events:none;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:12px; color:var(--txt-mute); text-align:center; line-height:1.6;
}
.sr-empty-icon{ font-size:52px; opacity:.5; }

/* ---------- Toast ---------- */
#rtcToast{
  position:fixed; bottom:22px; left:50%; transform:translateX(-50%);
  background:var(--panel2); color:var(--txt); padding:11px 18px; border-radius:10px;
  border:1px solid var(--border2); font-size:13px; z-index:100000;
  opacity:0; transition:opacity .3s; pointer-events:none; max-width:80vw;
  box-shadow:0 10px 30px rgba(0,0,0,.5);
}
#rtcToast.err{ background:#3a1416; border-color:rgba(225,29,29,.5); color:var(--danger-text); }

/* ---------- Responsive ---------- */
@media (max-width:860px){
  #screenroom-wrap{ flex-direction:column; }
  #sr-sidebar{ width:100%; min-width:0; height:auto; max-height:42vh; border-right:none; border-bottom:1px solid var(--border); }
  #sr-main{ height:58vh; }
  .sr-layout-grid4 .sr-grid4-main{ grid-template-columns:1fr; grid-template-rows:none; }
  .sr-layout-grid2 .sr-grid2-main{ grid-template-columns:1fr; }
}
