/* 使用网站CSS变量实现主题适配 - 修复黑夜模式问题 */
.ai-summary-card {
    background-color: var(--background-color-alt, #fff);
    border-radius: 2px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: var(--light-shadow, 0px 0px 20px -5px rgba(158, 158, 158, 0.2));
    border: 1px solid var(--line-color, #f3f3f3);
    transition: all 0.3s ease;
}

.ai-badge-container {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--line-color, #f3f3f3);
}

.ai-badge-icon {
    background: linear-gradient(135deg, #8a2be2 0%, #4169e1 50%, #00bfff 100%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.ai-badge-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ai-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #8a2be2, #4169e1, #00bfff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    background-size: 200% auto;
    animation: text-gradient 3s ease infinite;
}

.ai-summary-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-color, #333);
    min-height: 24px;
    position: relative;
}

.ai-summary-content.loading {
    background: linear-gradient(135deg, #8a2be2, #4169e1, #00bfff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    background-size: 200% auto;
    animation: text-gradient 3s ease infinite;
}

.ai-summary-content.loading:after {
    content: "";
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 20px;
    height: 2px;
    background: linear-gradient(135deg, #8a2be2, #4169e1, #00bfff);
    border-radius: 2px;
    animation: loading-dots 1.5s infinite;
}

/* Markdown 样式增强 */
.ai-summary-content strong {
    font-weight: 700;
    color: var(--text-color-strong, #222);
}

.ai-summary-content em {
    font-style: italic;
}

.ai-summary-content a {
    color: var(--primary-color, #1077f3);
    text-decoration: none;
    transition: all 0.2s;
}

.ai-summary-content a:hover {
    text-decoration: underline;
}

.ai-summary-content code {
    background: var(--background-color-hover, #f0f0f0);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    font-size: 14px;
}

.ai-summary-content pre {
    background: var(--background-color-hover, #f0f0f0);
    padding: 12px;
    border-radius: 6px;
    overflow: auto;
    margin: 10px 0;
}

.ai-summary-content pre code {
    background: none;
    padding: 0;
}

.ai-summary-content ul,
.ai-summary-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.ai-summary-content li {
    margin-bottom: 4px;
}

.ai-summary-content blockquote {
    border-left: 3px solid var(--primary-color, #1077f3);
    padding-left: 15px;
    margin: 10px 0;
    color: var(--text-color-muted, #666);
}

/* 动画定义 */
@keyframes text-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes loading-dots {
    0% { width: 20px; }
    50% { width: 40px; }
    100% { width: 20px; }
}

.ai-actions {
    display: flex;
    margin-top: 15px;
    gap: 10px;
}

.ai-action-btn {
    background: var(--background-color-hover, #eee);
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-color-muted, #666);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-action-btn:hover {
    background: var(--primary-color, #1077f3);
    color: white;
}

/* 确保在.dark模式下正确应用变量 */
.dark .ai-summary-card {
    background-color: var(--background-color-alt, #333);
    border: 1px solid var(--line-color, #595959);
}

.dark .ai-summary-content {
    color: var(--text-color, #eee);
}

.dark .ai-summary-content strong {
    color: var(--text-color-strong, #fff);
}

.dark .ai-title {
    color: var(--text-color, #eee);
}

.dark .ai-action-btn {
    background: var(--background-color-hover, #404040);
    color: var(--text-color-muted, #999);
}

.dark .ai-action-btn:hover {
    background: var(--primary-color-60, #033671);
    color: white;
}

.dark .ai-summary-content code {
    background: var(--background-color-hover, #2a2a2a);
}

.dark .ai-summary-content pre {
    background: var(--background-color-hover, #2a2a2a);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .ai-summary-card {
        padding: 15px;
    }
    
    .ai-badge-container {
        margin-bottom: 12px;
    }
    
    .ai-title {
        font-size: 17px;
    }
    
    .ai-summary-content {
        font-size: 14px;
    }
}

/* 对话功能样式 */
.ai-chat-container {
    margin-top: 20px;
    border-top: 1px solid var(--line-color, #f3f3f3);
    padding-top: 20px;
}

.ai-chat-history {
    max-height: 400px; /* 增加高度以显示更长的回答 */
    overflow-y: auto;
    margin-bottom: 15px;
    padding: 15px;
    background: var(--background-color-hover, #f8f9fa);
    border-radius: 8px;
    border: 1px solid var(--line-color, #e9ecef);
}

.chat-message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    line-height: 1.6;
}

.chat-question {
    background: var(--primary-color-10, #e3f2fd);
    border-left: 4px solid var(--primary-color, #1077f3);
    margin-left: 20px;
}

.chat-answer {
    background: var(--background-color-alt, #fff);
    border-left: 4px solid #28a745;
    border: 1px solid var(--line-color, #e9ecef);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chat-question:before {
    content: "问";
    font-weight: bold;
    color: var(--primary-color, #1077f3);
    margin-right: 8px;
}

.chat-answer:before {
    content: "AI回答";
    font-weight: bold;
    color: #28a745;
    margin-right: 8px;
}

.ai-chat-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--line-color, #ddd);
    border-radius: 8px;
    background: var(--background-color-alt, #fff);
    color: var(--text-color, #333);
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    transition: all 0.3s ease;
}

.ai-chat-input:focus {
    outline: none;
    border-color: var(--primary-color, #1077f3);
    box-shadow: 0 0 0 2px rgba(16, 119, 243, 0.1);
}

.ai-chat-send {
    padding: 12px 20px;
    background: linear-gradient(135deg, #8a2be2, #4169e1);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.ai-chat-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
}

.ai-chat-send:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-chat-send.login-required {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.ai-chat-send.login-required:hover {
    background: linear-gradient(135deg, #c82333, #bd2130);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.ai-chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.chat-typing {
    display: inline-block;
    margin-left: 5px;
}

.chat-typing span {
    animation: typing 1.4s infinite;
    display: inline-block;
}

.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); }
    30% { transform: translateY(-5px); }
}

.chat-timestamp {
    font-size: 12px;
    color: var(--text-color-muted, #666);
    margin-top: 5px;
    text-align: right;
}

.chat-welcome-message {
    text-align: center;
    color: var(--text-color-muted, #666);
    font-style: italic;
    padding: 10px;
}

.chat-credits-notice {
    font-size: 13px;
    color: #28a745;
    margin-top: 8px;
    font-weight: 500;
}

.chat-credits-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    animation: pulse 2s infinite, bounce 0.5s ease;
    box-shadow: 0 2px 4px rgba(255, 215, 0, 0.3);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 20%, 60%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    80% {
        transform: translateY(-2px);
    }
}

/* 积分进度样式 */
.chat-daily-progress {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    padding: 2px 6px;
    background: #f0f0f0;
    border-radius: 4px;
    display: inline-block;
}

.chat-limit-reached {
    font-size: 12px;
    color: #dc3545;
    margin-left: 8px;
    font-weight: bold;
}

/* 反垃圾警告样式 */
.ai-input-warning {
    margin-bottom: 15px;
    animation: slideDown 0.3s ease;
}

.spam-warning-message {
    display: flex;
    align-items: flex-start;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    color: #856404;
}

.spam-warning-message i {
    font-size: 20px;
    margin-right: 12px;
    margin-top: 2px;
    color: #f39c12;
}

.warning-content h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
}

.warning-content p {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.warning-content ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
}

.warning-content li {
    margin-bottom: 4px;
}

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

/* 暗色模式适配 */
.dark .ai-chat-input {
    background: var(--background-color-alt, #2d3748);
    border-color: var(--line-color, #4a5568);
    color: var(--text-color, #e2e8f0);
}

.dark .ai-chat-history {
    background: var(--background-color-hover, #2d3748);
    border-color: var(--line-color, #4a5568);
}

.dark .chat-question {
    background: var(--primary-color-60, #1a365d);
}

.dark .chat-answer {
    background: var(--background-color-alt, #2d3748);
}

.dark .spam-warning-message {
    background: #453411;
    border-color: #856404;
    color: #f8d7da;
}

.dark .chat-daily-progress {
    color: #aaa;
    background: #2a2a2a;
}

.dark .chat-limit-reached {
    color: #ff6b6b;
}

.dark .chat-credits-notice {
    color: #4ade80;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .ai-chat-input-container {
        flex-direction: column;
    }
    
    .ai-chat-send {
        width: 100%;
    }
    
    .chat-message {
        margin-left: 0;
        margin-right: 0;
    }
    
    .ai-chat-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .spam-warning-message {
        flex-direction: column;
        text-align: center;
    }
    
    .spam-warning-message i {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* 全局消息样式 */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}