/* RESET */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: Arial, sans-serif;
  color: white;
  background:
    linear-gradient(rgba(5,11,22,0.78), rgba(5,11,22,0.78)),
    url("backgroundimg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 999px; }

/* LINKS */
a { color: #93c5fd; text-decoration: none; word-break: break-all; }
a:hover { text-decoration: underline; }

/* BUTTON */
button {
  border: none;
  outline: none;
  cursor: pointer;
  transition: transform 0.2s ease;
  color: white;
  background: #2563eb;
}
button:hover { transform: scale(1.03); }

/* INPUT */
input {
  border: none;
  outline: none;
  color: white;
  background: rgba(30,41,59,0.9);
  backdrop-filter: blur(10px);
}
input::placeholder { color: rgba(255,255,255,0.65); }

/* ========================= */
/* INDEX PAGE                */
/* ========================= */

.indexPage {
  background:
    linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.45)),
    url("indexback.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  position: relative;
  overflow: hidden;
}

.indexOverlay {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(2px);
  background: rgba(0,0,0,0.1);
}

.indexCenter {
  position: absolute;
  left: 50%;
  bottom: 55px;
  transform: translateX(-50%);
  width: 92%;
  max-width: 560px;
  z-index: 5;
}

.commentBox {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), inset 0 1px 1px rgba(255,255,255,0.15);
}

.commentBox input {
  flex: 1;
  background: transparent;
  font-size: 22px;
  padding: 10px 8px;
}

.commentBox button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  font-size: 24px;
  backdrop-filter: blur(12px);
}
.commentBox button:hover {
  transform: scale(1.08);
  background: rgba(255,255,255,0.22);
}

/* FLOATING COMMENTS */
.floatingComment {
  position: absolute;
  max-width: 280px;
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 30px rgba(0,0,0,0.25), inset 0 1px 1px rgba(255,255,255,0.15);
  color: white;
  font-size: 18px;
  text-align: center;
  z-index: 20;
  animation: floatIn 0.35s ease, idleFloat 4s ease-in-out infinite;
  transition: opacity 0.5s, transform 0.5s;
  pointer-events: none;
}

@keyframes floatIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes idleFloat {
  0%   { margin-top: 0; }
  50%  { margin-top: -8px; }
  100% { margin-top: 0; }
}

/* ========================= */
/* LOGIN PAGE                */
/* ========================= */

.loginPage {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loginBox {
  width: 92%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(15,23,42,0.72);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.05);
}

.loginBox input {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
}

.passwordWrap { position: relative; }

#togglePass {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  user-select: none;
  cursor: pointer;
  opacity: 0.7;
}

.loginBox button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: #16a34a;
  font-size: 15px;
  font-weight: bold;
}
.loginBox button:hover { background: #15803d; }

/* ========================= */
/* TOP BAR                   */
/* ========================= */

#topBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 65px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: rgba(2,6,23,0.72);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  z-index: 9999;
}

#topTitle {
  font-weight: bold;
  font-size: 16px;
  white-space: nowrap;
}

#onlineStatus {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

#onlineDot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: #64748b;
  transition: background 0.3s;
}

#onlineLabel {
  font-size: 12px;
  opacity: 0.65;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#logoutBtn {
  padding: 10px 14px;
  border-radius: 14px;
  background: #ef4444;
  font-size: 13px;
  white-space: nowrap;
}

/* ========================= */
/* CHAT AREA                 */
/* ========================= */

#messages {
  position: fixed;
  top: 65px;
  bottom: 58px;
  left: 0; right: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 14px 50px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  contain: strict;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ========================= */
/* MESSAGE WRAPPER           */
/* ========================= */

.msgWrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 80%;
  animation: pop 0.15s ease;
}

