/* -------- Context menu -------- */
.context-menu {
    position: absolute;
    background-color: #fff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    padding: 0;
    margin: 0;
    list-style: none;
    z-index: 1000;
}

.context-menu li {
    padding: 8px 12px;
    cursor: pointer;
}

.context-menu li a {
    text-decoration: none;
    color: #333;
    display: block;
}

.context-menu li:hover {
    background-color: #eee;
}

.context-menu,
.context-menu li,
.context-menu li a {
    user-select: none;
    -moz-user-select: none;
    -webkit-user-select: none;
}

/* -------- Main containers -------- */
body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    /* padding and border are included in the element's width and height */
    box-sizing: border-box;
    display: flex;
    overflow: hidden;
}

/* The container for all conversations */
.conversation {
    display: flex;
    align-items: center;
    /* padding: 10px; */
    padding: 5px 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.conversation > * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.conversation:hover {
    background-color: #d3d3d3;
}

.conversation.selected {
    background-color: #f0f0f0;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 15%;
    margin-right: 10px;
    flex-shrink: 0;
}

.conversation-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    min-width: 0;
}

.conversation-name {
    font-weight: bold;
    color: #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
    min-width: 0;
}

.conversation-time {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.conversation-message {
    font-size: 14px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.plaintext-message {
    white-space: pre-wrap;  /* Preserves newlines, but allows text to wrap */
    word-wrap: break-word;  /* Breaks long words at arbitrary points if necessary */
    word-break: break-word; /* Fallback for older browsers */
    font-family: Roboto, monospace; /* Optional: Use a monospace font for plaintext */
}

/* Message collapse/expand */
.scroll-item .message-content {
    line-height: 1.4;
}

.scroll-item .message-content.collapsed {
    max-height: 5.6em; /* 4 lines * 1.4 line-height */
    overflow: hidden;
}

.scroll-item .message-toggle {
    display: none;
    text-align: right;
    color: #888;
    cursor: pointer;
    font-size: 12px;
    margin-top: 4px;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

.scroll-item .message-toggle:hover {
    color: #555;
}

/* Left column */
.left-column {
    width: 16%;
    background-color: #fff;
    overflow-y: hidden;
    border-right: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.left-column .logic-container {
    height: 3em;
    flex-shrink: 0;
}

.left-column #user-status-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.left-column #user-status-container span {
    background: #ccc;
    border-radius: 10px;
    width: fit-content;
    padding: 5px;
    user-select: none;
}

.left-column .conversation-list {
    overflow-y: auto;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    flex: auto;
}

/* Right column */
.right-column {
    width: 84%;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    background-color: #f5f5f5;
    border-left: 1px solid #ccc;
}

.scroll-container {
    flex: 1;
    width: 100%;
    overflow-y: scroll;
    overflow-x: hidden;
    padding: 10px 10px 0 10px;
    box-sizing: border-box;
}

.conversation-list::-webkit-scrollbar,
.scroll-container::-webkit-scrollbar {
    width: 10px;
}

.conversation-list::-webkit-scrollbar-thumb,
.scroll-container::-webkit-scrollbar-thumb {
    background-color: #888;
    border-radius: 10px;
}

.conversation-list::-webkit-scrollbar-thumb:hover,
.scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: #555;
}

.conversation-list::-webkit-scrollbar-track,
.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-item {
    width: 80%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 10px;
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); */
    font-family: Arial, sans-serif;
    word-wrap: break-word;
    color: #000;
}

/* Style for user messages */
.scroll-item.user {
    background-color: #e0f7fa;
    margin-left: auto;
    text-align: left;
    background: #DDC;
}

/* Style for responses (aligned left, pure white background) */
.scroll-item.response {
    background-color: #fff;
    margin-right: auto;
    text-align: left;
}

/* Nickname styling for response messages */
.nickname, .msg_top_delim, .msg_local_datetime {
    font-family: Roboto;
    
    margin-bottom: 5px;
    font-size: 14px;

    display: inline-block;
}

.msg_top_delim {
    display: inline-block;
}

.nickname {
    font-weight: bold;
    /* color: #32a852; */
    color: #A55;
}

.msg_local_datetime {
    color: #325252;
}

/* Text editor container */
.CodeMirror {
    /* height: auto; */
    flex: 1; 
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

/* Inline container for input and buttons */
.inline-container {
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 10px;
    display: inline-flex;
}

.inline-container>*:first-child {
    margin-right: 5px;
}

.inline-container>*:not(:first-child):not(:last-child) {
    margin-left: 5px;
    margin-right: 5px;
}

.inline-container>*:last-child {
    margin-left: 5px;
}

.inline-container button {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    background-color: #AFAFAF;
    color: white;
    cursor: pointer;
}

.inline-container button:hover {
    background-color: #A0A0A0;
}

.inline-container button#send_button {
    height: 100%;
}

/* Login interface */
#login_view {
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #d0cecc;
    font-family: Arial, sans-serif;
}

#login_view .form-circle {
    background: linear-gradient(17deg, #767571, #adaca8);
    border-radius: 50%;
    width: 400px;
    height: 400px;
    display: flex;
    aspect-ratio: 1;
    justify-content: center;
    align-items: center;
    box-shadow: -10px 10px 20px rgba(0, 0, 0, 0.5);
    border: 6px solid #ccc;
}

#login_view .form-circle-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    width: 80%;
}

#login_view input,
#login_view button {
    background-color: rgba(0, 0, 0, 0.2) !important;
    border: 3px solid #333;
    box-sizing: border-box;
    outline: none;
    padding: 8px;
    color: black;
    font-size: 15px;
    font-weight: bold;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#login_view input:focus,
#login_view input:active,
#login_view button:focus {
    background-color: rgba(0, 0, 0, 0.2);
    border-color: rgb(52, 52, 207);
}

#login_view input[type="text"],
#login_view input[type="password"],
#login_view button {
    width: 80%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}


