/* 定义 CSS 变量 */
:root {
    --primary-color: #4dabf7; /* 淡蓝色 */
    --primary-hover-color: #339af0; /* 悬停加深色 */
    --background-color: #f8f9fa; /* 背景颜色（浅灰色） */
    --text-color: #495057; /* 文字颜色（深灰色） */
    --border-color: #e9ecef; /* 边框颜色（浅灰色） */
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1); /* 阴影效果 */
    --border-radius: 16px; /* 圆角大小 */
    --transition: all 0.3s ease; /* 过渡效果 */
}

.article-summary {
    width: auto; /* 固定宽度 */
    max-width: 100%; /* 确保在小屏幕下不会溢出 */
    padding: 20px;
    margin-bottom: 30px;
    background-color: #e0e0e0; /* 淡灰色背景 */
    border: 1px solid #e0e0e0; /* 边框颜色 */
    border-radius: 10px; /* 圆角 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); /* 阴影 */
    transition: background-color 0.3s ease, box-shadow 0.3s ease; /* 平滑过渡 */
}

.article-summary:hover {
    background-color: #f0f0f0; /* 悬停时背景色变深 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); /* 悬停时阴影加深 */
}

.article-summary h3 {
    margin-top: 0;
    color: #333; /* 深色标题 */
    font-size: 1.5em;
    font-weight: bold;
    border-bottom: 2px solid #4CAF50; /* 绿色下划线 */
    padding-bottom: 10px;
    text-align: left; /* 左对齐 */
}

.article-summary p {
    margin: 15px 0 0;
    color: #666; /* 灰色正文 */
    line-height: 1.6;
    font-size: 1em;
    text-align: justify;
}

.source-link {
    margin-top: 15px;
    font-size: 0.9em;
    color: #777;
    text-align: left;
}

.source-link a {
    color: #3498db; /* 蓝色链接 */
    text-decoration: none;
    border-bottom: 1px dotted #3498db;
    transition: border-bottom 0.3s ease, color 0.3s ease;
}

.source-link a:hover {
    border-bottom-style: solid;
    color: #2196F3; /* 深蓝色链接悬停 */
}
/* 窗口整体样式 */
#ai-interaction-window {
    width: 320px;
    height: 420px; /* 窗口最大高度 */
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    transition: var(--transition);
    font-family: 'Inter', sans-serif; /* 现代字体 */
    overflow: hidden;
}
/* 手机端隐藏聊天窗口，显示图标 */
@media (max-width: 600px) {
    #ai-interaction-window {
        display: none; /* 默认隐藏 */
    }

    #ai-minimized-icon {
        display: block; /* 手机端显示图标 */
    }
}
/* 窗口标题栏样式 */
.ai-header {
    background-color: var(--primary-color); /* 淡蓝色背景 */
    color: #fff;
    padding: 14px 16px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* 标题栏阴影 */
}
/* 标题文字样式 */
.ai-title {
    margin: 0;
    font-size: 16px; /* 稍微增大字体大小，使其更醒目 */
    font-weight: 600; /* 保持加粗字体 */
    line-height: 1.5; /* 增加行高，提升文字的阅读体验 */
    color: #fff; /* 使用更舒适的深灰色 */
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.1); /* 轻微的阴影提升质感 */
    text-align: left;
    padding-left: 12px; /* 增加与按钮的间距，使其更适配现代设计布局 */
    flex: 1;
    transition: color 0.3s, text-shadow 0.3s; /* 添加过渡效果以平滑颜色和阴影变化 */
}


/* 功能按钮容器 */
.ai-header .btn-container {
    display: flex;
    gap: 8px; /* 按钮之间的间距 */
}

/* 功能按钮通用样式 */
.ai-header .close-btn,
.ai-header .minimize-btn {
    font-size: 14px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%; /* 圆形按钮 */
    background-color: rgba(255, 255, 255, 0.1); /* 半透明背景 */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

/* 按钮悬停效果 */
.ai-header .close-btn:hover,
.ai-header .minimize-btn:hover {
    background-color: rgba(255, 255, 255, 0.2); /* 悬停时背景变亮 */
    transform: scale(1.1); /* 悬停时放大 */
}

/* 关闭按钮样式 */
.ai-header .close-btn::after {
    content: '×'; /* 关闭符号 */
    font-size: 18px;
    line-height: 1;
}

/* 缩小按钮样式 */
.ai-header .minimize-btn::after {
    content: '−'; /* 缩小符号 */
    font-size: 18px;
    line-height: 1;
}

/* 窗口主体样式 */
.ai-body {
    padding: 16px;
    height: calc(100% - 60px); /* 减去标题栏高度 */
    overflow-y: auto;
    background-color: #fff;
}

/* 聊天容器样式 */
#chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 消息区域样式 */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* 消息样式 */
.ai-message, .user-message {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 12px;
    font-size: 14px;
    max-width: 80%; /* 限制消息最大宽度 */
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-message {
    background-color: #fff; /* AI 消息背景 */
    border: 1px solid var(--border-color);
    color: var(--text-color);
    align-self: flex-start; /* AI 消息靠左 */
    box-shadow: var(--shadow);
    border-radius: 12px 12px 12px 0;
}

.user-message {
    background-color: var(--primary-color); /* 用户消息背景 */
    color: #fff;
    align-self: flex-end; /* 用户消息靠右 */
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.2);
    border-radius: 12px 12px 0 12px;
}

/* 消息小箭头 */
.user-message::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 12px;
    border-width: 6px 0 6px 8px;
    border-color: transparent transparent transparent var(--primary-color);
}

.ai-message::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 12px;
    border-width: 6px 8px 6px 0;
    border-color: transparent var(--border-color) transparent transparent;
}

/* 消息悬停效果 */
.ai-message:hover,
.user-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

/* 时间戳样式 */
.timestamp {
    font-size: 0.75em;
    color: #666;
    margin-top: 4px;
    display: block;
    text-align: right;
}

/* 输入区域样式 */
.input-container {
    display: flex;
    padding: 12px;
    gap: 12px;
    background-color: #fff;
    border-top: 1px solid var(--border-color);
}

/* 输入框样式 */
#ai-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

#ai-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.1);
}

/* 发送按钮样式 */
#send-message {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

#send-message:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(77, 171, 247, 0.2);
}

/* 加载状态样式 */
.loading-message {
    font-style: italic;
    color: #666;
    text-align: center;
    margin: 10px 0;
}

/* 缩小后的 AI 聊天图标样式 */
#ai-minimized-icon {
    position: fixed; /* 关键属性：固定位置 */
    bottom: 20px;
    right: 20px;
    cursor: pointer;
    z-index: 10000;
    transition: var(--transition);
    display: none; /* 默认隐藏 */
}

#ai-minimized-icon img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: var(--shadow);
}