.meWrapper {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msgInner {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

/* AVATAR */
.avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  color: white;
  margin-bottom: 18px;
}

/* MESSAGE BUBBLE */
.msg {
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(30,41,59,0.82);
  backdrop-filter: blur(8px);
  line-height: 1.4;
  word-wrap: break-word;
  border: 1px solid rgba(255,255,255,0.06);
  transition: filter 0.2s;
  cursor: pointer;
  contain: content;
}
.msg:hover { filter: brightness(1.1); }

.me {
  background: rgba(37,99,235,0.85);
  border-color: rgba(96,165,250,0.15);
}

.msgUser {
  font-size: 11px;
  opacity: 0.5;
  margin-bottom: 3px;
}

.msgText {
  font-size: 15px;
  word-break: break-word;
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* REPLY BOX */
.replyBox {
  font-size: 12px;
  opacity: 0.7;
  margin-bottom: 6px;
  padding-left: 8px;
  border-left: 3px solid #60a5fa;
}

/* TIMESTAMP */
.time {
  margin-top: 4px;
  text-align: right;
  font-size: 10px;
  opacity: 0.4;
  cursor: default;
}

/* ========================= */
/* DATE SEPARATOR            */
/* ========================= */

.dateSeparator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 11px;
  opacity: 0.4;
  width: 100%;
}
.dateSeparator::before,
.dateSeparator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255,255,255,0.15);
}

/* ========================= */
/* REACTIONS                 */
/* ========================= */

.reactionsRow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.reactionBadge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 13px;
  cursor: pointer;
  color: white;
  transition: background 0.15s, transform 0.1s;
}
.reactionBadge.reacted {
  background: rgba(37,99,235,0.4);
  border-color: #2563eb;
}
.reactionBadge:hover {
  background: rgba(255,255,255,0.15);
  transform: scale(1.1);
}

/* ========================= */
/* REACTION PICKER           */
/* ========================= */

#reactionPicker {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.5);
  z-index: 99999;
}

#reactionPickerBox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 20px;
  background: rgba(2,6,23,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
}

#reactionPickerBox > span {
  font-size: 12px;
  opacity: 0.5;
}

#reactionEmojis {
  display: flex;
  gap: 4px;
}

#reactionEmojis button {
  font-size: 22px;
  background: transparent;
  padding: 4px 6px;
  border-radius: 10px;
}
#reactionEmojis button:hover {
  background: rgba(255,255,255,0.1);
  transform: scale(1.25);
}

#reactionPickerBox > button {
  background: transparent;
  font-size: 14px;
  opacity: 0.45;
  padding: 4px 8px;
}

/* ========================= */
/* TYPING INDICATOR          */
/* ========================= */

#typingIndicator {
  display: none;
  position: fixed;
  bottom: 68px;
  left: 18px;
  font-size: 12px;
  opacity: 0.55;
  z-index: 999;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.7; }
}

/* ========================= */
/* INPUT AREA                */
/* ========================= */

#inputArea {
  position: fixed;
  left: 10px; right: 10px; bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(15,23,42,0.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.05);
  z-index: 9999;
}

#msg {
  flex: 1;
  background: transparent;
  font-size: 15px;
}

#inputArea button {
  padding: 11px 16px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: bold;
}

#uploadBtn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(30,41,59,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: transform 0.2s;
  text-decoration: none;
}
#uploadBtn:hover { transform: scale(1.05); }

/* ========================= */
/* REPLY PREVIEW             */
/* ========================= */

#replyPreview {
  position: fixed;
  left: 10px; right: 10px; bottom: 78px;
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(30,41,59,0.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
  z-index: 999;
}

/* ========================= */
/* POPUP MENU                */
/* ========================= */

#popupMenu {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.5);
  z-index: 99999;
}

#menuBox {
  width: 92%;
  max-width: 240px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(2,6,23,0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.05);
}

#menuBox button {
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  background: transparent;
  font-size: 14px;
}
#menuBox button:hover { background: rgba(255,255,255,0.05); }
#deleteBtn { color: #ef4444; }

