:root {
    --primary-color: #12b7f5;
    --primary-dark: #0e93c9;
    --text-dark: #333333;
    --text-light: #777777;
    --white: #ffffff;
    --light-bg: #f5f5f5;
    --border-color: #e5e5e5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%; /* 由flex填充 */
}

.chat-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 500;
}

.header-title i {
    margin-right: 8px;
    font-size: 1.2rem;
}

.agent-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.agent-selector {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 10px;
}

.agent-selector i {
    margin-right: 6px;
    color: var(--white);
}

.agent-selector select {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 14px;
    outline: none;
    padding: 4px;
    cursor: pointer;
}

.agent-selector select option {
    color: var(--text-dark);
    background-color: var(--white);
}

.reset-button {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reset-button i {
    font-size: 12px;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background-color: var(--light-bg);
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    height: 100%;
}

.message {
    margin-bottom: 16px;
    max-width: 85%;
    word-wrap: break-word;
    position: relative;
    display: flex;
    flex-direction: column;
    clear: both;
}

.message-info {
    margin-bottom: 4px;
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    padding: 0 6px;
}

.agent-name {
    font-weight: 500;
    color: var(--text-dark);
}

.user-message {
    float: right;
    margin-left: auto;
}

.user-message .message-content {
    background-color: var(--primary-color);
    color: var(--white);
    border-radius: 16px 4px 16px 16px;
    margin-left: auto;
}

.bot-message {
    float: left;
    margin-right: auto;
}

.bot-message .message-content {
    background-color: var(--white);
    color: var(--text-dark);
    border-radius: 4px 16px 16px 16px;
}

.message-content {
    padding: 10px 14px;
    line-height: 1.4;
    width: fit-content;
    max-width: 100%;
}

.typing-indicator {
    display: none;
    padding: 8px 12px;
    align-items: center;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--light-bg);
    z-index: 10;
}

.typing-dots {
    display: flex;
    margin-right: 8px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    margin: 0 2px;
    background-color: var(--text-light);
    border-radius: 50%;
    display: inline-block;
    opacity: 0.7;
    animation: dot-pulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0s;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-pulse {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

.typing-text {
    font-size: 13px;
    color: var(--text-light);
}

.input-area {
    display: flex;
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background-color: var(--white);
    flex-shrink: 0;
}

.input-area input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    background-color: var(--white);
    color: var(--text-dark);
}

.input-area button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer {
    text-align: center;
    padding: 10px;
    border-top: 1px solid var(--border-color);
    background-color: var(--white);
    font-size: 12px;
    color: var(--text-light);
}

.disclaimer-link {
    color: var(--text-light);
    text-decoration: none;
}

.system-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    margin: 0;
    padding: 8px 16px;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 14px;
    border-radius: 4px;
    z-index: 100;
    max-width: 90%;
    white-space: nowrap;
}

/* 清除浮动 */
.messages::after {
    content: "";
    display: table;
    clear: both;
}

/* === 取消圆角以避免微信缩放 === */
.user-message .message-content,
.bot-message .message-content,
.input-area input {
    border-radius: 0 !important;
}