/* ============================================================
   PDF合并拆分工具 - 样式表
   与官网 style.css 保持同一套设计变量、导航与页脚样式
   ============================================================ */

:root {
    --primary: #1a6eff;
    --primary-light: #e8f1ff;
    --primary-dark: #0d4fc4;
    --primary-gradient: linear-gradient(135deg, #1a6eff 0%, #0d4fc4 100%);
    --text: #1a1a2e;
    --text-secondary: #5a5a7a;
    --text-light: #8a8aa0;
    --bg: #ffffff;
    --bg-warm: #f8fafc;
    --bg-card: #ffffff;
    --border: #e8ecf4;
    --shadow: 0 4px 24px rgba(26, 110, 255, 0.08);
    --shadow-hover: 0 12px 40px rgba(26, 110, 255, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --warning: #ff6b35;
    --warning-light: #fff3ed;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    overflow-x: hidden;
}
img { max-width: 100%; }
code {
    font-family: Consolas, Monaco, monospace;
    font-size: 0.9em;
    background: var(--primary-light);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 5px;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== NAVIGATION（照抄官网） ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(26, 110, 255, 0.08);
    transition: var(--transition);
}
.navbar.scrolled { box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06); }
.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 900;
    font-size: 18px;
}
.logo-icon img { height: 44px; }
.logo-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.logo-text span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-light);
    letter-spacing: 1px;
}
.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
}
.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
    background: var(--primary-light);
}
.mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    border: none;
    background: var(--primary-light);
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.mobile-toggle span {
    display: block;
    width: 20px; height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== FOOTER（照抄官网） ===== */
.footer {
    background: var(--text);
    color: white;
    padding: 64px 0 32px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
}
.footer-brand .logo-icon {
    margin-bottom: 16px;
    display: flex;
    align-items: left;
    justify-content: left;
}
.footer-brand .logo-icon img { height: 84px; }
.footer-brand p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.8;
    max-width: 320px;
}
.footer-col h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 14px;
    transition: var(--transition);
}
.footer-col a:hover { color: white; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.footer-bottom p,
.footer-bottom a {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
}

/* ===== PAGE HEADER ===== */
.page-header {
    padding: 140px 0 48px;
    background: linear-gradient(180deg, #f0f5ff 0%, #ffffff 100%);
    text-align: center;
}
.page-header h1 {
    font-size: clamp(28px, 4vw, 40px);
    font-weight: 900;
    color: var(--text);
    margin-bottom: 12px;
}
.page-header p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.8;
}
.breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--text-light);
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.breadcrumb a:hover { text-decoration: underline; }

/* ===== 本地运行提示条 ===== */
.notice-bar { padding: 24px 0 0; }
.notice-inner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, #e8f1ff 0%, #f0f5ff 100%);
    border: 1.5px solid rgba(26, 110, 255, 0.15);
    border-radius: var(--radius);
    padding: 18px 24px;
}
.notice-icon {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.notice-icon svg { width: 22px; height: 22px; color: white; }
.notice-inner h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.notice-inner p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== 工具主体 ===== */
.tool-main { padding: 32px 0 80px; }

/* 选项卡 */
.tool-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.tool-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 100px;
    border: 1.5px solid var(--border);
    background: white;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}
.tool-tab svg { width: 16px; height: 16px; }
.tool-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.tool-tab.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(26, 110, 255, 0.3);
}

.tool-panel { display: none; }
.tool-panel.active { display: block; }

/* 拖拽上传区 */
.dropzone {
    border: 2px dashed rgba(26, 110, 255, 0.3);
    border-radius: var(--radius);
    background: var(--bg-warm);
    padding: 56px 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
.dz-icon {
    width: 56px; height: 56px;
    color: var(--primary);
    margin-bottom: 16px;
}
.dz-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}
.dz-sub {
    font-size: 13px;
    color: var(--text-light);
}

/* 文件信息栏 */
.file-info-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.file-info svg { width: 32px; height: 32px; color: var(--primary); flex-shrink: 0; }
.file-info strong {
    display: block;
    font-size: 15px;
    color: var(--text);
    word-break: break-all;
}
.file-info span {
    font-size: 12px;
    color: var(--text-light);
}
.file-actions { flex-shrink: 0; }

