/* /css/style.css */
/*
   懒猫学术 - 劈尖干涉智能分析平台
   Rectangular Minimalist Tech Design
   全面矩形化设计 + 视觉风格升级
*/

/* --- 全局变量 --- */
:root {
    --sidebar-width: 280px;
    --brand-primary: #2D5AF0;
    --brand-primary-hover: #1E3FBF;
    --brand-primary-light: #4B6EF5;
    --sidebar-bg: #1a1d23;
    --sidebar-bg-hover: #2b2f38;
    --sidebar-bg-active: #232730;
    --sidebar-text: #8b8fa3;
    --sidebar-text-active: #e8eaed;
    --body-bg: #f0f2f5;
    --chat-bg: #f0f2f5;
    --card-bg: #ffffff;
    --border-color: #e4e7ed;
    --text-primary: #1a1d23;
    --text-secondary: #8b8fa3;
    --text-muted: #b0b4c0;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-focus: #2D5AF0;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease-in-out;
    /* 圆角全部归零 */
    --border-radius-base: 0;
    --border-radius-sm: 0;
    --border-radius-lg: 0;
    --border-radius-pill: 0;
}

/* --- 全局重置：强制矩形化 --- */
*,
*::before,
*::after {
    border-radius: 0 !important;
}

/* 恢复 spinner-border 的圆形 */
.spinner-border,
.spinner-border::before {
    border-radius: 50% !important;
}

/* --- body --- */
body {
    height: 100vh;
    overflow: hidden;
    font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Bootstrap 组件矩形化覆盖 --- */
.btn {
    border-radius: 0 !important;
    transition: all var(--transition-fast);
    font-weight: 500;
    letter-spacing: 0.02em;
    border-width: 1px;
}
.btn:active {
    transform: scale(0.98);
}

.form-control,
.form-select {
    border-radius: 0 !important;
    border: 1px solid var(--input-border);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-control:focus,
.form-select:focus {
    border-color: var(--input-focus);
    outline: 2px solid rgba(45, 90, 240, 0.2);
    outline-offset: 0;
}

.modal-content {
    border-radius: 0 !important;
    border: 1px solid var(--border-color);
}
.modal-header {
    border-bottom: 1px solid var(--border-color);
    background: #f8f9fb;
}
.modal-footer {
    border-top: 1px solid var(--border-color);
    background: #f8f9fb;
}

.card {
    border-radius: 0 !important;
    border: 1px solid var(--border-color);
}
.dropdown-menu {
    border-radius: 0 !important;
    border: 1px solid var(--border-color);
}
.alert {
    border-radius: 0 !important;
    border-width: 1px;
}
.table {
    border-radius: 0 !important;
}
.toast {
    border-radius: 0 !important;
}
.badge {
    border-radius: 0 !important;
}
.tooltip-inner {
    border-radius: 0 !important;
}

/* --- 布局结构 --- */
.wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    align-items: stretch;
}

/* --- 侧边栏 --- */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: margin-left var(--transition-slow), transform var(--transition-slow);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

#sidebar .sidebar-header {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#sidebar .sidebar-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.03em;
    margin: 0;
}

#sidebar .sidebar-sections {
    overflow-y: auto;
    flex-grow: 1;
}

#sidebar .sidebar-sections ul.list-unstyled {
    padding: 0 8px;
}

#sidebar .section-label {
    padding: 12px 14px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 2px;
}

#sidebar #current-chat-section {
    margin-bottom: 4px;
}

#sidebar #history-chat-section {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#sidebar ul.list-unstyled {
    padding: 8px 8px;
    overflow-y: auto;
    flex-grow: 1;
}

#sidebar ul li a {
    padding: 10px 14px;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#sidebar ul li a i {
    font-size: 14px;
    min-width: 20px;
}

#sidebar ul li a:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-bg-hover);
    border-left-color: rgba(45, 90, 240, 0.3);
}

#sidebar ul li.active a {
    color: #ffffff;
    background: var(--sidebar-bg-active);
    border-left-color: var(--brand-primary);
    font-weight: 500;
}

/* 新对话按钮 */
#new-chat-btn {
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: rgba(255, 255, 255, 0.8) !important;
    background: transparent !important;
    padding: 6px 10px !important;
    font-size: 14px;
    transition: all var(--transition-fast);
}
#new-chat-btn:hover:not(:disabled) {
    background: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    color: #ffffff !important;
}
#new-chat-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 侧边栏底部 */
#sidebar .sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
}

