/* Room layout and resize handle */

.chat-video-resize-handle {
  display: none;
}

@media (min-width: 961px) {
  .rudelguck-app:not(.player-popup, .player-detached) .chat-video-resize-handle {
    display: block;
    position: absolute;
    grid-area: player;
    left: 0;
    top: 0;
    bottom: 0;
    width: 12px;
    transform: translateX(-50%);
    z-index: 25;
    cursor: col-resize;
    touch-action: none;
    background: transparent;
  }

  .chat-video-resize-handle::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #424650;
  }

  .chat-video-resize-handle:hover::before,
  .chat-video-resize-handle:focus-visible::before,
  .chat-video-resize-handle.is-dragging::before {
    width: 2px;
    background: #9eacc5;
  }

  .chat-video-resize-handle:focus-visible {
    outline: 2px solid #9eacc5;
    outline-offset: -2px;
  }

  body:has(.chat-video-resize-handle.is-dragging) {
    cursor: col-resize;
    user-select: none;
  }
}

.workspace {
  --chat-column-width: clamp(270px, 23%, 400px);
  flex: 1;
  min-height: 0;
  display: grid;
  position: relative;
  grid-template-columns: var(--chat-column-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "chat player" "composer composer";
}

@supports (width: attr(data-chat-width px)) {
  .workspace {
    --chat-column-width: attr(data-chat-width px, clamp(270px, 23%, 400px));
  }
}

.workspace > .sidebar {
  display: contents;
}

.workspace > .chat-composer {
  grid-area: composer;
}

.player-column {
  display: flex;
  grid-area: player;
  min-width: 0;
  min-height: 0;
}

.player-detached .workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "chat" "composer";
}

.player-popup .workspace {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "player";
}

.player-popup .workspace > .sidebar,
.player-popup .workspace > .chat-composer {
  display: none;
}

@media (max-width: 960px) {
  .rudelguck-app:not(.player-popup, .player-detached) .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas: "player" "chat" "composer";
  }

  .workspace .chat {
    border: 0;
    border-top: 1px solid #34373f;
  }
}

.player-detached .workspace .chat {
  border: 0;
}
