/* 智能AI客服系统 - 样式文件 */

/* CSS变量 */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --bg-color: #f8f9fa;
    --white: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-small: 8px;
    --transition: all 0.3s ease;
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 主容器 */
.main-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-color), #00d4ff);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 主要内容 */
main {
    flex: 1;
    padding: 60px 0;
}

/* 介绍部分 */
.intro {
    text-align: center;
    margin-bottom: 60px;
}

.intro h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.intro > p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto 40px;
}

/* 特性 */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.feature {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.feature:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.feature h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.feature p {
    color: var(--text-light);
}

/* FAQ部分 */
.faq {
    max-width: 800px;
    margin: 0 auto;
}

.faq h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 40px;
}

.faq-item {
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.faq-item h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.faq-item p {
    color: var(--text-light);
}

/* 页脚 */
.footer {
    background: var(--text-dark);
    color: var(--white);
    padding: 30px 0;
    text-align: center;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* 聊天窗口组件 */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.chat-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 25px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    font-weight: 500;
}

.chat-toggle:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.chat-toggle svg {
    flex-shrink: 0;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 500px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 聊天头部 */
.chat-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: var(--primary-color);
    color: var(--white);
}

.chat-header h3 {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    margin-right: 15px;
    opacity: 0.9;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.status-dot.online {
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: var(--transition);
}

.chat-close:hover {
    opacity: 1;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 消息气泡 */
.message {
    display: flex;
    max-width: 85%;
}

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

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

.message-content {
    padding: 12px 16px;
    border-radius: var(--radius);
    word-wrap: break-word;
    white-space: pre-wrap;
}

.message.user .message-content {
    background: var(--primary-color);
    color: var(--white);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #f0f0f0;
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.message-content p {
    margin: 0;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* 输入区域 */
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 25px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
    max-height: 100px;
}

#chat-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.chat-send-btn {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 打字指示器 */
.chat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 20px;
    background: #f0f0f0;
    border-radius: 20px;
    margin: 0 20px 15px;
    width: fit-content;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chat-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.6;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* 错误消息 */
.message.error .message-content {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-toggle span {
        display: none;
    }
    
    .chat-toggle {
        padding: 15px;
        border-radius: 50%;
    }
    
    .chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        right: -10px;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .features {
        grid-template-columns: 1fr;
    }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}
