* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif; background: #f5f5f5; height: 100vh; display: flex; flex-direction: column; }

/* ==================== Header ==================== */
.header { display: flex; justify-content: space-between; align-items: center; padding: 0 20px; height: 50px; color: #fff; flex-shrink: 0; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { height: 30px; }
.site-name { font-size: 16px; font-weight: 600; }
.btn-end { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4); color: #fff; padding: 6px 16px; border-radius: 20px; font-size: 13px; cursor: pointer; }
.btn-end:hover { background: rgba(255,255,255,0.3); }
.cs-version { font-size: 10px; color: #999; margin-right: 8px; }

/* ==================== 三栏布局 ==================== */
.main { flex: 1; display: flex; overflow: hidden; }

/* 左栏 */
.sidebar-left { width: 260px; background: #fff; border-right: 1px solid #e8e8e8; display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; }
.agent-card { text-align: center; padding: 32px 16px 32px; }
.agent-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid #e8e8e8; }
.agent-name { font-size: 16px; font-weight: 600; margin-top: 8px; }
.rating-section { padding: 16px; border-top: 1px solid #f0f0f0; }
.rating-section h4 { font-size: 14px; color: #555; margin-bottom: 12px; }
.star-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.star-row .label { font-size: 13px; color: #666; width: 80px; text-align: right; }
.star-row .stars { color: #ddd; font-size: 16px; letter-spacing: 2px; transition: color 0.2s; }
.star-row:hover .stars, .star-row.active .stars { color: #f5a623; }
.rating-section textarea { width: 100%; border: 1px solid #ddd; border-radius: 6px; padding: 8px; font-size: 13px; resize: none; margin-top: 10px; font-family: inherit; }
.rating-section textarea:focus { outline: none; border-color: var(--theme-color, #667eea); }
.btn-submit { width: 100%; padding: 8px; border: none; border-radius: 6px; color: #fff; font-size: 14px; cursor: pointer; margin-top: 8px; }
.btn-submit:hover { opacity: 0.9; }

/* 中栏：聊天区 */
.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; }
.system-msg { text-align: center; color: #999; font-size: 13px; padding: 6px 16px; margin: 8px 0; border: 1px solid #e8e8e8; border-radius: 16px; background: #fafafa; }
.msg { display: flex; gap: 10px; margin-bottom: 14px; max-width: 80%; width: 100%; }
.msg.agent { align-self: flex-start; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.msg-body { display: flex; flex-direction: column; }
.msg-meta { font-size: 11px; color: #999; margin-bottom: 2px; }
.msg.user .msg-meta { text-align: right; }
.msg-bubble { padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.6; word-break: break-word; }
.msg.agent .msg-bubble { background: #fff; border: 1px solid #e8e8e8; border-top-left-radius: 2px; }
.msg.user .msg-bubble { color: #fff; border-top-right-radius: 2px; }
.msg-bubble a { color: inherit; text-decoration: underline; }

/* 输入区 */
.chat-input { padding: 8px 16px 12px; background: #fff; border-top: 1px solid #e8e8e8; }
.input-tools { display: flex; gap: 4px; padding: 4px 0; }
.tool-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 2px 6px; border-radius: 4px; opacity: 0.95; }
.tool-btn:hover { opacity: 1; background: #f0f0f0; }
.emoji-picker { display: none; padding: 8px; border: 1px solid #e8e8e8; border-radius: 8px; margin-bottom: 6px; max-height: 120px; overflow-y: auto; line-height: 2; }
.emoji-picker span { cursor: pointer; font-size: 20px; padding: 2px 4px; border-radius: 4px; }
.emoji-picker span:hover { background: #f0f0f0; }
#imgUpload { display: none; }
.msg-bubble img.chat-img { max-width: 200px; border-radius: 6px; cursor: pointer; margin-top: 4px; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; padding: 10px 14px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.input-row input:focus { outline: none; border-color: var(--theme-color, #667eea); }
.btn-send { padding: 10px 24px; border: none; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-send:hover { opacity: 0.9; }
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* 右栏 */
.sidebar-right { width: 320px; min-width: 320px; background: #fff; border-left: 1px solid #e8e8e8; overflow-y: auto; flex-shrink: 0; }
.ads-area { padding: 8px; }
.ads-area img { width: 100%; display: block; }
.ads-area img:not(.active) { display: none; }
.faq-section { padding: 12px 16px; border-top: 1px solid #f0f0f0; }
.faq-section h4 { font-size: 14px; color: #555; margin-bottom: 10px; }
.faq-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.faq-item:hover { color: var(--theme-color, #667eea); }
.faq-item .q { font-size: 13px; font-weight: 500; }
.faq-item .a { font-size: 12px; color: #888; margin-top: 4px; display: none; }
.faq-item.open .a { display: block; }

/* 打字指示器 */
.typing { display: flex; gap: 4px; padding: 10px 14px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: #ccc; animation: blink 1.4s infinite both; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }

/* ==================== 响应式 ==================== */
@media (max-width: 1024px) {
    .sidebar-right { display: none; }
}
@media (max-width: 768px) {
    .sidebar-left { display: none; }
    .main { flex-direction: column; }
}
