/* =========================================================
   在线批量 OCR 文字识别 - 样式
   文件：/assets/css/ocr_20261021.css
   ========================================================= */

:root {
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --brand-soft: #eff6ff;
    --text: #0f172a;
    --text-sub: #475569;
    --text-muted: #94a3b8;
    --line: #e2e8f0;
    --bg-page: #f8fafc;
    --danger: #dc2626;
    --ok: #16a34a;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg-page);
}

img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
p { margin: 0; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 100;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--brand-soft); color: var(--brand); flex: none;
}
.brand-title { font-size: 16px; font-weight: 700; }
.brand-subtitle { font-size: 12px; color: var(--text-muted); }
.nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.nav a { color: var(--text-sub); }
.nav a:hover { color: var(--brand); text-decoration: none; }

/* ---------------- 区块 ---------------- */
.section { padding: 28px 0; }
.section-head { margin-bottom: 18px; text-align: center; }
.section-tag {
    display: inline-block; margin-bottom: 6px; padding: 2px 10px;
    font-size: 12px; color: var(--brand); background: var(--brand-soft); border-radius: 999px;
}
.section-title { font-size: 22px; margin-bottom: 6px; }
.section-copy { color: var(--text-sub); font-size: 14px; max-width: 780px; margin: 0 auto; }

.hero { text-align: center; padding: 10px 0 22px; }
.hero-title { font-size: 24px; margin-bottom: 10px; }
.hero-desc { color: var(--text-sub); font-size: 15px; max-width: 860px; margin: 0 auto 10px; }
.hero-free { font-size: 13px; color: var(--text-muted); }
.hero-free strong { color: var(--brand); }

/* ---------------- 工具区 ---------------- */
.tool-shell {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 16px;
}