/* ========================= */
/* AFK LOCK                  */
/* ========================= */

.blurred {
  filter: blur(80px);
  pointer-events: none;
  user-select: none;
  transition: filter 0.25s;
}

#afkLock {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  z-index: 999999;
}

#afkBox {
  width: 92%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(15,23,42,0.92);
  border: 1px solid rgba(255,255,255,0.08);
  text-align: center;
}

#afkBox h2 { font-size: 22px; }
#afkBox p  { font-size: 14px; opacity: 0.7; }

#afkBox input, #afkBox button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
}

/* ========================= */
/* TIMEOUT MENU              */
/* ========================= */

#timeoutWrap { position: relative; }

#timeoutBtn {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  font-size: 13px;
  white-space: nowrap;
}

#timeoutMenu {
  position: absolute;
  top: 45px;
  right: 0;
  width: 90px;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(2,6,23,0.95);
  backdrop-filter: blur(14px);
  z-index: 99999;
}

#timeoutMenu button {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  text-align: center;
}
#timeoutMenu button:hover { background: rgba(255,255,255,0.06); }

/* ========================= */
/* MOBILE                    */
/* ========================= */

@media (max-width: 600px) {
  .msgWrapper    { max-width: 88%; }
  .msgText       { font-size: 15px; }
  .commentBox input { font-size: 18px; }
  #topBar        { gap: 6px; }
  .indexCenter   { bottom: 35px; }
  #onlineLabel   { max-width: 80px; }
}

/* ========================= */
/* CALL BUTTON (top bar)     */
/* ========================= */

#callBtn {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.15);
  font-size: 16px;
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #22c55e;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
}
#callBtn:hover {
  background: rgba(34, 197, 94, 0.28);
  transform: scale(1.06);
}

/* ========================= */
/* ACTIVE CALL HUD           */
/* ========================= */

#callHud {
  display: none;
  position: fixed;
  top: 65px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
}

#callHudInner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(34, 197, 94, 0.3);
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.15);
  font-size: 13px;
  color: #e2e8f0;
  white-space: nowrap;
}

#callHudPulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  animation: hudPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes hudPulse {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.8); }
}

#callHudTimer {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #22c55e;
  min-width: 38px;
}

#callHudMute,
#callHudDeafen,
#callHudEnd {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  transition: background 0.15s, transform 0.1s;
}
#callHudMute:hover,
#callHudDeafen:hover { background: rgba(255,255,255,0.14); }
#callHudEnd        { background: rgba(239, 68, 68, 0.2); border-color: rgba(239,68,68,0.3); color: #ef4444; }
#callHudEnd:hover  { background: rgba(239, 68, 68, 0.35); }

/* ========================= */
/* INCOMING CALL MODAL       */
/* ========================= */

#incomingModal {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 999998;
}

#incomingBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 28px;
  border-radius: 24px;
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(255,255,255,0.07);
  width: 92%;
  max-width: 300px;
  text-align: center;
}

#incomingRing {
  font-size: 44px;
  animation: ring 0.6s ease-in-out infinite alternate;
}

@keyframes ring {
  from { transform: rotate(-12deg); }
  to   { transform: rotate(12deg); }
}

#incomingWho {
  font-size: 15px;
  color: #e2e8f0;
  opacity: 0.85;
}

#incomingBtns {
  display: flex;
  gap: 12px;
  width: 100%;
}

#acceptBtn {
  flex: 1;
  padding: 13px;
  border-radius: 14px;
  background: #16a34a;
  font-size: 14px;
  font-weight: bold;
}
#acceptBtn:hover { background: #15803d; }

#declineBtn {
  flex: 1;
  padding: 13px;
  border-radius: 14px;
  background: rgba(239,68,68,0.18);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  font-size: 14px;
  font-weight: bold;
}
#declineBtn:hover { background: rgba(239,68,68,0.3); }

