#comments-popup {
  display: none;
  position: absolute;
  right: 2em;
  /* top: 10em; */
  z-index: 1000;
  width: 350px;
  transition: all 0.2s;
}

#comments-list {
  margin-top: 0.5em;
    overflow-y: auto;
    height: 380px;
    /* align to vertical bottom */
    display: flex;
    flex-direction: column-reverse;
}

#new-comment-form {
    margin-top: auto;
}

#new-comment-form textarea {
  width: 94%;
  resize: vertical;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  padding: 0.5em;
}

#new-comment-form button[type="submit"] {
  margin-top: 0.5em;
  float: right;
}

.comment-item {
    border-top: 1px solid var(--color-border);
    padding: 0.5em 0 1.5em 0;
    position: relative;
}

.comment-item.last-read {
    border-bottom: 2px solid var(--color-border);
}

.comment-content {
    margin-top:0.2em;
    white-space:pre-line;
}

.comment-action-container {
    position: absolute;
    bottom: 0.2em;
    right: 0.2em;
    display: flex;
    gap: 0.2em;
}

.delete-comment-btn,
.edit-comment-btn {
    border: none;
    background: none;
    font-weight: bold;
    cursor: pointer;
}

@media (max-width: 600px) {
    #comments-popup {
        position: fixed;
        right: 0;
        left: 0;
        top: auto;
        bottom: env(keyboard-inset-height, 0);
        width: auto;
        min-width: 0;
        max-width: none;
        padding: 0.5em;
        border-radius: 10px 10px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s;
    }

    #comments-popup.open {
        transform: translateY(0);
    }
}

.comment-item.highlight-flash {
    animation: comment-flash 2s ease-out;
}

@keyframes comment-flash {
    from { background: #ffff99; }
    to { background: transparent; }
}

#comment-participants {
  margin-bottom: 0.3em;
}

.comment-presence-avatar {
  margin-right: 0.2em;
}

.comment-presence-avatar.inactive {
  opacity: 0.4;
  filter: grayscale(1);
}
