/* css/chat.css */

.main-chat {
    padding: 80px 20px 60px;
    min-height: calc(100vh - 80px - 70px);
    background: linear-gradient(135deg, #506ef7 0%, #748bf3 100%);
    color: white;
}

.main-chat .container {
    max-width: 1000px;
}

.main-chat h2 {
    text-align: center;
    font-size: 2.3rem;
    margin-bottom: 10px;
}

.main-chat .subtitle {
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 20px;
}

.chat-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    height: 420px;
}

.agent-avatar {
    flex: 0 0 200px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.agent-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.chat-messages {
    flex: 1;
    background: rgba(244, 240, 240, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 20px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.6;
}

/* 替换原有的 .message 样式 */
.message {
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    background: #e3f2fd; /* 浅蓝色 */
    color: #0d47a1;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.message.assistant,
.message.system {
    background: #f9f9f9; /* 浅灰白 */
    color: #333;
    border-bottom-left-radius: 5px;
}

.message strong {
    font-weight: 600;
    color: #d32f2f; /* 红色强调 */
    display: block;
    margin-bottom: 6px;
}

/* 图片样式 */
.ai-image {
    margin-top: 10px;
    text-align: center;
}

.ai-image img {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: inline-block;
}

/* 输入区域 */
.input-area {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    resize: none;
    background: rgba(255, 255, 255, 0.9);
}

#user-input:focus {
    outline: none;
    border-color: #d32f2f;
}

#send-btn {
    padding: 0 25px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

#send-btn:hover {
    background: #b71c1c;
}

/* 响应式 */
@media (max-width: 768px) {
    .chat-wrapper {
        flex-direction: column;
        height: auto;
    }

    .agent-avatar {
        flex: none;
        height: 200px;
    }

    .chat-messages {
        height: 300px;
    }
}
/* css/chat.css 中新增或修改 */
.agent-avatar {
  position: relative;
  flex: 0 0 200px;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

.agent-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none; /* 默认隐藏 */
}

.agent-video#agent-video-idle {
  display: block; /* 初始只显示 idle */
}