/**
 * AI问答机器人 - 样式文件
 */

:root {
    --ai-bot-primary: #0066ff;
    --ai-bot-primary-dark: #0052cc;
    --ai-bot-bg: #ffffff;
    --ai-bot-border: #e0e0e0;
    --ai-bot-text: #333333;
    --ai-bot-text-light: #666666;
    --ai-bot-user-bg: #e3f2fd;
    --ai-bot-bot-bg: #f5f5f5;
    --ai-bot-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 容器 */
.ai-bot-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.ai-bot-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.ai-bot-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

/* 浮动按钮 */
.ai-bot-button {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6abdc1 0%, #16575a 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--ai-bot-shadow);
    transition: all 0.3s ease;
}

.ai-bot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.3);
}

.ai-bot-button:active {
    transform: scale(0.95);
}

/* 聊天窗口 */
.ai-bot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: var(--ai-bot-bg);
    border-radius: 12px;
    box-shadow: var(--ai-bot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.ai-bot-widget.bottom-left .ai-bot-window {
    right: auto;
    left: 0;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 头部 */
.ai-bot-header {
    padding: 16px;
    background: linear-gradient(135deg, #267c61 0%, var(--ai-bot-primary-dark) 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--ai-bot-border);
}

.ai-bot-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.ai-bot-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-bot-icon svg {
    width: 22px;
    height: 22px;
}

.ai-bot-button .ai-bot-icon svg {
    width: 26px;
    height: 26px;
}

.ai-bot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
    border-radius: 4px;
}

.ai-bot-close:hover {
    opacity: 0.8;
    background: rgba(255,255,255,0.15);
}

/* 问候语 */
.ai-bot-greeting {
    padding: 16px;
    text-align: center;
    border-bottom: 1px solid var(--ai-bot-border);
}

.ai-bot-greeting h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: var(--ai-bot-text);
}

.ai-bot-greeting p {
    margin: 0;
    font-size: 14px;
    color: var(--ai-bot-text-light);
}

/* 消息区域 */
.ai-bot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.ai-bot-messages::-webkit-scrollbar {
    width: 6px;
}

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

.ai-bot-messages::-webkit-scrollbar-thumb {
    background: var(--ai-bot-border);
    border-radius: 3px;
}

.ai-bot-messages::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* 消息 */
.ai-bot-message {
    margin-bottom: 12px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-bot-message.user {
    justify-content: flex-end;
}

.ai-bot-message.bot {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.ai-bot-message.user .message-content {
    background: var(--ai-bot-user-bg);
    color: var(--ai-bot-text);
}

.ai-bot-message.bot .message-content {
    background: var(--ai-bot-bot-bg);
    color: var(--ai-bot-text);
}

.message-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--ai-bot-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.message-link:hover {
    color: var(--ai-bot-primary-dark);
    text-decoration: underline;
}

/* 分类 */
.ai-bot-categories {
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    border-bottom: 1px solid var(--ai-bot-border);
    max-height: 200px;
    overflow-y: auto;
}

.ai-bot-category {
    padding: 12px;
    border: 1px solid var(--ai-bot-border);
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    background: var(--ai-bot-bg);
}

.ai-bot-category:hover {
    border-color: var(--ai-bot-primary);
    background: #f0f7ff;
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    color: var(--ai-bot-primary);
}

.category-icon svg {
    width: 22px;
    height: 22px;
}

.ai-bot-category:hover .category-icon {
    color: var(--ai-bot-primary-dark);
}

.category-name {
    display: block;
    font-size: 12px;
    color: var(--ai-bot-text);
    font-weight: 500;
}

/* FAQ列表 */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.faq-item {
    border: 1px solid var(--ai-bot-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

.faq-item:hover {
    border-color: var(--ai-bot-primary);
    background: #f0f7ff;
}

.faq-question {
    padding: 12px;
    font-weight: 500;
    font-size: 13px;
    color: var(--ai-bot-text);
    background: var(--ai-bot-bg);
}

.faq-answer {
    padding: 12px;
    font-size: 13px;
    color: var(--ai-bot-text-light);
    background: var(--ai-bot-bot-bg);
    border-top: 1px solid var(--ai-bot-border);
}

.faq-answer p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.faq-link {
    display: inline-block;
    color: var(--ai-bot-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.faq-link:hover {
    color: var(--ai-bot-primary-dark);
    text-decoration: underline;
}

/* 输入区域 */
.ai-bot-input-area {
    padding: 12px;
    border-top: 1px solid var(--ai-bot-border);
    background: var(--ai-bot-bg);
}

.ai-bot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-bot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--ai-bot-border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.ai-bot-input:focus {
    border-color: var(--ai-bot-primary);
}

.ai-bot-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: #f1803e;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-bot-send svg {
    width: 16px;
    height: 16px;
}

.ai-bot-send:hover {
    background: var(--ai-bot-primary-dark);
}

.ai-bot-send:active {
    transform: scale(0.95);
}

/* 快速链接 */
.ai-bot-quick-links {
    display: flex;
    gap: 8px;
    padding: 8px 12px;
    border-top: 1px solid var(--ai-bot-border);
    background: var(--ai-bot-bg);
}

.quick-link {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--ai-bot-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--ai-bot-text);
    font-size: 12px;
    text-align: center;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.quick-link:hover {
    border-color: var(--ai-bot-primary);
    background: #f0f7ff;
    color: var(--ai-bot-primary);
}

.link-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ai-bot-primary);
}

.link-icon svg {
    width: 18px;
    height: 18px;
}

.link-text {
    font-weight: 500;
}

/* 页脚 */
.ai-bot-footer {
    padding: 8px 12px;
    text-align: center;
    border-top: 1px solid var(--ai-bot-border);
    background: var(--ai-bot-bg);
    font-size: 12px;
    color: var(--ai-bot-text-light);
}

/* 响应式设计 */
@media (max-width: 480px) {
    .ai-bot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 70px;
    }

    .ai-bot-categories {
        grid-template-columns: repeat(2, 1fr);
    }

    .message-content {
        max-width: 90%;
    }
}

/* FAQ 面板 */
.ai-bot-faq-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-bot-faq-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--ai-bot-border);
    background: var(--ai-bot-bg);
}

.ai-bot-back {
    background: none;
    border: 1px solid var(--ai-bot-border);
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ai-bot-primary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ai-bot-back svg {
    width: 14px;
    height: 14px;
}

.ai-bot-back:hover {
    background: #f0f7ff;
    border-color: var(--ai-bot-primary);
}

.ai-bot-faq-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--ai-bot-text);
}

.ai-bot-faq-panel .faq-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.faq-item.active {
    border-color: var(--ai-bot-primary);
    background: #f8fbff;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --ai-bot-bg: #1e1e1e;
        --ai-bot-border: #333333;
        --ai-bot-text: #ffffff;
        --ai-bot-text-light: #b0b0b0;
        --ai-bot-user-bg: #1a3a52;
        --ai-bot-bot-bg: #2a2a2a;
    }

    .ai-bot-back {
        color: #6db3f2;
        border-color: #444;
    }
    .ai-bot-back:hover {
        background: #2a2a2a;
    }
    .faq-item.active {
        background: #2a2a2a;
    }
}