/* 未登录时用户区域 */
#sidebar .sidebar-user-locked {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    cursor: default;
    user-select: none;
}
#sidebar .sidebar-user-locked span {
    font-size: 13px;
}

/* --- 主内容区 --- */
#content {
    flex-grow: 1;
    min-height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--chat-bg);
}

/* --- 聊天区域 --- */
#chat-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

/* --- 聊天气泡 --- */
.chat-bubble {
    padding: 16px 20px;
    margin-bottom: 16px;
    max-width: 72%;
    line-height: 1.7;
    word-wrap: break-word;
    position: relative;
    border: 1px solid var(--border-color);
}
.chat-bubble .sender {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    opacity: 0.7;
}

.chat-bubble.user {
    background-color: var(--brand-primary);
    color: #ffffff;
    margin-left: auto;
    border-color: var(--brand-primary);
}
.chat-bubble.user .sender {
    color: rgba(255,255,255,0.8);
}

.chat-bubble.ai {
    background-color: var(--card-bg);
    color: var(--text-primary);
    margin-right: auto;
}
.chat-bubble.ai .sender {
    color: var(--brand-primary);
}

.chat-bubble.system {
    background-color: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
    width: 100%;
    max-width: 100%;
    text-align: center;
    font-size: 13px;
}
.chat-bubble.system .sender {
    display: none;
}

.chat-bubble .content p:last-child { margin-bottom: 0; }
.chat-bubble .content pre {
    white-space: pre-wrap;
    background: #f5f7fa;
    padding: 12px;
    border: 1px solid var(--border-color);
    font-size: 13px;
    overflow-x: auto;
}
.chat-bubble .content code {
    font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
    font-size: 13px;
}
.chat-bubble .content a {
    color: var(--brand-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}
.chat-bubble.user .content a {
    color: rgba(255,255,255,0.9);
    border-bottom-color: rgba(255,255,255,0.5);
}
.chat-bubble .content a:hover {
    border-bottom-color: currentColor;
}
.chat-bubble .content table {
    border-collapse: collapse;
    margin: 8px 0;
}
.chat-bubble .content table th,
.chat-bubble .content table td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    font-size: 13px;
}
.chat-bubble .content table th {
    background: #f5f7fa;
    font-weight: 600;
}

/* --- 分析卡片 --- */
.analysis-card {
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    overflow: hidden;
    margin-bottom: 16px;
}
.analysis-card .card-header {
    background-color: #f8f9fb;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.analysis-card .card-body {
    padding: 18px;
}
.analysis-card-plot {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
}
.analysis-card .table {
    margin-bottom: 0;
    font-size: 13px;
}
.analysis-card .table-bordered th,
.analysis-card .table-bordered td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
}

/* --- 输入区域 --- */
#input-area {
    padding: 16px 24px;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    gap: 10px;
}

#message-input {
    padding: 12px 16px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}
#message-input:focus {
    border-color: var(--input-focus);
    outline: 2px solid rgba(45, 90, 240, 0.2);
    outline-offset: 0;
}
#message-input::placeholder {
    color: var(--text-muted);
}

#input-area .btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
}

#send-btn {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
    color: #ffffff;
}
#send-btn:hover:not(:disabled) {
    background: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
}
#send-btn:disabled {
    opacity: 0.5;
}

#upload-btn {
    background: #f5f7fa;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
}
#upload-btn:hover:not(:disabled) {
    background: #eef0f4;
    color: var(--text-primary);
    border-color: #c0c4cc;
}

/* --- 侧边栏切换按钮 --- */
#sidebar-toggle {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 1200;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--text-secondary);
    font-size: 16px;
}
#sidebar-toggle:hover {
    background: #f5f7fa;
    color: var(--text-primary);
}

/* --- 模态框增强 --- */
.modal {
    z-index: 1200;
}
.modal-dialog-centered .modal-content {
    overflow: hidden;
}
.modal-title {
    font-weight: 600;
    font-size: 16px;
}
.modal-header {
    padding: 16px 20px;
}
.modal-body {
    padding: 20px;
}
.modal .form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.modal .form-control {
    padding: 10px 14px;
}

/* --- Geetest 验证码防遮挡 --- */
#loginModal .modal-content {
    overflow: visible;
}
#loginModal .modal-dialog {
    overflow: visible;
}
#loginModal {
    overflow: visible;
}
#geetestModal .modal-content {
    overflow: visible;
}
#geetestModal .modal-dialog {
    overflow: visible;
}
#geetestModal {
    overflow: visible;
}

