/**
 * AiContent前端样式 - 适配PureSuck主题
 */
.ai-chat {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border-radius: 0.75rem;
    background-color: var(--card-color, #ffffff);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid var(--border-color, #e0e0e0);
    transition: all 0.3s ease;
}

.ai-chat-header {
    margin-bottom: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--line-color, #ebebeb);
    background-color: var(--card2-color, #fbfbfb);
}

.ai-chat-header h1 {
    margin: 0;
    padding: 0;
    font-size: 1.25em;
    font-weight: 500;
    color: var(--text-color, #333);
}

.ai-chat-header h3 {
    margin: 0;
    padding: 0;
    font-size: 1.25em;
    font-weight: 500;
    color: var(--text-color, #333);
}

.ai-chat-body {
    padding: 0 20px 20px;
}

.ai-result {
    margin-bottom: 20px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

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

.ai-result::-webkit-scrollbar-thumb {
    background-color: var(--border-color, #e0e0e0);
    border-radius: 3px;
}

.ai-response {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 0.75rem;
    background-color: var(--pure-gery-color, #f5f5f5);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--line-color, #ebebeb);
    transition: all 0.3s ease;
}

.ai-question {
    margin-bottom: 10px;
    padding-bottom: 10px;
    font-weight: 500;
    color: var(--text-color, #333);
    border-bottom: 1px dashed var(--line-color, #ebebeb);
}

.ai-answer {
    line-height: 1.6;
    white-space: pre-wrap;
    position: relative;
    color: var(--text-color, #333);
    font-size: 1em;
}

/* 支持Markdown渲染 */
.ai-answer p {
    margin: 0.75em 0;
}

.ai-answer ul, 
.ai-answer ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
}

.ai-answer h1, 
.ai-answer h2, 
.ai-answer h3, 
.ai-answer h4 {
    margin: 1em 0 0.5em;
    color: var(--text-color, #333);
}

.ai-answer code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    padding: 2px 4px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-size: 0.9em;
}

.ai-answer pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.75em 0;
}

.ai-answer pre code {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
}

.ai-answer blockquote {
    margin: 0.75em 0;
    padding: 0.5em 1em;
    border-left: 4px solid var(--border-color, #e0e0e0);
    background-color: rgba(0, 0, 0, 0.02);
}

.ai-footer {
    margin-top: 15px;
    padding-top: 10px;
    font-size: 0.85em;
    color: var(--nav-text-color, #374043);
    text-align: right;
    border-top: 1px dashed var(--line-color, #ebebeb);
}

.ai-error {
    padding: 12px 15px;
    margin-bottom: 15px;
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.75rem;
    font-size: 0.95em;
}

.ai-form {
    display: block;
}

.ai-input-wrap {
    position: relative;
    margin-bottom: 12px;
}

.ai-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px 15px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 0.75rem;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95em;
    color: var(--text-color, #333) !important;
    background-color: var(--card-color, #fff);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

.ai-form textarea:focus {
    border-color: var(--themecolor, #4e7cb1);
    box-shadow: 0 0 0 2px rgba(78, 124, 177, 0.1);
    outline: none;
}

/* 字符计数器颜色变化 */
.ai-counter {
    position: absolute;
    right: 12px;
    bottom: 12px;
    font-size: 0.85em;
    color: var(--nav-text-color, #374043);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.ai-form textarea:focus + .ai-counter {
    opacity: 1;
}

/* 低于最小值 - 红色 */
.ai-counter.ai-count-low {
    color: #dc3545;
    font-weight: 500;
}

/* 正常范围 - 绿色 */
.ai-counter.ai-count-normal {
    color: #28a745;
}

/* 接近上限 - 橙色 */
.ai-counter.ai-count-warning {
    color: #fd7e14;
    font-weight: 500;
}

/* 达到上限 - 红色 */
.ai-counter.ai-count-max {
    color: #dc3545;
    font-weight: 700;
}

.ai-counter-exceed {
    color: #dc3545;
    font-weight: bold;
}

.ai-submit {
    display: inline-block;
    padding: 8px 20px;
    background-color: var(--themecolor, #4e7cb1);
    color: #fff;
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.ai-submit:hover {
    background-color: var(--themecolor, #3d6a9c);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.ai-submit:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-submit:disabled {
    background-color: var(--border-color, #e0e0e0);
    color: var(--nav-text-color, #374043);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.ai-share-link {
    margin-top: 10px;
    text-align: right;
}

.ai-share-link a {
    color: var(--themecolor, #4e7cb1);
    text-decoration: none;
    transition: all 0.2s;
}

.ai-share-link a:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* 适配深色模式 - 使用PureSuck的变量，完美适配主题 */
[data-theme="dark"] .ai-response {
    background-color: var(--card2-color, #2e2e2e);
}

[data-theme="dark"] .ai-form textarea {
    background-color: var(--card-color, #2b2b2b);
    border-color: var(--border-color, #333739);
    color: var(--pure-color, #f2f2f2) !important;
}

[data-theme="dark"] .ai-error {
    background-color: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.25);
    color: #f5c6cb;
}

/* 流式内容深色模式优化 */
[data-theme="dark"] .ai-content {
    color: var(--pure-color, #f2f2f2) !important;
}

[data-theme="dark"] .ai-content h1 {
    color: var(--pure-color, #f2f2f2) !important;
}

[data-theme="dark"] .ai-content h2 {
    color: var(--pure-color, #e5e5e5) !important;
}

[data-theme="dark"] .ai-content h3 {
    color: var(--pure-color, #d0d0d0) !important;
}

[data-theme="dark"] .ai-content strong {
    color: var(--pure-color, #f2f2f2) !important;
}

[data-theme="dark"] .ai-content em {
    color: var(--pure-color, #d0d0d0) !important;
}

[data-theme="dark"] .ai-content code {
    background: var(--card2-color, #333);
    color: #ff6b6b !important;
}

[data-theme="dark"] .ai-question {
    color: var(--pure-color, #f2f2f2) !important;
}

[data-theme="dark"] .ai-answer {
    color: var(--pure-color, #f2f2f2) !important;
}

[data-theme="dark"] .ai-footer {
    color: var(--nav-text-color, #c1bcb4) !important;
}

[data-theme="dark"] .ai-api {
    color: var(--themecolor, #4e7cb1) !important;
}

[data-theme="dark"] .ai-ip-location {
    color: var(--nav-text-color, #c1bcb4) !important;
}

[data-theme="dark"] .ai-lang {
    color: var(--nav-text-color, #c1bcb4) !important;
}

[data-theme="dark"] .ai-tags-info {
    color: var(--nav-text-color, #c1bcb4) !important;
}

/* 流式输出相关样式 - 增强版，完美适配PureSuck主题 */
.ai-content {
    line-height: 1.7;
    color: var(--text-color, #333);
    min-height: 20px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-cursor {
    display: inline-block;
    background: var(--themecolor, #4e7cb1);
    color: var(--themecolor, #4e7cb1);
    animation: ai-cursor-blink 1.2s infinite;
    margin-left: 2px;
    font-weight: 100;
    width: 2px;
    height: 1em;
}

@keyframes ai-cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 流式内容的Markdown渲染 - 完美适配PureSuck主题 */
.ai-content h1 {
    color: var(--text-color, #333);
    margin: 16px 0 12px 0;
    font-size: 1.5em;
    font-weight: 600;
}

.ai-content h2 {
    color: var(--text-color, #333);
    margin: 16px 0 8px 0;
    font-size: 1.3em;
    font-weight: 600;
}

.ai-content h3 {
    color: var(--text-color, #333);
    margin: 12px 0 6px 0;
    font-size: 1.1em;
    font-weight: 600;
}

.ai-content strong {
    color: var(--text-color, #333);
    font-weight: 600;
}

.ai-content em {
    color: var(--text2-color, #444);
    font-style: italic;
}

.ai-content code {
    background: var(--pure-gery-color, #f5f5f5);
    color: #e11d48;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
}

/* 加载状态样式 */
.ai-loading {
    text-align: center;
    padding: 20px;
    color: var(--nav-text-color, #666);
}

.ai-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 50%;
    border-top-color: var(--themecolor, #4e7cb1);
    animation: ai-spin 0.8s linear infinite;
    margin-bottom: 10px;
}

.ai-loading-text {
    font-size: 14px;
    margin-top: 8px;
}

@keyframes ai-spin {
    to {transform: rotate(360deg);}
}

/* 复制按钮样式优化 - 位置修改为右下角 */
.ai-copy-wrapper {
    position: absolute;
    bottom: 5px;
    right: 5px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ai-answer:hover .ai-copy-wrapper {
    opacity: 1;
}

.ai-copy-btn {
    background: var(--card-color, rgba(255, 255, 255, 0.9));
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 0.5rem;
    color: var(--nav-text-color, #374043);
    cursor: pointer;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ai-copy-btn:hover {
    background: var(--card2-color, #fbfbfb);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ai-copy-btn svg {
    width: 14px;
    height: 14px;
}

/* 查看文章链接样式 */
.ai-view-post {
    color: var(--themecolor, #4e7cb1);
    text-decoration: none;
    margin-left: 5px;
    font-weight: 500;
    transition: all 0.2s;
}

.ai-view-post:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* 标题已存在提示优化 */
.ai-exists-notification {
    margin-top: 12px;
    padding: 10px 15px;
    background-color: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
    border-radius: 0.5rem;
    font-size: 0.9em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 标签通知样式优化 */
.ai-tags-notification {
    margin-top: 12px;
    padding: 10px 15px;
    background-color: #e3f2fd;
    color: #0d47a1;
    border-left: 4px solid #2196f3;
    border-radius: 0.5rem;
    font-size: 0.9em;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* IP归属地样式优化 */
.ai-ip-location {
    font-size: 0.9em;
    color: var(--nav-text-color, #374043);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-ip-location:hover {
    opacity: 1;
}

/* API类型高亮显示 */
.ai-api {
    color: var(--themecolor, #4e7cb1);
    font-weight: 500;
}

/* 验证码样式 */
.ai-captcha {
    margin: 15px 0;
    padding: 15px;
    background-color: var(--card2-color, #f8f9fa);
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 0.75rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.ai-captcha-title {
    margin-bottom: 10px;
    font-weight: bold;
    color: #666666 !important;
    font-size: 0.95em;
}

.ai-captcha-question {
    margin-bottom: 15px;
}

.ai-captcha-question span {
    font-size: 18px !important;
    font-weight: bold !important;
    color: var(--themecolor, #007bff) !important;
    margin: 0 10px;
}

.ai-captcha p {
    margin: 0 0 10px 0;
    color: var(--text-color, #333);
    font-size: 0.95em;
}

.ai-captcha span {
    font-size: 18px !important;
    font-weight: bold !important;
    color: var(--themecolor, #007bff) !important;
    margin: 0 10px;
}

.ai-captcha input {
    width: 100px;
    padding: 8px 12px;
    margin: 0 5px 10px 0;
    border: 1px solid var(--border-color, #ced4da);
    border-radius: 0.5rem;
    text-align: center;
    font-size: 16px;
    background-color: var(--card-color, #fff);
    color: #666666 !important;
    transition: all 0.3s ease;
}

.ai-captcha input::placeholder {
    color: #999999 !important;
    opacity: 1;
}

.ai-captcha input:focus {
    border-color: var(--themecolor, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    outline: none;
}

.ai-captcha button {
    padding: 8px 15px;
    margin: 0 5px;
    border: 1px solid var(--themecolor, #007bff);
    border-radius: 0.5rem;
    background-color: var(--themecolor, #007bff);
    color: #fff;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.ai-captcha button:hover {
    background-color: var(--themecolor, #0056b3);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.ai-captcha button:last-child {
    background-color: transparent;
    color: var(--themecolor, #007bff);
}

.ai-captcha button:last-child:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

/* 深色模式下特定元素的样式调整 */
@media (prefers-color-scheme: dark) {
    .ai-exists-notification {
        background-color: rgba(255, 193, 7, 0.1);
        color: #ffe082;
        border-color: #ffc107;
    }
    
    .ai-tags-notification {
        background-color: rgba(33, 150, 243, 0.1);
        color: #90caf9;
        border-color: #2196f3;
    }
    
    .ai-ip-location {
        color: var(--nav-text-color, #c1bcb4);
    }
    
    /* 验证码深色模式样式 */
    .ai-captcha {
        background-color: var(--card2-color, #2e2e2e);
        border-color: var(--border-color, #333739);
    }
    
    .ai-captcha-title {
        color: var(--pure-color, #f2f2f2);
    }
    
    .ai-captcha p {
        color: var(--pure-color, #f2f2f2);
    }
    
    .ai-captcha input {
        background-color: var(--card-color, #2b2b2b);
        border-color: var(--border-color, #333739);
        color: var(--pure-color, #f2f2f2);
    }
    
    .ai-captcha input:focus {
        border-color: var(--themecolor, #4e7cb1);
        box-shadow: 0 0 0 2px rgba(78, 124, 177, 0.2);
    }
    
    .ai-captcha button:last-child {
        color: var(--themecolor, #4e7cb1);
        border-color: var(--themecolor, #4e7cb1);
    }
    
    .ai-captcha button:last-child:hover {
        background-color: rgba(78, 124, 177, 0.1);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-chat {
        margin: 15px 0;
        border-radius: 0.5rem;
    }
    
    .ai-chat-header {
        padding: 12px 15px;
    }
    
    .ai-chat-body {
        padding: 0 15px 15px;
    }
    
    .ai-response {
        padding: 12px;
        border-radius: 0.5rem;
    }
    
    .ai-form textarea {
        min-height: 100px;
        font-size: 1em;
    }
    
    .ai-submit {
        width: 100%;
        padding: 10px;
    }
} 