/* 春风AI Chat页面样式 */
.chat-page { display: flex; flex-direction: column; height: 100vh; }

.chat-body { display: flex; flex: 1; overflow: hidden; }

/* 聊天内容区 */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding-top: 60px; }
.chat-messages {
    flex: 1; overflow-y: auto; padding: 20px 24px;
    width: 40%; margin: 0 auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.chat-messages::-webkit-scrollbar { display: none; }

/* 消息气泡 */
.msg { padding: 12px 0; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-assistant { display: flex; justify-content: flex-start; }

.msg-bubble {
    max-width: 85%; padding: 12px 18px; border-radius: 16px;
    font-size: 16px; line-height: 1.7; word-break: break-word;
}
.msg-user .msg-bubble {
    background: #9df29f; color: #141414; border-bottom-right-radius: 4px;
}
.msg-assistant .msg-bubble {
    background: none; color: #141414; border-bottom-left-radius: 4px;
}

/* 代码块 */
.msg-bubble pre {
    background: #1e1e1e; color: #d4d4d4; padding: 14px;
    border-radius: 8px; overflow-x: auto; margin: 8px 0; font-size: 13.5px;
}
.msg-bubble code { font-family: "Fira Code", Consolas, monospace; font-size: 13.5px; }
.msg-bubble p { margin: 6px 0; }
.msg-bubble ul, .msg-bubble ol { padding-left: 20px; margin: 6px 0; }

/* 底部输入区 - 与首页一致 */
.chat-input-area {
    flex-shrink: 0; padding: 16px 20px 20px;
}
.chat-input-wrap {
    width: 40%; margin: 0 auto;
    background: #fafafa; border: 1px solid #e5e5e5; border-radius: 16px;
    padding: 16px; display: flex; gap: 12px; align-items: flex-end;
    transition: all .3s;
}
.chat-input-wrap:focus-within { border-color: #80e0b8; }
.chat-textarea {
    flex: 1; border: none; outline: none;
    background: transparent; font-size: 16px; color: #141414;
    resize: none; font-family: inherit; min-height: 60px; max-height: 160px;
    line-height: 1.5;
}
.chat-textarea::placeholder { color: #999; }
.chat-send-btn {
    width: 36px; height: 36px; border-radius: 18px;
    background: linear-gradient(135deg, #e6f9f0 0%, #b8ecd3 100%);
    border: 1px solid #80e0b8; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s; flex-shrink: 0;
}
.chat-send-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,195,117,.3); }
.chat-send-btn:disabled { background: #f5f5f5; border-color: #e5e5e5; cursor: not-allowed; }
.chat-send-btn:disabled svg { color: #ccc; }
.chat-send-btn svg { width: 18px; height: 18px; color: #00c375; }

/* 复制按钮 */
.copy-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px;     border: 1px solid #cfeafb;
    border-radius: 14px; background: linear-gradient(135deg, #edfef9 0%, #f5fbfe 100%); color: #141414;
    font-size: 12px; cursor: pointer; transition: all .2s;
    white-space: nowrap; margin-top: 4px;
}
.copy-btn:hover { background: linear-gradient(135deg, #d5f5ef 0%, #e2f5fb 100%); border-color: #15ac70; }
.copy-btn.copied { background: #e8f5e9; color: #2e7d32; border-color: #a5d6a7; }
.copy-btn svg { flex-shrink: 0; color: #141414; }

/* 文案分组卡片 */
.moment-group {
    padding: 12px 16px; margin: 8px 0;
    background: transparent; border: none;
}
.moment-group:hover { background: transparent; }
.moment-group-title {
    font-weight: 600; color: #15ac70; font-size: 14px;
    margin-bottom: 8px; padding-bottom: 6px;
}
.section-title-row {
    display: flex; align-items: center; justify-content: space-between;
    margin: 8px 0 4px 0;
}
.section-title {
    font-weight: 600; font-size: 13.5px; color: #555;
}
.moment-content { line-height: 1.7; font-size: 15px; color: #333; }
.mom-copy-btn { margin-bottom: 4px; }
.prompt-content { line-height: 1.6; font-size: 14px; color: #666; font-style: italic; margin-bottom: 2px; }
.prompt-copy-btn { margin-bottom: 0; }
.msg-loading .msg-bubble { display: flex; gap: 4px; align-items: center; padding: 16px 20px; }
.msg-loading .dot {
    width: 8px; height: 8px; border-radius: 50%; background: #bbb;
    animation: dotPulse 1.4s infinite ease-in-out;
}
.msg-loading .dot:nth-child(2) { animation-delay: .2s; }
.msg-loading .dot:nth-child(3) { animation-delay: .4s; }
@keyframes dotPulse { 0%,80%,100%{transform:scale(.6);opacity:.4} 40%{transform:scale(1);opacity:1} }

/* ===== 左侧历史记录面板 ===== */
.history-panel {
    width: 280px; flex-shrink: 0;
    background: #f9fafb; display: flex; flex-direction: column;
    overflow: hidden;
    padding-top: 60px;
    border-right: 1px solid #e5e5e5;
}
.history-header {
    padding: 16px 12px;
    display: flex; align-items: center;
}
.history-new-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 10px 20px;
    background: #fff; border: 1px solid #e5e5e5; border-radius: 20px;
    font-size: 14px; font-weight: 500; color: #141414;
    cursor: pointer; transition: all .2s; text-decoration: none;
}
.history-new-btn:hover { border-color: #80e0b8; background: #e6f9f0; }
.history-new-btn svg { width: 16px; height: 16px; color: #00c375; flex-shrink: 0; }
.history-list { flex: 1; overflow-y: auto; padding: 8px; max-height: calc(100vh - 140px); }
.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* 历史记录项 */
.history-item {
    display: flex; align-items: center; gap: 4px;
    padding: 7px 10px; border-radius: 8px; cursor: pointer;
    transition: all .2s; position: relative;
}
.history-item:hover, .history-item.active { background: #e6f9f0; }
.history-item-content {
    flex: 1; min-width: 0;
}
.history-item-title {
    font-size: 13.5px; color: #141414; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-item-time { font-size: 11px; color: #999; margin-top: 1px; }
/* 三个点菜单按钮 */
.history-item-more {
    width: 24px; height: 24px; border: none; background: transparent;
    border-radius: 6px; cursor: pointer; display: flex; align-items: center;
    justify-content: center; color: #999; flex-shrink: 0;
    opacity: 0; transition: all .15s;
}
.history-item:hover .history-item-more { opacity: 1; }
.history-item-more:hover { background: #e5e5e5; color: #141414; }
.history-item-more svg { width: 16px; height: 16px; }

/* 下拉菜单 */
.history-menu {
    position: absolute; right: 8px; top: 100%; z-index: 50;
    background: #fff; border: 1px solid #e5e5e5; border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 120px;
    overflow: hidden; display: none;
}
.history-menu.show { display: block; }
.history-menu-item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; font-size: 13px; color: #333;
    cursor: pointer; transition: background .15s;
}
.history-menu-item:hover { background: #f5f5f5; }
.history-menu-item svg { width: 14px; height: 14px; color: #999; }
.history-menu-item.danger { color: #f44336; }
.history-menu-item.danger svg { color: #f44336; }
.history-menu-item.danger:hover { background: #fbe9e7; }

/* 重命名输入框 */
.history-rename-input {
    width: 100%; padding: 4px 6px;     border: 1px solid #80e0b8;
    border-radius: 6px; font-size: 13px; color: #141414;
    outline: none; background: #fff;
}

.history-empty {
    text-align: center; padding: 40px 20px; color: #ccc; font-size: 13px;
}

@media (max-width: 768px) {
    .msg-bubble { max-width: 96%; font-size: 16px; }
    .chat-messages { width: 100%; padding: 12px 10px; }
    .chat-input-wrap { width: 100%; }
    .chat-input-area { padding: 10px 12px 14px; }
    .history-panel {
        position: fixed; left: -280px; top: 0; bottom: 0; z-index: 100;
        box-shadow: none; transition: left .3s, box-shadow .3s;
        padding-top: 60px;
    }
    .history-panel.mobile-open {
        left: 0; box-shadow: 4px 0 16px rgba(0,0,0,.15);
    }
    .moment-content { font-size: 15px; }
    .copy-btn { font-size: 11px; padding: 3px 10px; }
}