/* ========================= */
/* CALLING (waiting) MODAL   */
/* ========================= */

#callingModal {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  z-index: 999998;
}

#callingBox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 36px 28px;
  border-radius: 24px;
  background: rgba(2, 6, 23, 0.95);
  border: 1px solid rgba(255,255,255,0.07);
  width: 92%;
  max-width: 280px;
  text-align: center;
}

#callingSpinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(34,197,94,0.2);
  border-top-color: #22c55e;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#callingLabel {
  font-size: 15px;
  opacity: 0.75;
}

#cancelCallBtn {
  padding: 12px 28px;
  border-radius: 14px;
  background: rgba(239,68,68,0.18);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  font-size: 14px;
}
#cancelCallBtn:hover { background: rgba(239,68,68,0.3); }

/* ========================= */
/* SETTINGS PANEL            */
/* ========================= */

#settingsPanel {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  z-index: 999999;
}

#settingsBox {
  width: 92%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 22px;
  border-radius: 24px;
  background: rgba(5,11,22,0.97);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
}

#settingsBox h3 {
  font-size: 16px;
  font-weight: bold;
  opacity: 0.85;
  margin-bottom: 2px;
}

.settingsRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settingsLabel {
  font-size: 13px;
  opacity: 0.65;
}

#ringtoneToggleBtn {
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  background: rgba(34,197,94,0.18);
  border: 1px solid rgba(34,197,94,0.25);
  color: #e2e8f0;
  transition: background 0.2s;
}

#settingsCloseBtn {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  font-size: 14px;
  margin-top: 4px;
}
#settingsCloseBtn:hover { background: rgba(255,255,255,0.12); }

#settingsBtn {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  font-size: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  color: white;
}
#settingsBtn:hover { background: rgba(255,255,255,0.13); }

/* ========================= */
/* SCREEN SHARE               */
/* ========================= */

#screenShareWrap { position: relative; }

#screenShareBtn {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 14px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  transition: background 0.15s;
}
#screenShareBtn:hover { background: rgba(255,255,255,0.14); }
#screenShareBtn.sharing {
  background: rgba(59,130,246,0.22);
  border-color: rgba(59,130,246,0.35);
  color: #60a5fa;
}

#screenShareMenu {
  display: none;
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 220px;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(2,6,23,0.97);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.08);
  z-index: 999999;
  text-align: left;
}

.ssmSection { display: flex; flex-direction: column; gap: 4px; }

.ssmLabel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.5;
  padding: 2px 4px;
}

#screenShareMenu .ssmSection button {
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  text-align: left;
  font-size: 13px;
}
#screenShareMenu .ssmSection button:hover { background: rgba(255,255,255,0.1); }

#screenShareMenu .ssmSection button[data-quality].active {
  background: rgba(59,130,246,0.22);
  border: 1px solid rgba(59,130,246,0.35);
  color: #60a5fa;
}

#stopShareBtn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: rgba(239,68,68,0.18);
  border: 1px solid rgba(239,68,68,0.3);
  color: #ef4444;
  font-size: 13px;
  font-weight: bold;
}
#stopShareBtn:hover { background: rgba(239,68,68,0.32); }

#screenShareView {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999997;
  background: #000;
  flex-direction: column;
}

#remoteScreenVideo {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

#screenShareViewBar {
  position: absolute;
  top: 14px;
  right: 14px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

#screenShareViewLabel {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(2,6,23,0.7);
  backdrop-filter: blur(10px);
  font-size: 13px;
  color: #e2e8f0;
  pointer-events: auto;
}

#screenShareViewClose {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(2,6,23,0.7);
  backdrop-filter: blur(10px);
  color: white;
  font-size: 16px;
}
#screenShareViewClose:hover { background: rgba(239,68,68,0.4); }

@media (max-width: 600px) {
  #screenShareMenu { width: 200px; left: auto; right: -40px; transform: none; }
}

