/* 对话页样式 - PC端 */

/* 主容器 */
.chat-container {
    display: flex;
    height: calc(100vh - 150px);
    max-width: 1400px;
    margin: 20px auto 0;
    padding: 12px;
    gap: 12px;
}

/* 侧边栏 */
.chat-sidebar {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Agent列表 */
.agent-section {
    padding: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.agent-section .section-title,
.history-section .section-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    padding-left: 8px;
    border-left: 3px solid var(--primary-color);
}

.agent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.agent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.3);
}

.agent-item:hover {
    background: #05AFB5;
    color: white;
}

.agent-item:hover .agent-desc {
    color: rgba(255, 255, 255, 0.8);
}

.agent-item.active {
    background: #05AFB5;
    color: white;
    box-shadow: 0 4px 16px rgba(5, 175, 181, 0.3);
}

.agent-item.active .agent-desc {
    color: rgba(255, 255, 255, 0.8);
}

.agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    background: #05AFB5;
    color: white;
    flex-shrink: 0;
}

.agent-avatar.large {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 20px;
}

.agent-avatar.small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 14px;
}

.agent-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.agent-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agent-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* 历史会话 */
.history-section {
    padding: 15px;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    flex: 1;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.4);
}

.history-icon {
    font-size: 14px;
}

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

/* 聊天主区域 */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

/* 聊天头部 */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 12px;
}

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

.agent-status {
    font-size: 12px;
    color: #4CAF50;
}

.agent-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    margin-right: 6px;
}

.btn-clear {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.5);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-clear:hover {
    background: rgba(255, 100, 100, 0.2);
    color: #ff6b6b;
}

/* 消息列表 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 消息气泡 */
.message {
    display: flex;
    gap: 12px;
    max-width: 80%;
    align-items: flex-start;
}

.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.message-avatar {
    flex-shrink: 0;
}

.message-avatar .agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    background: #05AFB5;
    color: white;
    box-shadow: 0 2px 8px rgba(5, 175, 181, 0.3);
}

/* 用户头像 */
.message-user .message-avatar {
    position: relative;
}

.message-user .message-avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #05AFB5;
    border: 2px solid white;
}

.message-content {
    padding: 14px 18px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.message-user .message-content {
    background: #05AFB5;
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px rgba(5, 175, 181, 0.25);
}

.message-ai .message-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* 加载动画 */
.message-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.78);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes loadingBounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.loading-text {
    color: #888;
    font-size: 14px;
}

/* 输入区域 */
.chat-input-area {
    padding: 12px 20px;
    border-radius: 16px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border-radius: 24px;
    border: 2px solid rgba(200, 200, 200, 0.3);
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    max-height: 300px;
    min-height: 150px;
}

.chat-input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(5, 175, 181, 0.12);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #05AFB5 0%, #6DCFDE 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(5, 175, 181, 0.3);
}

.btn-send:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(5, 175, 181, 0.45);
}

.btn-send:active {
    transform: scale(0.95);
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar,
.agent-list::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.agent-list::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb,
.agent-list::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
    background: #05AFB5;
    border-radius: 3px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .chat-sidebar {
        width: 240px;
        min-width: 240px;
    }

    .message {
        max-width: 90%;
    }
}

@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
        margin-top: 60px;
        padding: 10px;
    }

    .chat-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 200px;
    }

    .agent-list {
        max-height: 120px;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .agent-item {
        flex: 1;
        min-width: 140px;
    }

    .history-section {
        display: none;
    }
}

/* 版权信息 - PC端 */
.copyright {
    text-align: center;
    padding: 12px;
    margin-top: 10px;
}

.copyright p {
    font-size: 12px;
    color: #234C4F;
    margin: 0;
}
