/* ─── 变量 ─── */
:root {
    --primary: #111;
    --primary-dark: #000;
    --success: #333;
    --warning: #555;
    --danger: #333;
    --bg: #fff;
    --surface: #fff;
    --text: #111;
    --muted: #888;
    --border: #ddd;
    --sidebar-bg: #111;
    --sidebar-w: 220px;
    --topbar-h: 52px;
    --radius: 0px;
    --content-gutter: clamp(18px, 2.8vw, 40px);
    --content-max: min(1720px, calc(100vw - var(--sidebar-w) - (var(--content-gutter) * 2)));
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
ul, ol { list-style: none; }

/* ─── 侧边栏 ─── */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #ccc;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}

.brand-text { font-size: 15px; font-weight: 600; color: #fff; }

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    color: #999;
    font-size: 14px;
    transition: background .15s, color .15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.1); color: #fff; font-weight: 600; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid rgba(255,255,255,.12);
}

.points-display {
    padding: 8px 18px;
    font-size: 13px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link-external { font-size: 13px; opacity: .7; }
.nav-link-external:hover { opacity: 1; }

/* ─── 移动端顶栏 ─── */
.topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--sidebar-bg);
    color: #fff;
    z-index: 999;
    padding: 0 16px;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    background: none; border: none; color: #fff;
    font-size: 18px; cursor: pointer; padding: 4px;
}

