/* static/css/intelligence_table.css */

/* =========================================
   1. 全局与主容器
   ========================================= */
body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    padding: 20px;
    background-color: #f8f9fa;
    margin: 0;
}

/* 主容器：白色卡片背景 */
.article-list {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.article-list h1 {
    color: #343a40;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

/* =========================================
   2. 顶部控制栏 (Controls)
   ========================================= */
.controls-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: flex-end; /* 靠右对齐 */
    gap: 15px;
    align-items: center;
    font-size: 0.9rem;
    color: #5f6368;
}

.controls-container select {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.refresh-btn {
    padding: 5px 10px;
    cursor: pointer;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* =========================================
   3. 分页 (Pagination)
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 40px;
    gap: 15px;
}

.page-btn {
    padding: 8px 25px;
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    text-decoration: none;
    color: #0d47a1;
    transition: all 0.3s;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.page-btn:hover {
    background-color: #bbdefb;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.page-info {
    color: #546e7a;
    font-size: 0.95rem;
}

/* =========================================
   4. 文章卡片主体 (Article Card)
   ========================================= */
.article-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    background: white;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 7px 15px rgba(0,0,0,0.1);
    border-color: #c5cae9;
}

.article-title {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.4rem;
    display: block;
    margin-bottom: 8px;
}

.article-title:hover {
    text-decoration: underline;
    color: #0d47a1;
}

/* 元数据行：时间、来源 */
.article-meta {
    color: #5f6368;
    font-size: 0.95em;
    margin: 10px 0;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.article-time {
    background: #e3f2fd;
    padding: 3px 8px;
    border-radius: 4px;
}

/* 来源特殊样式 */
.article-source {
    color: #4a4a4a;
    background: #e3f2fd;
    padding: 3px 8px;
    border-radius: 4px;
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap;
}

.source-link-container {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
}

.source-prefix {
    display: inline-block;
    margin-right: 6px;
    font-size: 1.1em;
    vertical-align: middle;
}

.source-link {
    color: #1565c0;
    text-decoration: none;
    word-break: break-all;
}

.source-link:hover {
    text-decoration: underline;
}

.domain-highlight {
    background-color: #FFFF00;
    padding: 1px 2px;
    border-radius: 3px;
}

.article-summary {
    color: #202124;
    line-height: 1.7;
    margin: 15px 0;
    font-size: 1.05rem;
}

/* =========================================
   5. 底部调试信息栏 (Debug Info - Flex布局)
   ========================================= */
/* 1. 调整父容器：确保两边基准一致 */
.debug-info {
    /* ...原有背景色、边框等保持不变... */
    background-color: #f5f5f5;
    border-left: 3px solid #90a4ae;
    padding: 10px 20px; /* 上下 padding 稍微减小一点，更紧凑 */
    margin-top: 5px;

    /* 统一字体大小：让所有内容（包括星星）都基于这个基准 */
    font-size: 0.85rem;
    color: #546e7a;
    border-radius: 0 4px 4px 0;

    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* 顶部对齐 */
    gap: 20px;

    /* [新增] 统一行高，防止星星撑大行高 */
    line-height: 1.5;
}

/* 通用标签样式 */
.debug-label {
    font-weight: 700;
    color: #37474f;
    margin-right: 8px;
    display: inline-block;
}

/* 2. 左侧区域：去除特殊间距 */
.debug-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: left;

    /* [关键] 统一使用 gap 控制间距，和右侧保持一致 */
    gap: 4px;
}

/* 3. [关键修改] 重写评分样式：覆盖原有的 margin 和大字体 */
.debug-left .article-rating {
    margin-bottom: 0; /* 去掉原有的 8px 间距 */
    font-size: inherit; /* 强制继承父级的 0.85rem */
    display: flex;
    align-items: center; /* 确保星星和文字垂直居中 */
}

/* 让星星稍微缩小一点以适应小字体，或者保持原样 */
.debug-left .article-rating i {
    font-size: 0.9rem; /* 微调星星大小，比文字略大一点点即可 */
    margin-right: 2px;
}

/* 4. 右侧区域：保持 gap 一致 */
.debug-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    text-align: left;
    max-width: 45%;

    /* [关键] 必须和左侧 .debug-left 的 gap 完全一致 */
    gap: 4px;
}

.article-rating {
    margin-bottom: 8px;
    font-size: 1rem;
}

/* 右侧每一行的布局 */
.debug-right > div {
    display: flex;
    align-items: baseline;
}

/* 右侧固定宽度的标签 (让冒号对齐) */
.debug-right .debug-label {
    width: 65px;
    flex-shrink: 0; /* 防止标签被压缩 */
}

/* 右侧值的截断样式 (针对超长URL) */
.debug-value-truncate {
    display: inline-block;
    vertical-align: bottom;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #5f6368;
}

/* =========================================
   6. 通用工具类 (Utilities)
   ========================================= */
/* 星星颜色 */
.text-warning {
    color: #ffc107 !important;
}

/* 加载动画容器 */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #1a73e8;
    font-weight: 500;
}

