/* 聊天式立案助手样式 - 与主系统统一 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    line-height: 1.57;
    color: #76838f;
    background: #f5f7fa;
    min-height: 100vh;
}

a {
    color: #ff6f06;
    text-decoration: none;
}

a:hover {
    color: #ff9900;
}

/* 聊天包装器 */
.chat-wrapper {
    display: flex;
    max-width: 900px;
    margin: 0 auto;
    height: 100vh;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 0 40px rgba(0,0,0,0.1);
    min-width: 0;
}

/* 历史记录侧边栏 */
.history-sidebar {
    width: 0;
    background: #fff;
    border-left: 1px solid #e4eaec;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.history-sidebar.show {
    width: 280px;
}

.history-header {
    padding: 16px;
    border-bottom: 1px solid #e4eaec;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-header h3 {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid #ff6f06;
    border-radius: 4px;
    background: #fff;
    color: #ff6f06;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: #ff6f06;
    color: #fff;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-item {
    padding: 12px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s;
    position: relative;
}

.history-item:hover {
    background: #F7F7F7;
}

.history-item.active {
    background: #fff5f0;
}

.history-item-title {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-preview {
    font-size: 13px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-time {
    font-size: 12px;
    color: #bbb;
    margin-top: 4px;
}

.history-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.history-item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-item:hover .history-item-actions {
    opacity: 1;
}

.history-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-action-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.history-action-btn.restore-btn:hover {
    background: rgba(255, 111, 6, 0.15);
    color: #ff6f06;
}

.history-action-btn.delete-btn:hover {
    background: rgba(255, 77, 79, 0.15);
    color: #ff4d4f;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* 顶部栏 */
.chat-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e4eaec;
    gap: 16px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background: #F2F2F2;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
}

.back-btn:hover {
    background: #e4eaec;
    color: #ff6f06;
}

.header-info {
    flex: 1;
}

.header-info h1 {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.status {
    font-size: 12px;
    color: #999;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 4px;
    background: #F2F2F2;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #e4eaec;
    color: #ff6f06;
}

/* 语音对话模式按钮 */
.voice-mode-btn.active {
    background: #ff6f06;
    color: white;
}

.voice-mode-btn.active:hover {
    background: #ff9900;
}

/* 对话区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ai-message .message-avatar {
    background: #ff6f06;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-avatar {
    background: #667eea;
    color: white;
    font-size: 16px;
}

.message-content {
    padding: 14px 18px;
    border-radius: 4px;
    font-size: 16px;
    line-height: 28px;
    color: #333;
    word-wrap: break-word;
    flex: 1;
}

.ai-message .message-content {
    background: #fff;
    border: 1px solid #e4eaec;
    max-width: 70%;
}

.user-message .message-content {
    background: #fff5f0;
    border: 1px solid #ffe0cc;
}

/* 消息操作按钮 */
.message-body {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: #F2F2F2;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg-action-btn:hover {
    background: #e4eaec;
}

.msg-action-btn.copy-btn:hover {
    background: rgba(255, 111, 6, 0.15);
    color: #ff6f06;
}

.msg-action-btn.edit-btn:hover {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.msg-action-btn.delete-btn:hover {
    background: rgba(255, 77, 79, 0.15);
    color: #ff4d4f;
}

.message-content p {
    margin: 0 0 8px 0;
    padding: 0;
    font-size: 16px;
    line-height: 28px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* 快捷操作 */
.quick-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    overflow-x: auto;
    background: #fff;
    border-top: 1px solid #e4eaec;
}

.quick-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid #e4eaec;
    border-radius: 4px;
    background: #fff;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-btn:hover {
    border-color: #ff6f06;
    color: #ff6f06;
}

/* 输入区域 */
.chat-input-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #e4eaec;
}

.voice-btn, .send-btn, .speaker-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.speaker-btn {
    background: #F2F2F2;
    color: #666;
}

.speaker-btn:hover {
    background: #e4eaec;
}

.speaker-btn.active {
    background: #ff6f06;
    color: white;
}

.voice-btn {
    background: #F2F2F2;
    color: #666;
}

.voice-btn:hover {
    background: #e4eaec;
}

.voice-btn.recording {
    background: #ff4757;
    color: white;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.send-btn {
    background: #ff6f06;
    color: white;
}

.send-btn:hover {
    background: #ff9900;
}

.input-wrapper {
    flex: 1;
}

.input-wrapper textarea {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid #e4eaec;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    min-height: 40px;
    max-height: 120px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.input-wrapper textarea:focus {
    border-color: #ff6f06;
}

/* 生成文档栏 */
.generate-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fff5f0;
    border-top: 1px solid #ffe0cc;
}

.generate-bar p {
    font-size: 14px;
    color: #ff6f06;
}

.generate-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 4px;
    background: #ff6f06;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.generate-btn:hover {
    background: #ff9900;
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6f06;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-4px); }
}

/* 提示框 */
.chat-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s;
    z-index: 9999;
    pointer-events: none;
}

.chat-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 响应式 */
@media (max-width: 768px) {
    .chat-wrapper {
        height: 100vh;
    }

    .chat-container {
        height: 100vh;
    }

    .message-body,
    .ai-message .message-content {
        max-width: 85%;
    }

    .quick-actions {
        padding: 10px 16px;
    }

    .chat-input-area {
        padding: 12px 16px;
    }
    
    /* 移动端隐藏历史记录 */
    .history-sidebar {
        display: none !important;
    }
}