.topbar-title { font-weight: 600; font-size: 15px; flex: 1; }
.topbar-points { font-size: 12px; color: #999; }

/* ─── 主内容 ─── */
.main-content {
    margin-left: var(--sidebar-w);
    padding: var(--content-gutter);
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
}

/* ─── 面板 ─── */
.panel {
    display: none;
    background: var(--surface);
    border-radius: 0;
    border: none;
    width: min(100%, var(--content-max));
    overflow: hidden;
}

.panel.active { display: block; }

.panel-header {
    padding: clamp(22px, 2vw, 30px) clamp(22px, 2.2vw, 34px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h2 {
    font-size: clamp(18px, 1.25vw, 22px);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 i { color: var(--text); }
.panel-body { padding: clamp(22px, 2.4vw, 34px); }

.panel-header-home { align-items: flex-start; }

.panel-heading {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 78ch;
}

.panel-subtitle {
    font-size: clamp(13px, .95vw, 15px);
    line-height: 1.75;
    color: #888;
}

.panel-body-home { padding-top: clamp(18px, 1.8vw, 28px); }

/* ─── 按钮 ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px clamp(14px, 1.2vw, 18px);
    border: none;
    border-radius: 0;
    font-size: clamp(14px, .95vw, 15px);
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #222; }

.btn-outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ─── 上传区 ─── */
.landing-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
    gap: clamp(20px, 2vw, 30px);
    align-items: stretch;
}

.landing-main {
    min-width: 0;
    padding: clamp(20px, 2vw, 30px);
    border-radius: 0;
    border: none;
    background: #fafafa;
}

.landing-side { min-width: 0; }

.guide-card {
    position: sticky;
    top: clamp(20px, 2vw, 32px);
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: clamp(20px, 2vw, 30px);
    min-height: 100%;
    border-radius: 0;
    border: none;
    background: #f7f7f7;
}

.guide-card-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.guide-chip {
    align-self: flex-start;
    padding: 6px 12px;
    border-radius: 0;
    background: #e8e8e8;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
}

.guide-card h3 {
    font-size: clamp(22px, 1.8vw, 30px);
    line-height: 1.25;
    color: var(--text);
}

.guide-lead {
    font-size: clamp(13px, .95vw, 15px);
    color: #888;
    line-height: 1.8;
}

.guide-card-footer {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.guide-hint { margin: 0; }

.upload-area {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: clamp(18px, 1.6vw, 24px);
}

.file-label {
    flex: 1;
    min-width: 180px;
    min-height: 48px;
    padding: 11px 14px;
    border: 1px dashed var(--border);
    border-radius: 0;
    color: var(--muted);
    font-size: clamp(14px, .95vw, 15px);
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-label.selected { border-color: var(--primary); color: var(--primary); background: rgba(0,0,0,.02); }
.file-label.invalid  { border-color: #333;  color: #333;  background: rgba(0,0,0,.04); }

/* ─── 进度条 ─── */
.progress-section { margin-bottom: 16px; }

.progress-info-bar {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 6px;
}

.progress-info-bar strong { color: var(--text); }

.progress-track {
    height: 8px;
    background: #e0e0e0;
    border-radius: 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 0;
    transition: width .3s ease;
}

/* ─── 提示 ─── */
.hint {
    font-size: 13px;
    color: var(--muted);
    margin: 12px 0;
    line-height: 1.7;
}

.hint i { color: #999; margin-right: 4px; }

/* ─── 配置区 ─── */
.config-section {
    border-top: none;
    padding-top: 20px;
    margin-top: 8px;
}

.landing-main .config-section {
    border-top: none;
    margin-top: clamp(18px, 1.8vw, 26px);
    padding: clamp(18px, 1.8vw, 24px);
    border-radius: 0;
    background: rgba(255,255,255,1);
    border: none;
}

.config-section h3 { font-size: clamp(16px, 1vw, 18px); font-weight: 600; margin-bottom: 4px; }
.config-desc { font-size: clamp(13px, .92vw, 14px); color: var(--muted); margin-bottom: 12px; }

.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0;
    margin-bottom: 16px;
}

/* ─── 勾选样式 ─── */
.lang-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: background .1s;
    border-bottom: 1px solid #eee;
}

.lang-check:last-child { border-bottom: none; }

.lang-check:hover { background: #f5f5f5; }

.lang-check input[type="checkbox"] {
    appearance: auto;
    -webkit-appearance: auto;
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #111;
}

.lang-check strong { font-weight: 600; }
.lang-check small { color: var(--muted); font-size: 12px; margin-left: 4px; }

/* ─── 操作栏 ─── */
.action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.action-bar.center { justify-content: center; margin-top: 16px; }

.charge-note { font-size: 13px; color: var(--muted); }
.charge-note i { color: #999; }

/* ─── 分析结果 ─── */
.result-display {
    min-height: 160px;
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    width: 100%;
}

.result-metric {
    border: none;
    border-radius: 0;
    padding: clamp(16px, 1.35vw, 22px);
    background: #fafafa;
}

.result-metric-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.result-metric-value { font-size: clamp(28px, 2vw, 36px); font-weight: 700; line-height: 1; }

.metric-total  .result-metric-value { color: var(--text); }
.metric-high   .result-metric-value { color: #111; }
.metric-medium .result-metric-value { color: #555; }
.metric-low    .result-metric-value { color: #999; }

/* ─── 空状态 / 加载 / 错误 ─── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    padding: 30px;
    text-align: center;
}

.empty-state i { font-size: 24px; color: #999; }
.empty-state.is-error { color: #333; }
.empty-state.is-error i { color: #333; }
.empty-state span { white-space: pre-line; }

/* ─── 分析进度 ─── */
.progress-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.progress-info > i { font-size: 24px; color: #999; }
.progress-info > span { font-size: 14px; font-weight: 600; }

.analysis-progress-container {
    width: 100%; height: 10px;
    border-radius: 0;
    background: #e0e0e0;
    overflow: hidden;
}

.analysis-progress {
    height: 100%;
    border-radius: 0;
    transition: width .35s ease;
}

.progress-primary { background: var(--primary); }
.progress-warning { background: #555; }
.progress-success { background: #333; }
.progress-tip { font-size: 12px; color: var(--muted); }

/* ─── 历史报告 ─── */
.history-list { min-height: 200px; }

.history-summary {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    padding: 8px 12px;
    background: #f5f5f5;
    border-radius: 0;
    margin-bottom: 12px;
}

.scrollable-list { max-height: 520px; overflow-y: auto; }
.scrollable-list::-webkit-scrollbar { width: 5px; }
.scrollable-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 0; }

.report-list { display: flex; flex-direction: column; gap: 0; }

.report-item {
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 14px;
    transition: background .15s;
    animation: fadeIn .25s ease forwards;
    animation-delay: calc(var(--index, 0) * .03s);
    opacity: 0;
}

.report-item:last-child { border-bottom: none; }

.report-item:hover { background: #fafafa; }
.report-item.downloading { background: #f5f5f5; }
.report-item.download-completed { background: #f5f5f5; }

.report-header, .report-meta, .report-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.report-number {
    width: 26px; height: 26px;
    border-radius: 0;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.report-meta-item { font-size: 13px; color: var(--muted); }
.report-meta-item i { color: #999; margin-right: 3px; }
.report-content { margin: 10px 0; }
.report-id { font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.report-filename {
    font-size: 13px;
    color: var(--muted);
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 0;
    background: var(--primary);
    color: #fff;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}

.download-btn:hover { background: var(--primary-dark); }
.download-btn.download-success { background: var(--success); }
.download-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── 使用指南 ─── */
.guide-steps {
    counter-reset: step;
    padding: 0;
    display: grid;
    gap: 0;
}

.guide-steps li {
    counter-increment: step;
    padding: 14px 16px 14px 56px;
    position: relative;
    font-size: clamp(14px, .95vw, 15px);
    line-height: 1.75;
    color: #333;
    border: none;
    border-bottom: 1px solid #eee;
    background: transparent;
}

.guide-steps li:last-child { border-bottom: none; }

.guide-steps li::before {
    content: counter(step);
    position: absolute;
    left: 16px; top: 16px;
    width: 28px; height: 28px;
    border-radius: 0;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── 弹窗 ─── */
.alert-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.4);
    z-index: 2000;
    padding: 16px;
}

.alert-overlay.hidden { display: none; }

.alert-box {
    width: 100%; max-width: 340px;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    overflow: hidden;
}

.alert-content { padding: 28px 24px 16px; text-align: center; }
.alert-content i { font-size: 40px; margin-bottom: 10px; }
.alert-content p { margin: 0; white-space: pre-line; color: #333; line-height: 1.7; }
.alert-box .btn { width: calc(100% - 32px); margin: 0 16px 16px; justify-content: center; }

.success-icon { color: #333; }
.error-icon   { color: #111; }
.warning-icon { color: #555; }
.info-icon    { color: #999; }

/* ─── 全局 loading ─── */
body.loading::before {
    content: "";
    position: fixed; inset: 0;
    background: rgba(255,255,255,.78);
    z-index: 1500;
}

body.loading::after {
    content: "加载中...";
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    padding: 12px 20px;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
    z-index: 1501;
    font-size: 14px;
}

/* ─── 动画 ─── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fa-hourglass-half { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: .5; transform: scale(.94); }
    50%      { opacity: 1;  transform: scale(1); }
}

/* ─── 响应式 ─── */
@media (max-width: 1080px) {
    .landing-layout { grid-template-columns: 1fr; }
    .guide-card { position: static; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .topbar { display: flex; }
    .main-content { margin-left: 0; padding: 68px 16px 16px; display: block; }
    .panel { width: 100%; border-radius: 0; }
    .panel-header, .panel-body { padding-left: 18px; padding-right: 18px; }
    .landing-layout { grid-template-columns: 1fr; gap: 16px; }
    .landing-main, .guide-card { padding: 18px; }
    .lang-grid, .results-grid { grid-template-columns: 1fr; }
    .upload-area { flex-direction: column; align-items: stretch; }
    .file-label { min-width: 0; }
    .action-bar { flex-direction: column; align-items: stretch; }
    .action-bar .btn { justify-content: center; }
    .report-meta { flex-direction: column; align-items: flex-start; }
}

/* 侧边栏遮罩 */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.3);
    z-index: 999;
}

@media (max-width: 768px) {
    .sidebar.open ~ .sidebar-backdrop { display: block; }
}