/* --- 响应式布局 --- */
@media (max-width: 768px) {
    #sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
        position: absolute;
        z-index: 1100;
        height: 100%;
    }
    #sidebar.collapsed {
        margin-left: 0;
    }
    #sidebar-toggle {
        display: flex;
    }
    #chat-area {
        padding: 16px;
        padding-top: 64px;
    }
    #input-area {
        padding: 12px 16px;
    }
    .chat-bubble {
        max-width: 88%;
    }
}

/* --- 动画效果 --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble,
.analysis-card {
    animation: fadeInUp 0.3s ease forwards;
}

/* --- 遮罩层（移动端侧边栏背景） --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1050;
}
.sidebar-overlay.active {
    display: block;
}

/* --- 滚动条全局美化 --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.25);
}

/* --- 通用工具类：分析结果增强组件 --- */

/* 系统警告框 - 矩形化极简风格 */
.guard-warning-box {
    padding: 14px 18px;
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-top: 2px solid #f59e0b;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.guard-warning-box strong {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 12px;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.guard-warning-box ul {
    margin: 0;
    padding-left: 18px;
}
.guard-warning-box li {
    margin-bottom: 5px;
    padding-left: 4px;
}
.guard-warning-box li:last-child {
    margin-bottom: 0;
}
.guard-warning-box li::marker {
    color: #f59e0b;
}

/* 诊断日志框 - 矩形化极简风格 */
.diagnostic-log-box {
    padding: 14px 18px;
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-top: 2px solid var(--brand-primary);
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    max-height: 220px;
    overflow-y: auto;
    line-height: 1.6;
}
.diagnostic-log-box strong {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 12px;
    color: var(--brand-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.diagnostic-log-box pre {
    margin: 0;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    white-space: pre-wrap;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-primary);
}

/* 判断标准指标标签 */
.criteria-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: #f8f9fb;
    color: var(--text-secondary);
}
.criteria-badge.pass {
    border-color: #16a34a;
    background: #f0fdf4;
    color: #15803d;
}
.criteria-badge.fail {
    border-color: #dc2626;
    background: #fef2f2;
    color: #991b1b;
}
.criteria-badge.ignored {
    border-color: #9ca3af;
    background: #f3f4f6;
    color: #6b7280;
}

/* 决策路径标签 */
.decision-path-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    background: #eef2ff;
    border: 1px solid var(--brand-primary-light);
    color: var(--brand-primary);
    letter-spacing: 0.02em;
}

/* 指标可视化容器 */
.metrics-visualization {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    padding: 16px;
    background: #fafbfc;
    border: 1px solid var(--border-color);
    margin-top: 12px;
}
.metric-card {
    padding: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    text-align: center;
}
.metric-card-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
    font-weight: 600;
}
.metric-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--brand-primary);
    line-height: 1.2;
}
.metric-card-unit {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-left: 2px;
}

/* --- 统一页面布局 --- */
.page-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px 32px;
    background: var(--body-bg);
}

/* --- 页面头部：矩形卡片设计 --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    margin-bottom: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}
.page-header .page-header-left {
    min-width: 0;
}
.page-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-primary);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.page-header h2 i {
    font-size: 16px;
    color: var(--brand-primary);
}
.page-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}
.page-header .page-header-right {
    flex-shrink: 0;
    margin-left: 16px;
}
.page-header .btn-header-action {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}
.page-header .btn-header-action:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(45, 90, 240, 0.04);
}

/* --- 统一面板样式 --- */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--border-color);
}
.panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.panel-count {
    font-size: 12px;
    color: var(--text-muted);
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
}

/* --- 统一上传区域 --- */
.upload-zone {
    border: 2px dashed var(--border-color);
    padding: 20px 24px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}
.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--brand-primary);
    background: rgba(45, 90, 240, 0.02);
}
.upload-zone.has-file {
    border-style: solid;
    border-color: var(--brand-primary);
    background: rgba(45, 90, 240, 0.03);
}
.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.upload-icon { font-size: 28px; color: var(--text-muted); margin-bottom: 8px; }
.upload-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text-muted); }