/* =========================================
   7. 移动端适配 (Responsive)
   ========================================= */
/* 当屏幕宽度小于 768px 时，底部信息栏改为垂直堆叠 */
@media (max-width: 768px) {
    .debug-info {
        flex-direction: column;
        gap: 15px;
    }

    .debug-right {
        max-width: 100%; /* 取消宽度限制，占满整行 */
        border-top: 1px solid #e0e0e0; /* 增加分割线 */
        padding-top: 10px;
    }

    /* 移动端稍微放宽截断限制，或者保持原样皆可 */
    .debug-value-truncate {
        max-width: 100%;
    }
}

/* =========================================
   8. 相似度评分徽章 (Similarity Score Badge)
   ========================================= */

/* 相似度评分徽章基础样式 */

.similarity-badge {
    font-size: 0.85em;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
    vertical-align: middle;
    color: white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* 徽章内的分数数字样式 */
.similarity-score {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', monospace;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* 微调元数据区域，确保徽章对齐 */
.article-meta {
    color: #5f6368;
    font-size: 0.95em;
    margin: 10px 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* 鼠标悬停效果 */
.similarity-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

/* 评分颜色系统 - 覆盖Bootstrap默认颜色 */
.bg-success.similarity-badge {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.bg-primary.similarity-badge {
    background: linear-gradient(135deg, #0d6efd, #0dcaf0) !important;
    border: 1px solid rgba(13, 110, 253, 0.3);
}

.bg-warning.similarity-badge {
    background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #212529 !important; /* 深色文字在浅色背景上更易读 */
    text-shadow: none;
}

.bg-danger.similarity-badge {
    background: linear-gradient(135deg, #dc3545, #fd7e14) !important;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.bg-secondary.similarity-badge {
    background: linear-gradient(135deg, #6c757d, #adb5bd) !important;
    border: 1px solid rgba(108, 117, 125, 0.3);
}

/* 评分徽章前的图标（可选） */
.similarity-badge::before {
    content: '★';
    font-size: 0.8em;
    opacity: 0.9;
}

/* 确保在移动设备上也能良好显示 */
@media (max-width: 768px) {
    .similarity-badge {
        font-size: 0.8em;
        padding: 3px 8px;
        border-radius: 10px;
    }

    .article-meta {
        gap: 8px;
    }
}

/* 在暗色模式下的适配（可选） */
@media (prefers-color-scheme: dark) {
    .similarity-badge {
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }

    .similarity-badge:hover {
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    }
}

/* =========================================
   9. V2 数据结构适配样式 (New for V2)
   ========================================= */

/* 版本号徽章 */
.version-badge {
    display: inline-block;
    padding: 2px 6px;
    background-color: #e0e0e0;
    color: #616161;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 8px;
    font-family: monospace;
    vertical-align: middle;
}

/* V2 子分类标签容器 */
.v2-tags-container {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* 单个子分类标签 */
.v2-category-tag {
    background-color: #e8f0fe;
    color: #1967d2;
    border: 1px solid #d2e3fc;
    border-radius: 12px;
    padding: 1px 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* =========================================
   10. Prompt Viewer (Modal + Link Button)
   ========================================= */

/* Prompt 版本链接按钮（右侧 debug 里的 vXX） */
.prompt-link-btn {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    color: #1a73e8;
    cursor: pointer;
    font-size: 0.92rem;
    text-decoration: underline;
}

.prompt-link-btn:hover {
    color: #174ea6;
}

/* 弹窗遮罩层 */
.prompt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;              /* 默认隐藏 */
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* 弹窗主体 */
.prompt-modal {
    width: min(920px, calc(100vw - 28px));
    max-height: min(80vh, 720px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Header */
.prompt-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #eef0f3;
    background: linear-gradient(180deg, #fafbff, #fff);
}

.prompt-modal-title {
    font-weight: 600;
    color: #202124;
    font-size: 0.98rem;
}

.prompt-modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.prompt-modal-btn {
    border: 1px solid #dadce0;
    background: #fff;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.86rem;
    cursor: pointer;
}

.prompt-modal-btn:hover {
    background: #f6f8fb;
}

/* Body */
.prompt-modal-body {
    padding: 12px 14px 14px 14px;
    overflow: auto;
}

/* prompt 文本区域：简洁但“好看”的 code-block 风格 */
.prompt-text {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.86rem;
    line-height: 1.45;
    white-space: pre-wrap;       /* 自动换行 */
    word-break: break-word;      /* 长 token 换行 */
    background: #0b1020;
    color: #e6edf3;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.prompt-hint {
    margin-top: 10px;
    color: #5f6368;
    font-size: 0.82rem;
}

.prompt-error {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff5f5;
    color: #b42318;
    border: 1px solid #ffd0d0;
    font-size: 0.9rem;
}
