/* Internal Chat Styles */
.internal-chat {
    display: flex;
    height: 100%;
    min-height: 0;
    background: transparent;
    gap: 0;
    overflow: hidden;
}

/* Sidebar */
.internal-chat .chat-sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--kui-bgcolor, #fff);
    border-right: 1px solid var(--kui-color-border, #e8e8e8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.internal-chat .chat-sidebar .sidebar-header {
    padding: 16px 16px 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--kui-color, #2c3e50);
    border-bottom: 1px solid var(--kui-color-border, #e8e8e8);
    display: flex;
    align-items: center;
    gap: 8px;
}

.internal-chat .chat-sidebar .sidebar-header .unread-badge {
    background: var(--kui-primary-color, #1890ff);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    padding: 0 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
    line-height: 20px;
}

.internal-chat .chat-sidebar .user-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.internal-chat .chat-sidebar .user-list .loading,
.internal-chat .chat-sidebar .user-list .empty {
    text-align: center;
    padding: 40px 16px;
    color: #999;
    font-size: 14px;
}

.internal-chat .chat-sidebar .user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.internal-chat .chat-sidebar .user-item:hover {
    background: rgba(24, 144, 255, 0.04);
}

.internal-chat .chat-sidebar .user-item.active {
    background: rgba(24, 144, 255, 0.1);
}

.internal-chat .chat-sidebar .user-item .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--kui-primary-color, #1890ff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex-shrink: 0;
}

.internal-chat .chat-sidebar .user-item .user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.internal-chat .chat-sidebar .user-item .user-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--kui-color, #2c3e50);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.internal-chat .chat-sidebar .user-item .user-preview {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.internal-chat .chat-sidebar .user-item .badge {
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 0 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    line-height: 18px;
    flex-shrink: 0;
}

/* Main Chat Area */
.internal-chat .chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--kui-bgcolor, #fff);
}

.internal-chat .chat-main .chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #bbb;
}

.internal-chat .chat-main .chat-placeholder .placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.internal-chat .chat-main .chat-placeholder .placeholder-text {
    font-size: 16px;
}

.internal-chat .chat-main .chat-header {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--kui-color, #2c3e50);
    border-bottom: 1px solid var(--kui-color-border, #e8e8e8);
}

.internal-chat .chat-main .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.internal-chat .chat-main .empty-msg {
    text-align: center;
    padding: 40px;
    color: #bbb;
    font-size: 14px;
}

.internal-chat .chat-main .msg-item {
    display: flex;
    gap: 10px;
    max-width: 75%;
}

.internal-chat .chat-main .msg-item.mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.internal-chat .chat-main .msg-item.other {
    align-self: flex-start;
}

.internal-chat .chat-main .msg-item .msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.internal-chat .chat-main .msg-item.mine .msg-avatar {
    background: var(--kui-primary-color, #1890ff);
}

.internal-chat .chat-main .msg-item.other .msg-avatar {
    background: #52c41a;
}

.internal-chat .chat-main .msg-item .msg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    position: relative;
    word-break: break-word;
}

.internal-chat .chat-main .msg-item.mine .msg-bubble {
    background: var(--kui-primary-color, #1890ff);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.internal-chat .chat-main .msg-item.other .msg-bubble {
    background: #f0f0f0;
    color: var(--kui-color, #2c3e50);
    border-bottom-left-radius: 4px;
}

.internal-chat .chat-main .msg-item .msg-content {
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.internal-chat .chat-main .msg-item .msg-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

/* Input Area */
.internal-chat .chat-main .chat-input {
    padding: 12px 20px;
    border-top: 1px solid var(--kui-color-border, #e8e8e8);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.internal-chat .chat-main .chat-input .ant-input,
.internal-chat .chat-main .chat-input textarea {
    flex: 1;
    border-radius: 8px;
    border: 1px solid var(--kui-color-border, #d9d9d9);
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s;
    min-height: 40px;
}

.internal-chat .chat-main .chat-input .ant-input:focus,
.internal-chat .chat-main .chat-input textarea:focus {
    border-color: var(--kui-primary-color, #1890ff);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
    outline: none;
}

/* Dark Theme */
:root[data-theme=dark] .internal-chat .chat-sidebar {
    background: var(--kui-bgcolor, #141414);
    border-color: var(--kui-color-border, #434343);
}

:root[data-theme=dark] .internal-chat .chat-main {
    background: var(--kui-bgcolor, #141414);
}

:root[data-theme=dark] .internal-chat .chat-sidebar .sidebar-header {
    border-color: var(--kui-color-border, #434343);
}

:root[data-theme=dark] .internal-chat .chat-main .chat-header {
    border-color: var(--kui-color-border, #434343);
}

:root[data-theme=dark] .internal-chat .chat-main .chat-input {
    border-color: var(--kui-color-border, #434343);
}

:root[data-theme=dark] .internal-chat .chat-main .msg-item.other .msg-bubble {
    background: #1e1e1e;
    color: var(--kui-color, #e8e8e8);
}

/* Menu badge for top/sidebar navigation */
.kui-menu-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 8px;
    background: #ff4d4f;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    margin-left: 4px;
    vertical-align: top;
}
