/**
 * 通用AI问答区域样式（支持Markdown）
 */

/* AI问答区域容器 */
.universal-ai-section {
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    border-radius: 20px;
    padding: 24px;
    margin-top: 32px;
    border: 1px solid rgba(139, 92, 246, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* AI输入框 */
.universal-ai-input {
    width: 100%;
    padding: 16px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.universal-ai-input:focus {
    outline: none;
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.universal-ai-input::placeholder {
    color: #9CA3AF;
}

/* AI按钮 */
.universal-ai-button {
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    padding: 14px 28px;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.universal-ai-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.3);
}

.universal-ai-button:active:not(:disabled) {
    transform: translateY(0);
}

.universal-ai-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* AI响应区域 */
.universal-ai-response {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-top: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #E5E7EB;
}

/* 加载动画 */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #E5E7EB;
    border-top-color: #8B5CF6;
    border-radius: 50%;
    animation: universal-spin 0.8s linear infinite;
}

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

/* 快捷问题标签 */
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.quick-question-tag {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 24px;
    padding: 8px 16px;
    font-size: 13px;
    color: #4B5563;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.quick-question-tag:hover {
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* Markdown内容样式（美化版） */
.markdown-body {
    color: #374151;
    line-height: 1.8;
}

/* 美化标题 */
.enhanced-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.5em 0 1em;
    padding: 12px 16px;
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border-radius: 12px;
    border-left: 4px solid #8B5CF6;
}

.heading-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.heading-text {
    font-size: 1.2em;
    font-weight: 700;
    color: #4C1D95;
    flex: 1;
}

.enhanced-subheading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 1.2em 0 0.8em;
    padding: 8px 12px;
    background: #F9FAFB;
    border-radius: 8px;
}

.subheading-icon {
    color: #8B5CF6;
    font-weight: bold;
}

.subheading-text {
    font-size: 1.05em;
    font-weight: 600;
    color: #374151;
}

/* 高亮文本（替代粗体） */
.highlight-text {
    color: #7C3AED;
    font-weight: 600;
    background: linear-gradient(135deg, #FAF5FF 0%, #F3E8FF 100%);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 代码块样式优化 */
.code-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #1F2937;
    color: #F9FAFB;
    font-size: 0.85em;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.code-block {
    background: #1F2937;
    color: #F9FAFB;
    padding: 16px;
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
    margin: 1em 0;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.875em;
    line-height: 1.6;
}

.inline-code {
    background: #F3F4F6;
    color: #DC2626;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

/* 列表样式优化 */
.markdown-body ul,
.markdown-body ol {
    margin: 1em 0;
    padding-left: 0;
}

.markdown-body li {
    margin-bottom: 0.75em;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.list-bullet {
    color: #8B5CF6;
    font-weight: bold;
    flex-shrink: 0;
    margin-top: 2px;
}

.list-text {
    flex: 1;
}

.markdown-body ul li {
    list-style: none;
}

.markdown-body ol {
    counter-reset: item-counter;
    padding-left: 0;
}

.markdown-body ol li {
    counter-increment: item-counter;
    list-style: none;
}

.markdown-body ol li::before {
    content: counter(item-counter) ".";
    color: #8B5CF6;
    font-weight: bold;
    margin-right: 8px;
    flex-shrink: 0;
}

/* 表格样式优化 */
.table-wrapper {
    overflow-x: auto;
    margin: 1em 0;
}

.enhanced-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.enhanced-table th {
    background: linear-gradient(135deg, #8B5CF6 0%, #3B82F6 100%);
    color: white;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
}

.enhanced-table td {
    border: 1px solid #E5E7EB;
    padding: 10px 16px;
}

.enhanced-table tr:nth-child(even) {
    background: #F9FAFB;
}

.enhanced-table tr:hover {
    background: #F3F4F6;
}

/* 提示框样式优化 */
.enhanced-tip-box {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    border-left: 4px solid #F59E0B;
    border-radius: 8px;
    padding: 16px;
    margin: 1em 0;
    position: relative;
}

.enhanced-tip-box::before {
    content: '💡';
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 1.5em;
}

.enhanced-tip-box p {
    margin: 0;
    padding-right: 30px;
}

/* 分隔线样式 */
.enhanced-divider {
    color: #8B5CF6;
    text-align: center;
    margin: 2em 0;
    letter-spacing: 4px;
    font-weight: 300;
}

/* 段落样式 */
.markdown-body p {
    margin-bottom: 1em;
}

/* 链接样式 */
.markdown-body a {
    color: #7C3AED;
    text-decoration: none;
    border-bottom: 1px dotted #7C3AED;
    transition: all 0.2s ease;
}

.markdown-body a:hover {
    color: #5B21B6;
    border-bottom-style: solid;
}

/* 段落文本继承 */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-weight: 600;
    color: #1F2937;
}

.markdown-body h1 { font-size: 1.5em; }
.markdown-body h2 { font-size: 1.3em; }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1.05em; }

/* 引用样式（备用） */
.markdown-body blockquote {
    border-left: 4px solid #8B5CF6;
    padding: 12px 16px;
    margin: 1em 0;
    background: #F9FAFB;
    border-radius: 0 8px 8px 0;
    color: #6B7280;
}

.markdown-body blockquote p {
    margin: 0;
}

/* 响应式 */
@media (max-width: 640px) {
    .universal-ai-section {
        padding: 16px;
        border-radius: 16px;
    }

    .universal-ai-input {
        font-size: 16px; /* 防止iOS缩放 */
    }

    .quick-questions {
        flex-direction: column;
    }

    .quick-question-tag {
        width: 100%;
        text-align: center;
    }

    .universal-ai-response {
        padding: 16px;
        border-radius: 12px;
    }

    .markdown-body {
        font-size: 14px;
    }
}

/* 暗色模式支持（可选） */
@media (prefers-color-scheme: dark) {
    .universal-ai-section {
        background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
        border-color: rgba(139, 92, 246, 0.3);
    }

    .universal-ai-input {
        background: #374151;
        border-color: #4B5563;
        color: #F9FAFB;
    }

    .universal-ai-response {
        background: #1F2937;
        border-color: #374151;
    }
}