/* --- FFT 统一样式设计--- */
.fft-upload-panel .upload-zone {
    margin: 18px 18px 18px 18px;
    min-height: 132px;
}
.fft-upload-panel .options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}
.fft-upload-panel .options-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}
.fft-upload-panel .options-note {
    margin: 0;
    padding: 0 18px 14px;
    font-size: 12px;
    color: var(--text-muted);
    background: #fafbfc;
}

/* --- 统一操作按钮 --- */
.btn-primary-solid {
    background: var(--brand-primary);
    color: #fff;
    border: 1px solid var(--brand-primary);
    padding: 10px 28px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.15s ease;
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary-solid:hover:not(:disabled) {
    background: var(--brand-primary-hover);
    border-color: var(--brand-primary-hover);
}
.btn-primary-solid:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--input-border);
    color: var(--text-secondary);
    padding: 10px 18px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-outline:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* --- 统一状态条 --- */
.status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    font-size: 13px;
    margin-bottom: 20px;
    border-left: 3px solid;
    animation: fadeIn 0.25s ease;
}
.status-bar.info {
    background: #eef2ff;
    border-left-color: var(--brand-primary);
    color: var(--brand-primary);
}
.status-bar.error {
    background: #fef2f2;
    border-left-color: #dc2626;
    color: #991b1b;
}
.status-bar.success {
    background: #f0fdf4;
    border-left-color: #16a34a;
    color: #15803d;
}
.status-bar.warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
    color: #92400e;
}

/* --- 统一表格样式 --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th,
.data-table td {
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    text-align: left;
}
.data-table th {
    background: #f8f9fb;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
}
.data-table tr:nth-child(even) {
    background: #fafbfc;
}

/* --- 统一操作栏 --- */
.action-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}

/* --- 统一文件信息栏 --- */
.file-info {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #f8f9fb;
    border-top: 1px solid var(--border-color);
}
.file-info.show { display: flex; }
.file-info-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.file-info-clear {
    background: none;
    border: 1px solid var(--input-border);
    color: var(--text-muted);
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.file-info-clear:hover { border-color: #dc2626; color: #dc2626; }

/* --- 统一选项行 --- */
.options-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
}
.options-row label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}
.options-row select { max-width: 180px; font-size: 13px; }
.options-hint { font-size: 11px; color: var(--text-muted); margin-left: auto; }

/* --- 统一加载遮罩 --- */
.loading-overlay {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    min-height: 300px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    animation: fadeIn 0.3s ease;
}
.loading-overlay.show { display: flex; }
.loading-icon {
    font-size: 42px;
    color: var(--brand-primary);
    margin-bottom: 18px;
    animation: spin 1.5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.loading-sub { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* --- 统一结果面板 --- */
.result-panel {
    display: none;
    animation: slideUp 0.35s ease forwards;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.result-panel.show { display: block; }

.result-actions {
    display: flex;
    gap: 10px;
    padding: 14px 18px;
    background: #fafbfc;
    border-bottom: 1px solid var(--border-color);
}
.result-actions a,
.result-actions button {
    font-size: 13px;
    padding: 7px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.result-panel .section-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 18px 8px;
    border-top: 1px solid var(--border-color);
    background: #f8f9fb;
}
.result-panel .section-label:first-of-type {
    border-top: none;
}
.metric-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.result-subtitle {
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--text-muted);
}
.result-subnote {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

/* --- FFT 缁撴灉鍥捐〃缃戞牸 --- */
.image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border-left: 1px solid var(--border-color);
}
.image-card {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}
.image-card:nth-child(3n) { border-right: none; }
.image-card-label {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: #f8f9fb;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.image-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #f7f8fa;
    display: block;
}

/* --- FFT蹇€熺粨鏋滄爣鍑嗗乏鍙虫瀯鍥?--- */
.fft-result-split {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 0;
    border-top: 1px solid var(--border-color);
}
.fft-result-visual-pane {
    border-right: 1px solid var(--border-color);
    background: #f7f8fa;
}
.fft-result-visual-stage {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.fft-result-visual-stage img {
    max-width: 100%;
    max-height: 480px;
    object-fit: contain;
}
.fft-result-visual-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}
.fft-result-visual-empty i {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.4;
}

/* --- 历史详情图像网格复用 --- */
.detail-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--border-color);
    margin-top: 12px;
}
.detail-image-card {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
}
.detail-image-card:nth-child(3n) { border-right: none; }
.detail-image-card-label {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: #f5f6f7;
    border-bottom: 1px solid var(--border-color);
}
.detail-image-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: #f7f8fa;
    display: block;
}