/* ========================= */
/* ROOM SELECTOR             */
/* ========================= */

#roomSelector {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.08);
  cursor: pointer;
  outline: none;
  max-width: 120px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#roomSelector option {
  background: #0f172a;
  color: white;
}

#adminBtn {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  font-size: 16px;
  border: 1px solid rgba(255,255,255,0.06);
  color: white;
  white-space: nowrap;
}
#adminBtn:hover { background: rgba(255,255,255,0.12); }

/* ========================= */
/* CALL QUALITY BADGE        */
/* ========================= */

#callQualityBadge {
  font-size: 11px;
  min-width: 60px;
  opacity: 0.8;
}

/* ========================= */
/* USERS PANEL               */
/* ========================= */

#usersBtn {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  font-size: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  color: white;
}
#usersBtn:hover { background: rgba(255,255,255,0.13); }

#usersPanel {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 999999;
}

#usersPanelBox {
  width: 92%;
  max-width: 420px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 20px;
  background: rgba(5,11,22,0.97);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
}

#usersPanelTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
#usersPanelTop h3 { font-size: 16px; }
#usersPanelTop button {
  background: transparent;
  font-size: 16px;
  opacity: 0.5;
  padding: 4px 8px;
  border-radius: 8px;
  color: white;
}
#usersPanelTop button:hover { opacity: 1; background: rgba(255,255,255,0.06); }

#usersPanelContent {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.uprRoomGroup { }
.uprRoomHeader {
  font-size: 13px;
  font-weight: bold;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 4px;
}
.uprUser {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
}
.uprUser:hover { background: rgba(255,255,255,0.03); }
.uprDot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
}
.uprDot.online { background: #22c55e; }
.uprDot.offline { background: #64748b; }
.uprName { flex: 1; }
.uprLastSeen { font-size: 11px; opacity: 0.4; }

/* ========================= */
/* ADMIN PANEL               */
/* ========================= */

.adminPage {
  background: linear-gradient(rgba(5,11,22,0.92), rgba(5,11,22,0.92)), url("backgroundimg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

#adminLoginView {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.adminLoginBox {
  width: 92%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 24px;
  border-radius: 24px;
  background: rgba(15,23,42,0.78);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,0.06);
}

.adminLoginBox input {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
}

.adminLoginBox button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  background: #2563eb;
  font-size: 15px;
  font-weight: bold;
}
.adminLoginBox button:hover { background: #1d4ed8; }

#adminLoginView {
  display: flex;
  width: 100%;
  height: 100vh;
  justify-content: center;
  align-items: center;
}

#adminDashboard {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

#adminTopBar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: rgba(2,6,23,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  z-index: 9999;
}

#adminContent {
  position: fixed;
  top: 65px;
  bottom: 0;
  left: 0; right: 0;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.adminCard {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(15,23,42,0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.06);
}

.adminCard h3 {
  font-size: 15px;
  font-weight: bold;
  opacity: 0.85;
}

.adminHint {
  font-size: 12px;
  opacity: 0.4;
  margin-top: -6px;
}

.adminInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  background: rgba(30,41,59,0.8);
}

.adminBtn {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  background: #2563eb;
  font-size: 14px;
  font-weight: bold;
  color: white;
}
.adminBtn:hover {
  background: #1d4ed8;
}

.adminList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
}

.adminListItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  font-size: 13px;
}

.adminSub {
  font-size: 11px;
  opacity: 0.45;
}

.adminEmpty {
  font-size: 12px;
  opacity: 0.35;
  text-align: center;
  padding: 14px;
}

.adminDelBtn {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(239,68,68,0.18);
  color: #ef4444;
  font-size: 11px;
  border: 1px solid rgba(239,68,68,0.2);
}
.adminDelBtn:hover {
  background: rgba(239,68,68,0.3);
}