/* 通用小按钮 */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1.5px solid var(--primary);
    background: white;
    color: var(--primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn-sm:hover { background: var(--primary-light); }
.btn-ghost-sm {
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-ghost-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* 缩略图工具条 */
.thumb-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.check-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}
.check-all input {
    width: 16px; height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
.thumb-count {
    font-size: 13px;
    color: var(--text-light);
}
.thumb-toolbar-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* 缩略图网格 */
.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.thumb-item {
    position: relative;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    cursor: pointer;
    transition: var(--transition);
}
.thumb-item:hover {
    border-color: rgba(26, 110, 255, 0.4);
    box-shadow: var(--shadow);
}
.thumb-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 16px rgba(26, 110, 255, 0.18);
}
.thumb-canvas-wrap {
    background: var(--bg-warm);
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    display: flex;
    align-items: center;
    justify-content: center;
}
.thumb-canvas-wrap canvas {
    max-width: 100%;
    max-height: 100%;
}
.thumb-page-num {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}
.thumb-check {
    position: absolute;
    top: 8px; left: 8px;
    width: 20px; height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    z-index: 2;
}
.thumb-loading {
    font-size: 12px;
    color: var(--text-light);
}

/* 操作面板 */
.ops-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.op-group {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.op-group h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}
.op-group h3 svg { width: 18px; height: 18px; color: var(--primary); }
.op-desc {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 14px;
}
.op-row { margin-bottom: 12px; }
.op-row:last-child { margin-bottom: 0; }
.op-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
}
.text-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
}
.text-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 110, 255, 0.12);
}
.text-input::placeholder { color: var(--text-light); }

.btn-op {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 20px;
    border-radius: 10px;
    border: none;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.btn-op:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary-op {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 16px rgba(26, 110, 255, 0.3);
}
.btn-primary-op:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 110, 255, 0.4);
}
.btn-secondary-op {
    background: white;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-secondary-op:hover:not(:disabled) { background: var(--primary-light); }
.btn-danger-op {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.25);
}
.btn-danger-op:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
}
.btn-lg { padding: 13px 28px; font-size: 14px; }

/* ===== 合并面板 ===== */
.merge-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.merge-list-header h3 { font-size: 16px; font-weight: 700; }
.merge-header-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.merge-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.merge-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    transition: var(--transition);
}
.merge-item:hover {
    border-color: rgba(26, 110, 255, 0.3);
    box-shadow: var(--shadow);
}
.merge-order {
    width: 32px; height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    flex-shrink: 0;
}
.merge-item-info { flex: 1; min-width: 0; }
.merge-item-info strong {
    display: block;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.merge-item-info span {
    font-size: 12px;
    color: var(--text-light);
}
.merge-item-btns { display: flex; gap: 6px; flex-shrink: 0; }
.merge-item-btns .btn-sm { padding: 6px 10px; }
.merge-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.merge-total { font-size: 13px; color: var(--text-light); }

/* ===== 状态栏 ===== */
.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 14px 20px;
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
}
.status-bar.error {
    background: var(--danger-light);
    border-color: rgba(220, 38, 38, 0.2);
    color: var(--danger);
}
.status-bar.success {
    background: var(--success-light);
    border-color: rgba(22, 163, 74, 0.2);
    color: var(--success);
}
.status-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(26, 110, 255, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===== 帮助区 ===== */
.help-section { margin-top: 56px; }
.help-section h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 20px;
    text-align: center;
}
.help-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.help-card {
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}
.help-card h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}
.help-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ============================================================
   响应式（与官网断点规则一致）
   ============================================================ */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .ops-panel { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* 导航汉堡菜单（照抄官网规则） */
    .nav-links {
        display: none;
        position: absolute;
        top: 72px;
        left: 0; right: 0;
        background: white;
        flex-direction: column;
        padding: 16px 24px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        gap: 4px;
        border-bottom: 1px solid var(--border);
        z-index: 999;
    }
    .nav-links.active { display: flex; }
    .mobile-toggle { display: flex; }

    /* 页头 */
    .page-header { padding: 112px 0 36px; }
    .page-header p { font-size: 14px; padding: 0 8px; }

    /* 提示条 */
    .notice-inner { padding: 16px 18px; }
    .notice-icon { width: 36px; height: 36px; }

    /* 选项卡 */
    .tool-tabs { gap: 8px; }
    .tool-tab { padding: 10px 18px; font-size: 13px; }

    /* 上传区 */
    .dropzone { padding: 40px 16px; }
    .dz-title { font-size: 14px; }

    /* 文件信息 */
    .file-info-bar { flex-direction: column; align-items: flex-start; }
    .file-actions { width: 100%; }
    .file-actions .btn-sm { width: 100%; justify-content: center; }

    /* 缩略图 */
    .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
    .thumb-toolbar { gap: 10px; }
    .thumb-toolbar-btns { width: 100%; }
    .thumb-toolbar-btns .btn-sm { flex: 1; justify-content: center; }

    /* 操作面板 */
    .op-group { padding: 20px 16px; }
    .op-btns { flex-direction: column; }
    .op-btns .btn-op { width: 100%; }

    /* 合并 */
    .merge-item { flex-wrap: wrap; }
    .merge-item-btns { width: 100%; justify-content: flex-end; }
    .merge-footer { flex-direction: column; align-items: stretch; }
    .merge-footer .btn-op { width: 100%; }
    .merge-total { text-align: center; }

    /* 帮助区 */
    .help-grid { grid-template-columns: 1fr; }

    /* 页脚（照抄官网规则） */
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }
    .footer { padding: 48px 0 24px; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .logo-text { font-size: 14px; }
    .thumb-grid { grid-template-columns: repeat(2, 1fr); }
    .btn-op { white-space: normal; }
}
