* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #262626;
    --accent-primary: #2aa5f7;
    --accent-secondary: #00d4aa;
    --accent-hint: #ff4c88;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-tertiary: #808080;
    --border-color: #333333;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* 左侧联系人栏 */
.contacts-sidebar {
    width: 280px;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.sidebar-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    min-height: 0;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.contact-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.contact-item.active {
    background-color: rgba(0, 168, 255, 0.1);
    border-left: 3px solid var(--accent-primary);
}

/* 未读消息红点 */
.contact-unread-dot {
    position: absolute;
    top: 1px;
    left: 60px;
    width: 10px;
    height: 10px;
    background-color: var(--accent-hint);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: 600;
    color: var(--accent-secondary);
}

.contact-info {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 500;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-left: 8px;
    flex-shrink: 0;
}

.contact-last-msg {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 右侧主聊天区 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
    min-height: 0;
    /* 重要：允许内部flex容器滚动 */
}

.chat-header {
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.chat-contact {
    display: flex;
    align-items: center;
}

.chat-contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    display: flex;
    align-items: center;
    /* justify-content: center; */
    margin-right: 12px;
    font-weight: 600;
}

.chat-contact-info h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-contact-info p {
    font-size: 13px;
    color: var(--accent-secondary);
}

.messages-container {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* 重要：允许flex容器内滚动 */
}

.message {
    max-width: 70%;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.message.received {
    align-self: flex-start;
}

.message.sent {
    align-self: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message.received .message-bubble {
    background-color: var(--bg-tertiary);
    border-bottom-left-radius: 4px;
}

.message.sent .message-bubble {
    background-color: var(--accent-primary);
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
    align-self: flex-end;
}

.message.sent .message-time {
    align-self: flex-end;
}

.message-input-area {
    padding: 20px 32px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: flex-end;
    background-color: var(--bg-primary);
    flex-shrink: 0;
    /* 防止输入框被挤压 */
}

.message-input-wrapper {
    flex: 1;
    background-color: var(--bg-secondary);
    border-radius: 24px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    margin-right: 16px;
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    max-height: 120px;
    outline: none;
    font-family: inherit;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-button {
    background-color: var(--accent-primary);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.send-button:hover {
    background-color: #0097e6;
}

.send-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-tertiary);
    text-align: center;
    padding: 40px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* 确保联系人列表和消息容器的滚动条正常工作 */
/* 这部分样式已经在上面定义了，这里不需要重复 */