.metrics-5d-container.spaced,
.decision-path-section.spaced,
.diagnostic-log-section.spaced {
    margin-top: 12px;
}

.plot-preview-box {
    text-align: center;
    padding: 12px 0;
    background: #f7f8fa;
    border: 1px solid var(--border-color);
}
.plot-preview-box img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
}

/* --- 统一指标行 --- */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    transition: background 0.15s ease;
}
.metric-row:last-child { border-bottom: none; }
.metric-row:hover { background: #f9fafb; }
.metric-key { color: var(--text-muted); font-weight: 500; flex-shrink: 0; margin-right: 16px; }
.metric-val { color: var(--text-primary); font-weight: 600; text-align: right; word-break: break-all; }

/* --- 统一空状态 --- */
.empty-state {
    padding: 60px 24px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 48px;
    margin-bottom: 14px;
    opacity: 0.3;
    display: block;
}
.empty-state p { font-size: 14px; margin: 0 0 12px 0; }
.empty-state a { color: var(--brand-primary); text-decoration: none; font-weight: 500; }
.empty-state a:hover { text-decoration: underline; }

/* --- 统一状态栏（带关闭按钮） --- */
.status-icon { flex-shrink: 0; font-size: 15px; }
.status-text { flex: 1; }
.status-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    transition: opacity 0.15s ease;
}
.status-close:hover { opacity: 1; }
.status-bar.hidden { display: none; }

/* --- 隐藏面板 --- */
.panel.hidden-panel {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    margin-bottom: 0;
    padding: 0;
    border: none;
}

/* --- 响应式补充 --- */
@media (max-width: 768px) {
    .page-container { padding: 24px 16px; }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px 18px;
    }
    .page-header .page-header-right {
        margin-left: 0;
        align-self: flex-end;
    }
    .action-bar { flex-direction: column; align-items: stretch; }
    .options-row { flex-direction: column; align-items: stretch; }
    .options-row select { max-width: 100%; width: 100%; }
    .options-hint { margin-left: 0; margin-top: 4px; }
    .fft-result-split {
        grid-template-columns: 1fr;
    }
    .fft-result-visual-pane {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .image-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .image-card:nth-child(2n) { border-right: none; }
    .image-card:nth-child(3n) { border-right: 1px solid var(--border-color); }
    .detail-image-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .detail-image-card:nth-child(2n) { border-right: none; }
    .detail-image-card:nth-child(3n) { border-right: 1px solid var(--border-color); }
}
@media (max-width: 600px) {
    .image-grid {
        grid-template-columns: 1fr;
    }
    .image-card {
        border-right: none;
    }
}
@media (max-width: 480px) {
    .detail-image-grid {
        grid-template-columns: 1fr;
    }
    .detail-image-card {
        border-right: none;
    }
}

/* ============================================================
   五维度指标卡片系统 (5D Metrics Cards)
   ============================================================ */