.adminToggle {
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 11px;
  border: 1px solid;
  cursor: pointer;
  transition: background 0.15s;
}
.adminToggle.on {
  background: rgba(34,197,94,0.18);
  color: #22c55e;
  border-color: rgba(34,197,94,0.3);
}
.adminToggle.on:hover {
  background: rgba(239,68,68,0.18);
  color: #ef4444;
  border-color: rgba(239,68,68,0.3);
}
.adminToggle.off {
  background: rgba(239,68,68,0.18);
  color: #ef4444;
  border-color: rgba(239,68,68,0.3);
}
.adminToggle.off:hover {
  background: rgba(34,197,94,0.18);
  color: #22c55e;
  border-color: rgba(34,197,94,0.3);
}

/* ========================= */
/* ROOM SELECTOR             */
/* ========================= */

#roomWrap {
  position: relative;
}

#roomBtn {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  font-size: 13px;
  white-space: nowrap;
  color: white;
}

#roomMenu {
  position: absolute;
  top: 45px;
  right: 0;
  min-width: 150px;
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
  background: rgba(2,6,23,0.97);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.06);
  z-index: 99999;
}

#roomMenu button {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: white;
}
#roomMenu button:hover {
  background: rgba(255,255,255,0.07);
}
#roomMenu button.active {
  background: rgba(37,99,235,0.25);
  color: #60a5fa;
}

.roomGroup {
  margin-bottom: 8px;
}
.roomGroupHeader {
  font-size: 13px;
  font-weight: bold;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  margin-bottom: 4px;
}
.userRoomBadge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(37,99,235,0.2);
  border: 1px solid rgba(37,99,235,0.3);
  font-size: 11px;
  color: #60a5fa;
}
.roomBadgeRemove {
  cursor: pointer;
  opacity: 0.5;
  font-size: 10px;
  margin-left: 2px;
}
.roomBadgeRemove:hover { opacity: 1; }
.roomAddSelect {
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: white;
  font-size: 11px;
  cursor: pointer;
  outline: none;
}
.roomAddSelect option { background: #0f172a; color: white; }
.adminManageBtn {
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(59,130,246,0.18);
  color: #60a5fa;
  font-size: 11px;
  border: 1px solid rgba(59,130,246,0.25);
  cursor: pointer;
}
.adminManageBtn:hover { background: rgba(59,130,246,0.3); }

#roomManageModal {
  display: none;
  position: fixed;
  inset: 0;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 999999;
}
#roomManageBox {
  width: 92%;
  max-width: 400px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 20px;
  background: rgba(5,11,22,0.97);
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(16px);
}
#roomManageTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
#roomManageTop h3 { font-size: 16px; }
#roomManageTop button {
  background: transparent;
  font-size: 16px;
  opacity: 0.5;
  padding: 4px 8px;
  border-radius: 8px;
  color: white;
}
#roomManageTop button:hover { opacity: 1; background: rgba(255,255,255,0.06); }
#roomManageContent {
  flex: 1;
  overflow-y: auto;
}

.roomCheckLabel {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-size: 12px;
  cursor: pointer;
}
.roomCheckLabel input { accent-color: #2563eb; }
.adminBadge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(34,197,94,0.18);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.3);
  vertical-align: middle;
  margin-left: 4px;
}

@media (max-width: 600px) {
  #adminContent { padding: 14px 10px; }
  .adminCard { padding: 14px; }
}

#adminTabs {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  padding: 16px 16px 0;
  position: relative;
  z-index: 1;
}

.tab {
  flex: 1;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  font-size: 14px;
  text-align: center;
  transition: background 0.2s;
  color: white;
}
.tab.active {
  background: rgba(37,99,235,0.2);
  border: 1px solid rgba(37,99,235,0.3);
  color: #60a5fa;
}
.tab:hover { background: rgba(255,255,255,0.1); }

.adminTabContent { display: none; flex-direction: column; gap: 16px; padding: 0 16px 16px; }