.drop-zone {
    border: 2px dashed #cbd5e1; border-radius: var(--radius);
    background: #fbfdff; padding: 30px 16px; text-align: center;
    cursor: pointer; transition: border-color .18s, background .18s;
}
.drop-zone:hover, .drop-zone:focus-visible { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.drop-zone.dragover { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone.is-busy { pointer-events: none; opacity: .6; }
.drop-icon { color: var(--brand); display: flex; justify-content: center; margin-bottom: 10px; }
.drop-icon svg { width: 40px; height: 40px; }
.drop-main { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.drop-sub { font-size: 13px; color: var(--text-muted); }

/* 识别能力说明 */
.notice-bar {
    display: flex; flex-wrap: wrap; gap: 8px 10px;
    margin: 12px 0 0; padding: 0; list-style: none;
}
.notice-bar li {
    padding: 3px 10px; font-size: 12px; color: var(--text-sub);
    background: var(--bg-page); border: 1px solid var(--line); border-radius: 999px;
}

.list-wrap { margin-top: 16px; }
.list-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.list-head h2 { font-size: 15px; }
.list-head h2 span { color: var(--brand); }
.link-btn {
    border: 0; background: none; padding: 0; font-size: 13px;
    color: var(--text-muted); cursor: pointer; font-family: inherit;
}
.link-btn:hover { color: var(--brand); text-decoration: underline; }

.list-grid {
    display: grid; gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
.list-item {
    position: relative; border: 1px solid var(--line); border-radius: 10px;
    overflow: hidden; background: #fff;
}
.list-item .thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-page); }
.list-item .item-name {
    padding: 4px 6px; font-size: 11px; color: var(--text-sub);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.list-item .item-badge {
    position: absolute; top: 4px; left: 4px; padding: 1px 6px;
    font-size: 11px; border-radius: 999px; background: rgba(15, 23, 42, .72); color: #fff;
}
.list-item .item-badge.doing { background: var(--brand); }
.list-item .item-badge.done { background: var(--ok); }
.list-item .item-badge.fail { background: var(--danger); }
.list-item .item-del {
    position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
    border: 0; border-radius: 50%; line-height: 1; font-size: 14px; cursor: pointer;
    background: rgba(15, 23, 42, .6); color: #fff;
}
.list-item .item-msg {
    padding: 0 6px 6px; font-size: 11px; line-height: 1.45; color: var(--danger);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-all;
}

.action-bar { display: flex; gap: 10px; margin-top: 16px; }
.btn-primary, .btn-ghost {
    flex: 1; padding: 12px 16px; border-radius: 10px; font-size: 15px;
    font-family: inherit; cursor: pointer; border: 1px solid transparent; transition: .18s;
}
.btn-primary { background: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-primary:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text-sub); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.progress-wrap { margin-top: 14px; }
.progress-track { height: 8px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #60a5fa, var(--brand)); transition: width .25s; }
.progress-text { margin-top: 8px; font-size: 13px; color: var(--text-sub); text-align: center; }

.flash { margin-top: 12px; font-size: 13px; text-align: center; min-height: 20px; }
.flash.ok { color: var(--ok); }
.flash.bad { color: var(--danger); }
.flash.loading { color: var(--brand); }

/* ---------------- 结果区 ---------------- */
.results {
    margin-top: 20px; background: #fff; border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px;
}
.results-head h2 { font-size: 18px; margin-bottom: 4px; }
.results-note { font-size: 13px; color: var(--text-muted); }

.results-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn-mini {
    padding: 6px 12px; font-size: 13px; font-family: inherit; cursor: pointer;
    background: #fff; color: var(--text-sub); border: 1px solid var(--line); border-radius: 8px;
    transition: .15s;
}
.btn-mini:hover { border-color: var(--brand); color: var(--brand); }
.btn-mini--primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-mini--primary:hover { background: var(--brand-dark); color: #fff; }
.btn-mini.is-copied { border-color: var(--ok); color: var(--ok); background: #f0fdf4; }

.results-summary { margin-top: 8px; font-size: 13px; color: var(--text-sub); }
.results-hint { margin-top: 6px; font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.results-grid { margin-top: 14px; display: grid; gap: 14px; grid-template-columns: 1fr; }

.ocr-card {
    margin: 0; display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0;
    border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff;
}
.ocr-thumb {
    background: var(--bg-page); border-right: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; padding: 8px;
}
.ocr-thumb img { max-height: 190px; width: auto; max-width: 100%; object-fit: contain; border-radius: 6px; }
.ocr-thumb.is-empty { color: var(--text-muted); font-size: 12px; text-align: center; }

.ocr-body { padding: 10px 12px 12px; min-width: 0; }
.ocr-head { display: flex; align-items: center; gap: 8px; }
.ocr-name {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.ocr-badge { flex: none; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #f0fdf4; color: var(--ok); }
.ocr-badge.is-warn { background: #fff7ed; color: #c2410c; }

.ocr-text {
    margin: 8px 0 0; padding: 10px; max-height: 260px; overflow: auto;
    background: var(--bg-page); border: 1px solid var(--line); border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "PingFang SC", "Microsoft YaHei", monospace;
    font-size: 13px; line-height: 1.75; color: var(--text);
    white-space: pre-wrap; word-break: break-word;
}
.ocr-text.is-empty { color: var(--text-muted); font-family: inherit; }

/* 纯文本 / 表格 视图切换 */
.ocr-views { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.view-btn {
    padding: 3px 11px; font-size: 12px; font-family: inherit; cursor: pointer;
    color: var(--text-sub); background: #fff;
    border: 1px solid var(--line); border-radius: 999px;
    transition: .15s;
}
.view-btn:hover { border-color: var(--brand); color: var(--brand); }
.view-btn.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }

.ocr-tableview {
    margin-top: 8px; max-height: 320px; overflow: auto;
    border: 1px solid var(--line); border-radius: 8px; background: #fff;
    -webkit-overflow-scrolling: touch;
}
.ocr-table { border-collapse: collapse; font-size: 13px; }
.ocr-table td {
    border: 1px solid var(--line); padding: 5px 9px;
    vertical-align: top; min-width: 72px; max-width: 280px;
    white-space: pre-wrap; word-break: break-word; color: var(--text);
}
.ocr-table tr:nth-child(even) td { background: #fbfdff; }
.ocr-table td.is-empty { background: var(--bg-page); }

.ocr-meta { margin-top: 8px; font-size: 12px; color: var(--text-muted); }
.ocr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* ---------------- 内容区 ---------------- */
.card-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.info-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow);
}
.info-index { display: block; font-size: 13px; font-weight: 700; color: var(--brand); margin-bottom: 4px; }
.info-card h3 { font-size: 16px; margin-bottom: 6px; }
.info-card p { font-size: 14px; color: var(--text-sub); }

.prose {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow);
}
.prose p { font-size: 14px; color: var(--text-sub); margin-bottom: 10px; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); }

.usecase-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 16px 34px; margin: 0; box-shadow: var(--shadow); }
.usecase-list li { font-size: 14px; color: var(--text-sub); margin-bottom: 8px; }
.usecase-list li:last-child { margin-bottom: 0; }
.usecase-list strong { color: var(--text); }

.faq-list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 16px; margin: 0; box-shadow: var(--shadow); }
.faq-list dt { font-weight: 600; margin-top: 14px; font-size: 15px; }
.faq-list dt:first-child { margin-top: 8px; }
.faq-list dd { margin: 6px 0 14px; font-size: 14px; color: var(--text-sub); }

.more-links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.more-links a {
    padding: 7px 14px; background: #fff; border: 1px solid var(--line);
    border-radius: 999px; font-size: 14px; color: var(--text-sub);
}
.more-links a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

/* ---------------- 页脚 ---------------- */
.footer { padding: 26px 0 34px; text-align: center; border-top: 1px solid var(--line); margin-top: 10px; background: #fff; }
.footer-copy { font-size: 13px; color: var(--text-muted); }
.footer-contact { margin-top: 8px; font-size: 13px; }

/* ---------------- H5 ---------------- */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .wrap { padding: 0 12px; }
    .topbar-inner { height: 56px; }
    .brand-subtitle { display: none; }
    .brand-title { font-size: 15px; }
    .nav { gap: 10px; font-size: 13px; }
    .section { padding: 20px 0; }
    .hero { padding: 4px 0 16px; }
    .hero-title { font-size: 20px; }
    .hero-desc { font-size: 14px; }
    .section-title { font-size: 19px; }
    .tool-shell { padding: 12px; }
    .drop-zone { padding: 24px 12px; }
    .drop-icon svg { width: 34px; height: 34px; }
    .drop-main { font-size: 15px; }
    .notice-bar { gap: 6px; }
    .notice-bar li { font-size: 11px; padding: 2px 8px; }
    .action-bar { flex-direction: column-reverse; }
    .list-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
    .ocr-card { grid-template-columns: 1fr; }
    .ocr-thumb { border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; }
    .ocr-thumb img { max-height: 160px; }
    .ocr-text { max-height: 220px; font-size: 12.5px; }
    .ocr-actions .btn-mini { flex: 1; text-align: center; min-width: 88px; }
    .ocr-tableview { max-height: 260px; }
    .ocr-table td { min-width: 60px; max-width: 200px; font-size: 12.5px; padding: 4px 7px; }
    .ocr-views { gap: 6px; }
    .view-btn { font-size: 11.5px; padding: 2px 9px; }
    .info-card { padding: 14px; }
}