.metrics-5d-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}
.metrics-5d-card {
    padding: 20px 14px;
    text-align: center;
    border-right: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
}
.metrics-5d-card:last-child { border-right: none; }
.metrics-5d-card:hover { background: #f9fafb; }

.metrics-5d-symbol {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.metrics-5d-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    line-height: 1.3;
}
.metrics-5d-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.metrics-5d-bar {
    height: 3px;
    margin-top: 12px;
    background: #e4e7ed;
    position: relative;
    overflow: hidden;
}
.metrics-5d-bar-fill {
    height: 100%;
    transition: width 0.6s ease;
    position: absolute;
    left: 0;
    top: 0;
}
.metrics-5d-bar-fill.good { background: #16a34a; }
.metrics-5d-bar-fill.warn { background: #f59e0b; }
.metrics-5d-bar-fill.bad { background: #dc2626; }

@media (max-width: 992px) {
    .metrics-5d-container {
        grid-template-columns: repeat(3, 1fr);
    }
    .metrics-5d-card:nth-child(4) { border-right: none; }
    .metrics-5d-card:nth-child(3),
    .metrics-5d-card:nth-child(5) { border-top: 1px solid var(--border-color); }
}
@media (max-width: 576px) {
    .metrics-5d-container {
        grid-template-columns: repeat(2, 1fr);
    }
    .metrics-5d-card:nth-child(odd) { border-right: 1px solid var(--border-color); }
    .metrics-5d-card:nth-child(even) { border-right: none; }
}

/* ============================================================
   决策路径可视化 (Decision Path Visualization)
   ============================================================ */
.decision-path-section {
    padding: 18px 20px;
    background: #f8f9fb;
    border-bottom: 1px solid var(--border-color);
}
.decision-path-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 10px;
}
.decision-path-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.decision-path-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.decision-path-badge .path-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}
.decision-path-arrow {
    color: var(--text-muted);
    font-size: 14px;
}
.decision-path-result {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    background: var(--brand-primary);
    color: #fff;
}
.decision-path-detail {
    margin-top: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
}
.decision-path-detail code {
    background: #f1f3f5;
    padding: 2px 6px;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 11px;
    color: var(--brand-primary);
}

/* ============================================================
   检测日志友好渲染 (Diagnostic Log Renderer)
   ============================================================ */
.diagnostic-log-section {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
}
.diagnostic-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.diagnostic-log-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.diagnostic-log-toggle {
    background: none;
    border: 1px solid var(--input-border);
    padding: 4px 10px;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s ease;
}
.diagnostic-log-toggle:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}
.diagnostic-log-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
}
.diagnostic-log-list.show { display: block; animation: fadeIn 0.25s ease; }
.diagnostic-log-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 12px;
    border-bottom: 1px dashed #e4e7ed;
    line-height: 1.6;
}
.diagnostic-log-item:last-child { border-bottom: none; }
.diagnostic-log-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    margin-top: 2px;
}
.diagnostic-log-icon.guard { background: #fef3c7; color: #92400e; }
.diagnostic-log-icon.info { background: #dbeafe; color: #1e40af; }
.diagnostic-log-icon.pass { background: #dcfce7; color: #166534; }
.diagnostic-log-text { flex: 1; color: var(--text-secondary); word-break: break-word; }
.diagnostic-log-text strong { color: var(--text-primary); font-weight: 600; }
.diagnostic-log-entry {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px dashed #e4e7ed;
    font-size: 12px;
    line-height: 1.6;
}
.diagnostic-log-entry:last-child {
    border-bottom: none;
}
.diagnostic-log-tag {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-secondary);
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace;
}
.diagnostic-log-content {
    flex: 1;
    color: var(--text-secondary);
    word-break: break-word;
}
.log-tag-success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}
.log-tag-warn {
    border-color: #fcd34d;
    background: #fffbeb;
    color: #92400e;
}
.log-tag-error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

/* ============================================================
   系统警告区域 (Guard Warnings Section)
   ============================================================ */
.guard-warnings-section {
    padding: 16px 20px;
    background: #fffbeb;
    border-bottom: 1px solid var(--border-color);
}
.guard-warnings-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
}
.guard-warnings-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.guard-warning-item {
    padding: 8px 12px;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.7);
    border-left: 3px solid #f59e0b;
    font-size: 12px;
    color: #78350f;
    line-height: 1.5;
}
.guard-warning-item:last-child { margin-bottom: 0; }
.guard-warning-item code {
    background: rgba(245,158,11,0.15);
    padding: 1px 5px;
    font-family: "SF Mono", "Consolas", monospace;
    font-size: 11px;
    color: #92400e;
}

/* ============================================================
   升级版侧边栏 (Enhanced Sidebar)
   ============================================================ */
.sidebar-nav-item {
    transition: all 0.18s ease;
}
.sidebar-nav-item:hover {
    background: var(--sidebar-bg-hover);
    border-left-color: var(--brand-primary-light);
}
.sidebar-nav-item.active {
    background: var(--sidebar-bg-active);
    border-left-color: var(--brand-primary);
}
.sidebar-nav-item.active .sidebar-nav-text {
    color: var(--sidebar-text-active);
}
.sidebar-section-label {
    padding: 14px 20px 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.sidebar-user-info {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 12px;
    color: var(--sidebar-text);
}
.sidebar-user-name {
    font-weight: 600;
    color: var(--sidebar-text-active);
    margin-bottom: 4px;
}

/* ============================================================
   升级版登录模态框 (Enhanced Login Modal)
   ============================================================ */
.login-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.login-modal-overlay.show { display: flex; }
.login-modal-box {
    width: 400px;
    max-width: 92vw;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fb;
}
.login-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}
.login-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color 0.15s ease;
}
.login-modal-close:hover { color: var(--text-primary); }
.login-modal-body { padding: 28px 24px; }
.login-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #f8f9fb;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}
