/* GattoMusic 2.0 - Build 9.76
   Geometria defensiva do Chat + Sala, rolagens independentes e viewport dinâmica. */

/* O workspace ocupa apenas a área útil entre topo e rodapé do Chat. */
body.chat-view-active .main-column,
body.chat-view-active .content,
body.chat-view-active .view-content,
body.chat-view-active .chat-workspace-panel,
body.chat-view-active .chat-shell,
body.chat-view-active .chat-sidebar,
body.chat-view-active .chat-conversation{
  min-width:0!important;
  min-height:0!important;
  box-sizing:border-box!important;
}
body.chat-view-active .content{
  overflow:hidden!important;
}
body.chat-view-active .view-content{
  height:100%!important;
  max-height:100%!important;
  overflow:hidden!important;
}
body.chat-view-active .chat-workspace-panel{
  height:100%!important;
  max-height:100%!important;
  overflow:hidden!important;
  border-radius:16px!important;
}
body.chat-view-active .chat-shell{
  height:100%!important;
  max-height:100%!important;
  overflow:hidden!important;
}

/* Topo da conversa é uma linha estrutural fixa; só a lista de mensagens rola. */
body.chat-view-active .chat-conversation{
  height:100%!important;
  max-height:100%!important;
  grid-template-rows:auto minmax(0,1fr) auto auto!important;
}
body.chat-view-active .chat-conversation-header{
  position:relative!important;
  z-index:12!important;
  flex:0 0 auto!important;
  width:100%!important;
  max-width:100%!important;
  overflow:visible!important;
  box-sizing:border-box!important;
}
body.chat-view-active .chat-message-list{
  min-height:0!important;
  overflow-y:auto!important;
  overscroll-behavior:contain!important;
}

/* Base do Chat: viewport-fixed, inteira e sem scroll do próprio cartão. A altura
   reservada por --player corresponde à altura real, evitando corte dos cantos. */
body.chat-view-active.chat-footer-active .player-bar.chat-mode{
  position:fixed!important;
  left:10px!important;
  right:10px!important;
  bottom:max(8px,env(safe-area-inset-bottom))!important;
  width:auto!important;
  height:calc(var(--player) - 8px)!important;
  min-height:0!important;
  max-height:none!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
  border:1px solid var(--line)!important;
  border-radius:16px!important;
  padding:10px 12px!important;
  z-index:520!important;
}
body.chat-view-active.chat-footer-active .player-bar.chat-mode .chat-footer-mode,
body.chat-view-active.chat-footer-active .player-bar.chat-mode .chat-footer-shell{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}
body.chat-view-active.chat-footer-active .chat-footer-shell{
  grid-template-rows:auto auto minmax(0,1fr)!important;
  align-content:stretch!important;
}
body.chat-view-active.chat-footer-active .chat-footer-shell>.chat-composer{
  min-height:0!important;
  max-height:100%!important;
  overflow:auto!important;
  overscroll-behavior:contain!important;
  box-sizing:border-box!important;
}
body.chat-view-active.chat-footer-active .app-shell{
  padding-bottom:var(--player)!important;
}

/* Contatos possuem uma única rolagem soberana; o último item ganha folga real. */
body.chat-view-active .chat-sidebar{
  overflow:hidden!important;
}
body.chat-view-active .chat-contact-list{
  flex:1 1 auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding-bottom:max(24px,env(safe-area-inset-bottom))!important;
  scroll-padding-bottom:24px!important;
  overscroll-behavior:contain!important;
  overflow-anchor:none!important;
}

/* Ao abrir Sala em um monitor menor, reduzir o painel lateral antes de sacrificar
   a conversa. Em monitores grandes, a largura histórica continua vigente. */
@media(min-width:821px) and (max-width:1600px){
  body.chat-view-active{--chat-v972-room-panel:clamp(280px,28vw,430px)!important}
}
@media(min-width:821px) and (max-width:1100px){
  body.chat-view-active{--chat-v972-room-panel:clamp(260px,29vw,320px)!important}
}

/* v7.3 vira single-pane quando o workspace encolhe abaixo de 1100 px. Com uma
   Sala aberta isso escondia a conversa. Esta classe é aplicada por medição real
   depois de resize/visualViewport e mantém Contatos + Conversa lado a lado. */
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist{
  display:grid!important;
  grid-template-columns:minmax(170px,26%) 7px minmax(300px,1fr)!important;
  gap:0!important;
  position:relative!important;
  overflow:hidden!important;
}
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist>.chat-sidebar{
  grid-column:1!important;
  position:relative!important;
  inset:auto!important;
  width:auto!important;
  height:100%!important;
  transform:none!important;
  opacity:1!important;
  pointer-events:auto!important;
  z-index:20!important;
}
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist>#chatV73LeftSplitter{
  display:block!important;
  grid-column:2!important;
}
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist>.chat-conversation{
  grid-column:3!important;
  position:relative!important;
  inset:auto!important;
  width:auto!important;
  height:100%!important;
  min-width:0!important;
  transform:none!important;
  opacity:1!important;
  pointer-events:auto!important;
  z-index:30!important;
}
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist>#chatV73RightSplitter,
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist>.chat-v72-info-panel,
body.chat-v976-room-coexist .chat-shell.chat-v976-room-coexist>.chat-v73-info-backdrop{
  display:none!important;
}

/* Sala e workspace compartilham topo/base visualmente, sem perder cantos. */
@media(min-width:821px){
  .chat-room-sidepanel-v972{
    top:76px!important;
    right:10px!important;
    bottom:calc(var(--player,0px) + 8px)!important;
    max-height:calc(100dvh - 84px - var(--player,0px))!important;
    border-radius:16px!important;
    box-sizing:border-box!important;
  }
  body.chat-view-active.chat-footer-active .chat-room-sidepanel-v972{
    bottom:calc(var(--player) + 8px)!important;
  }
}

/* Android/mobile: preservar safe-area e manter base inteira. */
@media(max-width:820px){
  body.chat-view-active.chat-footer-active .player-bar.chat-mode{
    left:7px!important;
    right:7px!important;
    bottom:max(5px,env(safe-area-inset-bottom))!important;
    height:calc(var(--player) - 6px)!important;
    border-radius:14px!important;
    padding:8px!important;
  }
  .chat-room-sidepanel-v972{
    bottom:calc(var(--player,0px) + 7px)!important;
    max-height:calc(100dvh - 73px - var(--player,0px))!important;
  }
}

/* Destaque solicitado por Início/Fim: a música alvo fica fácil de identificar. */
.song-row.position-highlight,.playlist-editor-row.position-highlight{
  scroll-margin-block:12px!important;
}
/* Opções de dispositivos: "Atualizar dispositivos" acompanha o seletor de
   Câmera, não a altura total label+select. Assim o botão deixa de virar um card
   alto e fica alinhado pela base com o campo da câmera. */
.chat-room-sidepanel-v972 .chat-room-device-grid-v969{
  grid-auto-rows:auto!important;
  align-items:end!important;
}
.chat-room-sidepanel-v972 .chat-room-device-field-v969{
  min-height:0!important;
  height:auto!important;
  align-self:stretch!important;
}
.chat-room-sidepanel-v972 .chat-room-device-grid-v969>.button{
  min-height:38px!important;
  height:38px!important;
  align-self:end!important;
  justify-self:stretch!important;
  padding:8px 12px!important;
  box-sizing:border-box!important;
}
.chat-room-sidepanel-v972 .chat-room-device-field-v969 select{
  min-height:38px!important;
  height:38px!important;
  box-sizing:border-box!important;
}

