/* Sala ao vivo, no jeito do Google Meet: fundo escuro, vídeos grandes, barra
   de controles embaixo e painéis claros à direita. A sala é sempre escura,
   também no modo claro do sistema; os painéis seguem o tema. */

/* --- Modo sala: menu recolhido nos ícones, sem a barra de cima ------------- */
body.room-mode .topbar { display: none; }
body.room-mode .sidebar { width: 64px; }
body.room-mode .sidebar .brand { justify-content: center; padding: 12px 0; }
body.room-mode .sidebar .brand > div,
body.room-mode .space-switch,
body.room-mode .nav-label,
body.room-mode .nav-soon { display: none; }
body.room-mode .nav { padding: 8px 0; align-items: center; }
body.room-mode .nav-item { justify-content: center; width: 44px; height: 40px; padding: 0; }
body.room-mode .sidebar-footer { display: flex; justify-content: center; padding: 12px 0; }
body.room-mode .sidebar-footer .grow,
body.room-mode .sidebar-footer .btn { display: none; }
body.room-mode .content { padding: 0; max-width: none; }
body.room-mode .update-banner { bottom: 96px; }

.meeting-layout.room-open { display: flex; height: 100vh; height: 100dvh; background: #202124; }
.meeting-layout.room-open .meeting-room-host { flex: 1; min-width: 0; height: 100%; }
.meeting-layout.room-open .meeting-body { display: none; }
.meeting-layout.room-open.agenda-open .meeting-body { display: block; flex: none; width: 440px; height: 100%; overflow-y: auto; padding: var(--space-4); background: var(--bg); border-left: 1px solid var(--border); }
.meeting-layout:fullscreen { background: #202124; }
@media (max-width: 900px) {
  .meeting-layout.room-open.agenda-open .meeting-body { position: fixed; left: 0; right: 0; top: 0; bottom: 76px; width: auto; z-index: 35; }
}

/* --- Faixa na tela da reunião, antes de entrar ------------------------------ */
.room-banner { margin-bottom: var(--space-4); }
.room-banner .row { gap: 12px; }

/* --- Sala -------------------------------------------------------------------- */
.room.meet, .room.lobby {
  --room-bg: #202124; --room-tile: #3c4043; --room-hover: #4a4e51; --room-text: #e8eaed; --room-muted: #9aa0a6;
  --room-red: #ea4335; --room-blue: #8ab4f8;
  position: relative; display: flex; flex-direction: column; height: 100%; overflow: hidden;
  background: var(--room-bg); color: var(--room-text);
}
.room-body { position: relative; flex: 1; min-height: 0; display: flex; gap: 16px; padding: 16px 16px 0; }
.room-stage { position: relative; flex: 1; min-width: 0; }
.room-grid { position: absolute; inset: 0; }

.room-tile { position: absolute; overflow: hidden; border-radius: 12px; background: var(--room-tile); transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.room-tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.room-tile.screen video { object-fit: contain; background: #000; }
.room-tile.mirror video { transform: scaleX(-1); }
.room-tile.speaking::after { content: ''; position: absolute; inset: 0; border: 3px solid var(--room-blue); border-radius: 12px; pointer-events: none; }
.room-tile.pip { z-index: 3; box-shadow: 0 4px 18px rgba(0, 0, 0, .55); }
.tile-avatar { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--room-tile); }
.tile-avatar .avatar { width: clamp(44px, 24%, 128px); height: auto; aspect-ratio: 1; font-size: clamp(16px, 5vw, 44px); border: 0; }
.tile-name { position: absolute; left: 12px; bottom: 10px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 24px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 500; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.room-tile.small .tile-name { left: 8px; bottom: 6px; font-size: 11px; }
.tile-mic { position: absolute; top: 10px; right: 10px; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(32, 33, 36, .8); color: #f28b82; }
.room-tile.small .tile-mic { top: 6px; right: 6px; width: 22px; height: 22px; }
.tile-hand { position: absolute; top: 10px; left: 10px; font-size: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6)); animation: hand-bounce 1s infinite alternate; }
@keyframes hand-bounce { from { transform: translateY(0); } to { transform: translateY(-4px); } }
.tile-reactions { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.tile-react { position: absolute; bottom: 8px; font-size: 30px; animation: react-float 1.8s ease-out forwards; }
@keyframes react-float { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-110px) scale(1.3); opacity: 0; } }
.tile-hover { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; background: rgba(0, 0, 0, .35); opacity: 0; transition: opacity .15s; }
.room-tile:hover .tile-hover, .room-tile:focus-within .tile-hover { opacity: 1; }
.tile-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(32, 33, 36, .85); color: #fff; cursor: pointer; }
.tile-btn:hover { background: rgba(60, 64, 67, .95); }
.tile-btn:focus-visible { outline: 2px solid var(--room-blue); outline-offset: 2px; }
.room-tile.pinned .tile-btn:first-child { background: var(--room-blue); color: var(--room-bg); }
.room-tile.small .tile-btn { width: 32px; height: 32px; }
.tile-presenting { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; text-align: center; background: var(--room-tile); color: var(--room-text); }
.tile-presenting strong { font-size: 18px; font-weight: 500; }
.tile-presenting span { color: var(--room-muted); font-size: 13px; }
.room-tile.small .tile-presenting strong { font-size: 12px; }
.room-tile.small .tile-presenting span, .room-tile.small .tile-presenting .btn, .room-tile.small .tile-presenting svg { display: none; }

.room-overlay { position: absolute; top: 8px; left: 8px; z-index: 4; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.room-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 999px; background: rgba(32, 33, 36, .88); color: var(--room-text); font-size: 12px; font-weight: 600; pointer-events: auto; }
.room-chip.hands { cursor: pointer; }
.room-chip.rec { color: #f28b82; }
.room-rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--room-red); animation: pulse 1s infinite alternate; }

/* --- Barra de controles --------------------------------------------------------- */
.room-bar { flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; height: 80px; padding: 0 16px; }
.room-bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 15px; font-weight: 500; }
.room-sep { color: var(--room-muted); }
.room-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.room-bar-center { display: flex; align-items: center; gap: 10px; }
.room-bar-right { display: flex; justify-content: flex-end; gap: 4px; }
.room-btn { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--room-tile); color: var(--room-text); cursor: pointer; transition: background .15s; }
.room-btn:hover { background: var(--room-hover); }
.room-btn.off { background: var(--room-red); color: #fff; }
.room-btn.off:hover { background: #d33b30; }
.room-btn.active, .room-btn.open { background: var(--room-blue); color: var(--room-bg); }
.room-btn:focus-visible, .room-caret:focus-visible, .room-side-btn:focus-visible, .room-leave:focus-visible { outline: 2px solid var(--room-blue); outline-offset: 2px; }
.room-split { display: inline-flex; align-items: center; border-radius: 999px; background: var(--room-tile); }
.room-caret { order: -1; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 48px; border: 0; border-radius: 999px 0 0 999px; background: transparent; color: var(--room-text); cursor: pointer; }
.room-caret:hover { background: var(--room-hover); }
.room-leave { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 48px; border: 0; border-radius: 999px; background: var(--room-red); color: #fff; cursor: pointer; }
.room-leave:hover { background: #d33b30; }
.room-side-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0; border-radius: 50%; background: transparent; color: var(--room-text); cursor: pointer; }
.room-side-btn:hover { background: rgba(255, 255, 255, .08); }
.room-side-btn.active { background: rgba(138, 180, 248, .16); color: var(--room-blue); }
.room-dot-count { position: absolute; top: 2px; right: 0; display: flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--room-blue); color: var(--room-bg); font-size: 11px; font-weight: 700; }
.room-dot-count.people { background: #5f6368; color: #fff; }
.room-emoji { font-size: 20px; line-height: 1; }

/* --- Menus flutuantes ------------------------------------------------------------ */
.room-pop { position: absolute; z-index: 20; min-width: 240px; padding: 6px 0; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 8px 28px rgba(0, 0, 0, .35); }
.room-menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; border: 0; background: transparent; color: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.room-menu-item:hover, .room-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.room-menu-item.danger { color: var(--danger); }
.room-pop-note { margin-top: 4px; padding: 8px 16px 6px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; }
.room-react-pop { display: flex; min-width: 0; padding: 6px 8px; border-radius: 999px; }
.room-react-btn { padding: 4px 6px; border: 0; border-radius: 50%; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; transition: transform .1s; }
.room-react-btn:hover, .room-react-btn:focus-visible { background: var(--surface-2); transform: scale(1.15); outline: none; }

/* --- Painel lateral --------------------------------------------------------------- */
.room-panel { flex: none; display: flex; flex-direction: column; width: 360px; min-height: 0; border-radius: 12px; background: var(--surface); color: var(--text); }
.room-panel-head { display: flex; align-items: center; padding: 12px 12px 8px 20px; }
.room-panel-head h2 { flex: 1; margin: 0; font-size: 17px; font-weight: 500; }
.room-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; padding: 4px 20px 16px; }
.room-section-title { margin: 16px 0 6px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.room-section-title:first-child { margin-top: 4px; }

.room-chat { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.room-tabs { display: flex; border-bottom: 1px solid var(--border); }
.room-tab { padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.room-tab.active { border-bottom-color: var(--accent); color: var(--text); }
.room-chat-list { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 120px; overflow-y: auto; padding: 12px 0; }
.room-chat-msg .body { font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.room-chat-msg.question .body { padding-left: 8px; border-left: 3px solid var(--accent); }
.q-badge { margin-left: 6px; }
.room-chat-compose { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.room-chat-input { resize: none; }
.room-ask { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; cursor: pointer; }

.room-people-head { gap: 8px; margin-bottom: 4px; }
.room-hands { margin-top: 8px; padding: 4px 12px 10px; border-radius: var(--radius); background: var(--warning-bg); }
.room-hand-row { gap: 8px; padding: 4px 0; }
.room-person { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.room-person-name { font-weight: 500; overflow-wrap: anywhere; }
.room-person-icon { display: inline-flex; color: var(--text-muted); }
.room-person-icon.off { color: var(--danger); }
.room-person-actions { position: relative; }
.room-person-menu { top: 100%; right: 0; }

.room-switch { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 10px 0; cursor: pointer; }
.room-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.room-switch-label { display: block; font-weight: 500; }
.room-switch .muted { display: block; }
.room-switch-ui { position: relative; flex: none; width: 36px; height: 20px; margin-top: 2px; border-radius: 999px; background: var(--border-strong); transition: background .15s; }
.room-switch-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.room-switch input:checked + .room-switch-ui { background: var(--accent); }
.room-switch input:checked + .room-switch-ui::after { transform: translateX(16px); }
.room-switch input:focus-visible + .room-switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
.room-host .btn-block { margin: 6px 0; }
.room-settings .select { width: 100%; }
.room-effects { display: flex; flex-wrap: wrap; gap: 6px; }

/* --- Sala de espera ----------------------------------------------------------------- */
.room.lobby { overflow-y: auto; }
.lobby-inner { display: flex; align-items: center; gap: 48px; width: 100%; max-width: 1120px; margin: auto; padding: 32px; }
.lobby-preview { position: relative; flex: 1.6; min-width: 0; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: var(--room-tile); }
.lobby-preview video { display: block; width: 100%; height: 100%; object-fit: cover; }
.lobby-preview video.mirror { transform: scaleX(-1); }
.lobby-avatar { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.lobby-avatar[hidden] { display: none; }
.lobby-avatar .avatar { width: 110px; height: 110px; font-size: 40px; }
.lobby-off { color: var(--room-text); font-size: 18px; }
.lobby-name { position: absolute; top: 12px; left: 16px; font-weight: 500; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.lobby-note { position: absolute; top: 44px; left: 16px; right: 16px; padding: 8px 12px; border-radius: 8px; background: rgba(32, 33, 36, .9); font-size: 13px; }
.lobby-controls { position: absolute; bottom: 16px; left: 50%; display: flex; gap: 16px; transform: translateX(-50%); }
.lobby-controls .room-btn { width: 56px; height: 56px; border: 1px solid rgba(255, 255, 255, .7); background: rgba(32, 33, 36, .3); }
.lobby-controls .room-btn:hover { background: rgba(255, 255, 255, .15); }
.lobby-controls .room-btn.off { border-color: var(--room-red); background: var(--room-red); }
.lobby-meter { position: absolute; left: 16px; bottom: 24px; width: 90px; height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .25); }
.lobby-meter span { display: block; width: 0; height: 100%; background: #81c995; transition: width .08s linear; }
.lobby-meter[hidden] { display: none; }
.settings-meter { position: static; width: 100%; margin: -4px 0 12px; background: var(--border); }
.lobby-side { display: flex; flex: 1; flex-direction: column; gap: 12px; min-width: 260px; }
.lobby-side h2 { margin: 0; font-size: 28px; font-weight: 400; }
.lobby-title { margin: 0; color: var(--room-muted); }
.lobby-devices { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.lobby-device { display: flex; align-items: center; gap: 10px; color: var(--room-muted); }
.lobby-device .select { background: #303134; color: var(--room-text); border-color: #5f6368; }
.lobby-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.lobby-join { padding: 12px 26px; border: 0; border-radius: 999px; background: var(--room-blue); color: var(--room-bg); font-size: 15px; }
.lobby-join:hover { background: #aecbfa; }
.lobby-back { padding: 12px 22px; border-color: #5f6368; border-radius: 999px; background: transparent; color: var(--room-blue); }
.lobby-hint { margin: 0; color: var(--room-muted); font-size: 12px; }

/* --- Celular e telas estreitas --------------------------------------------------------- */
@media (max-width: 800px) {
  .lobby-inner { flex-direction: column; gap: 16px; padding: 16px; }
  .lobby-preview { flex: none; width: 100%; }
  .lobby-side { width: 100%; min-width: 0; }
  .lobby-side h2 { font-size: 22px; }
}
@media (max-width: 700px) {
  .room-body { padding: 8px 8px 0; }
  .room-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; height: auto; padding: 8px; }
  .room-bar-left { display: none; }
  .room-bar-center, .room-bar-right { gap: 6px; }
  .room-btn, .room-side-btn { width: 44px; height: 44px; }
  .room-leave { width: 56px; height: 44px; }
  .room-caret { display: none; }
  .room-split { background: transparent; }
  .room-panel { position: absolute; inset: 0; z-index: 10; width: auto; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .room-tile, .tile-hover, .room-switch-ui, .room-switch-ui::after { transition: none; }
  .tile-hand, .room-rec-dot { animation: none; }
}

/* --- Convidado externo esperando para entrar (roomGuests.js) ----------------------- */
.room-guests { position: absolute; top: 16px; left: 50%; z-index: 20; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); transform: translateX(-50%); }
.room-guest-row { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
.guest-links { display: flex; flex-direction: column; gap: 4px; }
.guest-link-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.guest-link-result { margin-top: 12px; }
