/* CHAT CSS */

.chat-has-messages {
    background-color: var(--success);
}

.room-link {
    border: 2px solid var(--light);
    cursor: pointer;
    display: flex;
    font-family: 'Noto Sans Mono', monospace;
    font-size: 1.0rem;
    justify-content: space-between;
    margin: .1rem;
    padding: .1rem .2rem .2rem .2rem;
    text-overflow: ellipsis;
    min-width: 0; /* Prevent flex container from overflowing */
    width: 100%; /* Force full width of parent */
    box-sizing: border-box; /* Include border and padding in width */
}

.room-link.joined {
    border: 2px solid var(--info);
    background: #3399f3;
    color: var(--dark);
}

/* Style room that was not seen yet */
.room-not-seen {
    color: var(--success);
    border: 2px solid var(--info);
}

.room-link[data-room-type="public"] {
    text-transform: uppercase!important;
}

.chat-functions {
    background: var(--danger);
    color: #f0f1cd;
}

.list-of-chats,
.list-of-pms {
    display: flex;
    flex-direction: column;
}

/* Scrollable left and right columns  */
.overflow-auto {
    min-height: 200px;
    background: var(--bg-dim);
    padding: 0.5rem;
}

#div-room-list {
    margin-bottom: 50px;
    box-sizing: border-box;
}

#div-room-list .row {
    margin-left: 0;
    margin-right: 0;
}

#div-room-list .col-scrollable {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

/* Scrollbar styling */
/* Track */
::-webkit-scrollbar-track {
    background: var(--light);
}
/* Handle */
::-webkit-scrollbar-thumb {
    background: var(--gray);
}
/* Handle on hover */
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

#chats .room {
    padding: 5px;
}

#chats h5 {
    color: var(--pink);
    margin: 2px 0 5px 0;
    font-weight: bold;
}

#chats .messages {
    /* Mobile: flexible height that fits screen */
    height: 400px;
    max-height: 60vh; /* Don't exceed 60% of viewport height */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-dim);
}

#chats .username {
    color: var(--orange);
    font-weight: bold;
}

.chat-wrapper {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.chat-wrapper #chats {
  flex: 1;
  min-width: 0; /* Allow flex item to shrink */
}

.chat-wrapper #div-room-list {
  flex: 0 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .chat-wrapper {
    position: relative;
    min-height: calc(100vh - 250px); /* Adjust for header/footer */
  }
  .chat-wrapper #chats {
    flex: 1;
    min-width: 0;
    min-height: 600px;
  }
  .chat-wrapper #div-room-list {
    min-height: 600px;
  }
  .chat-wrapper #chats .room {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .chat-wrapper #chats .room .messages {
    flex: 1; /* Take remaining space */
    height: auto;
    min-height: 400px;
    max-height: calc(100vh - 180px); /* Desktop: fill screen minus headers */
  }
}

.room-name {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    white-space: nowrap;
    text-overflow: clip;
    overflow: hidden;
}

/* Style name of online user */
.online .room-name {
    color: var(--fg);
}

/* Message votes */
.msg-vote.active {
    font-weight: bold;
}

/* Style own upvote */
.msg-vote.active .fa-check {
    color: var(--teal);
}

/* Style own downvote */
.msg-vote.active .fa-times {
    color: var(--danger);
}

/* Preview images before sending */
.image-preview-container {
    position: absolute;
    display: flex;
    justify-content: center;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dim);
    padding: .3rem 0;
}

/* Preview instance */
.image-preview-container .preview-images .image-preview {
    width: 50px;
    height: 50px;
    background-color: var(--bg-dim);
    margin: .3rem;
    object-fit: cover;
}

/* Container for attached images inside message */
.attachment-image-container {
    display: flex;
    justify-content: start;
    flex-wrap: wrap;
    flex-basis: min-content;
}

/* Attached image inside message */
.attachment-image-container .attached-image {
    width: 150px;
    height: 150px;
    background-color: gray;
    object-fit: cover;
    margin: 2px;
}

/* Container for vote buttons */
.vote-block {
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: var(--warning);
    border-radius: 5px;
    padding: 0 3px 0 3px;
    margin-right: .2rem;
}
.vote-block i,
.vote-block div {
    padding: .2rem;
    color: black;
}

/* Message container */
.message {
    display: flex;
    margin-right: 10%;
    margin-bottom: .6rem;
    margin-left: .1rem;
    box-shadow: 3px 3px 5px 2px darkgray;
}
.text {
    overflow-wrap: anywhere;
}
.message.own {
    justify-content: flex-end;
    margin-left: 10%;
    margin-right: .6rem;
}
.message-content {
    min-width: 100%;
    padding: .2rem;
}

/* Header of message containing username and additional data/actions */
.message-header {
    padding: .2rem;
    margin-bottom: .4rem;
    display: flex;
    justify-content: space-between;
}
.message .body {
    margin-bottom: .2rem;
    display: inline-flex;
    flex-direction: column;
}
/* Additional information/actions for message */
.message .message-info {
    display: flex;
    margin-left: 1rem;
    align-items: center;
}

/* Additional actions for message */
.show-history,
.edit-message {
    text-decoration: underline;
    color: var(--fg);
    font-size: smaller;
    margin-right: 5px;
}

/* Alert about empty chat */
.empty-chat-message {
    font-size: 20;
    color: gray;
    margin-top: 200px;
    text-align: center;
}

/* Room header */
.room-header {
    width: 100%;
    text-align: center;
}

.header {
    background: var(--bg);
    padding: .3rem;
    color: #f0f1cd;
    min-height: 48px;
}
.date-banner {
    text-align: center;
    margin-top: .1rem;
    margin-bottom: .3rem;
}

/* Bottom part of room */
.chat-controls {
    display: flex;
    margin-top: 1rem;
}
.chat-controls-row {
    display: flex;
    flex: 1;
}
.chat-control {
    padding: .5rem;
    font-size: 1.5rem;
}
label {
    margin: 0;
}
input[type='checkbox'] {
    width: 1.2rem;
    height: 1.2rem;
}
/* x at editing overlay */
.stop-editing {
    top: 0;
    right: 0;
}

/* Style label for disabled file input */
input[type="file"]:disabled+label,
input[type="file"]:disabled+label:hover {
    background-color: #8d8d8d;
    border: 1px solid #555555;
    color: #d9d9d9;
}

.message-input {
    border: 3px solid #444;
    border-radius: .3rem;
    background-color: #303030;
    color: #fff;
    flex: 1;
}

/* Chat controls */
#room .chat-controls {
    display: block;
}

/* Chat controls layout */
#room .chat-controls > div {
    display: flex;
    justify-content: space-between;
    flex-wrap: nowrap;
}

/* Make table rows clickable */
td a {
    display: block;
    text-decoration: none;
    color: var(--white);
}

/* Overwrite bootstrap - borders */
.list-group-item + .list-group-item {
    border-top-width: 2;
}

/* For Board and TinyMCE. Makes pictures responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Hide Google Translation icon */
#gtx-trans { 
    display: none !important;
}
