/* ========================================
   ZIP to PDF — 响应式设计
   使用 CSS 变量 (var(--xxx)) 引用设计系统
   ======================================== */

/* ---- 导航栏 ---- */
@media (max-width: 768px) {
    .top-header {
        flex-direction: row;
        align-items: center;
        height: auto;
        padding: 10px 12px;
    }
    .logo img { height: 36px; }
    .user-menu .nav-link {
        padding: 5px 10px;
        font-size: 0.82em;
    }
    .main-navigation {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .nav-list { gap: 0; }
    .nav-item .nav-link {
        padding: 10px 14px;
        font-size: 0.85em;
    }
}

/* ---- 管理后台导航 ---- */
@media (max-width: 768px) {
    .admin-nav { flex-wrap: wrap; gap: 4px; }
    .admin-nav a { padding: 8px 14px; font-size: 0.85em; }
    .admin-box { padding: 16px; }
}

/* ---- 侧边栏 ---- */
@media (max-width: 900px) {
    .layout-container { flex-direction: column; }
    .content-wrapper { margin-right: 0; }
}

/* ---- 容器/内容 ---- */
@media (max-width: 768px) {
    .container { max-width: 100%; padding: 0; }
    .content {
        padding: 16px;
        margin: 0 0 12px 0;
        border-radius: var(--radius-lg);
    }
    .tool-card {
        padding: 18px;
        border-radius: var(--radius-lg);
    }
    .page-header {
        padding: 0 2px var(--space-4);
        gap: var(--space-3);
    }
    .page-header-icon {
        width: 48px;
        height: 48px;
        border-radius: 15px;
    }
    .page-header-svg {
        width: 23px;
        height: 23px;
    }
    .page-header h1 { font-size: 1.3em; }
}

/* ---- 文件/PDF 列表 ---- */
@media (max-width: 768px) {
    .file-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .pdf-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .upload-area, .upload-zone { padding: 32px 20px; }
    .upload-icon {
        width: 60px;
        height: 60px;
        border-radius: 18px;
        font-size: 2.1em;
    }
    .upload-icon-svg { width: 28px; height: 28px; }
}

/* ---- 博客 ---- */
@media (max-width: 768px) {
    .blog-content { padding: 14px; margin: 0; max-width: 100%; }
    .post-title { font-size: 1.4em; }
    .post-body { font-size: 0.92em; }
    .post-body pre { padding: 10px; font-size: 0.82em; overflow-x: auto; }
    .per-page-bar { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
    .per-page-label, .per-page-link, .per-page-divider,
    .excerpt-toggle, .per-page-total { flex-shrink: 0; white-space: nowrap; }
}

/* ---- 表格 ---- */
@media (max-width: 768px) {
    .posts-table, .users-table, .logs-table, .files-table, .file-table,
    .posts-table thead, .users-table thead, .logs-table thead,
    .posts-table tbody, .users-table tbody, .logs-table tbody,
    .posts-table th, .users-table th, .logs-table th,
    .posts-table td, .users-table td, .logs-table td,
    .posts-table tr, .users-table tr, .logs-table tr {
        font-size: 0.85em;
    }
    .posts-table th, .posts-table td,
    .users-table th, .users-table td,
    .logs-table th, .logs-table td {
        padding: 6px 8px;
    }
    .cat-table { min-width: 720px; }
}

/* ---- 统计面板 ---- */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .number { font-size: 1.4em; }
}

/* ---- 分步指示器 ---- */
@media (max-width: 768px) {
    .step-indicator { flex-wrap: wrap; gap: 8px; }
    .step { flex: 1; min-width: 60px; }
    .step-label { font-size: 0.7em; }
}

/* ---- 表单 ---- */
@media (max-width: 768px) {
    .form-group { margin-bottom: 14px; }
    .format-select { max-width: 100%; }
    .tool-section { padding: 14px 16px; }
    .tool-title { font-size: 1em; }
}

/* ---- 通用 ---- */
@media (max-width: 768px) {
    .footer { padding: 14px; font-size: 0.82em; }
    .page-header p { font-size: 0.85em; }

    /* 按钮 */
    .upload-btn, .download-btn, .tool-btn, .btn { padding: 7px 16px; font-size: 0.88em; }

    /* 分页 */
    .pagination { gap: 2px; }
    .pagination a, .pagination span { padding: 5px 10px; font-size: 0.82em; }
}

/* ---- 超小屏幕 ---- */
@media (max-width: 480px) {
    .top-header { padding: 6px 8px; }
    .logo img { height: 30px; }
    .nav-item .nav-link { padding: 8px 10px; font-size: 0.8em; }
    .page-header h1 { font-size: 1.15em; }
    .post-title { font-size: 1.2em; }
    .post-body { font-size: 0.88em; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card .number { font-size: 1.2em; }
    .admin-box { padding: 12px; }

    /* 面包屑 */
    .breadcrumb { font-size: 0.78em; }

    /* 侧边栏 - 更紧凑 */
    .sidebar-section { margin-bottom: 12px; }
    .sidebar-section h3 { font-size: 0.9em; }
    .sidebar-section a { font-size: 0.82em; }
}

/* ---- 滚动条 ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- 触摸优化 ---- */
button, a { -webkit-tap-highlight-color: transparent; }

/* ---- 焦点样式（按钮/链接的环形高亮由 style.css 统一处理） ---- */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

/* ---- 文本溢出 ---- */
.file-name, .post-title, .tool-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Archive Workspace responsive refinements ---- */
@media (max-width: 1120px) {
    .logo-caption { display: none; }
    .layout-container { gap: var(--space-5); }
    .home-hero { gap: var(--space-6); }
    .home-tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-tool-card.featured { grid-column: span 2; }
    .home-utility-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-writing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .layout-container { padding-top: var(--space-5); }
    .sidebar {
        position: static;
        max-height: none;
        overflow: visible;
    }
    .home-hero {
        grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr);
        padding: 32px;
    }
    .home-hero h1 { font-size: clamp(2.2rem, 5.4vw, 3.3rem); }
    .archive-stage { transform: scale(0.9); transform-origin: right center; }
}

@media (max-width: 768px) {
    .layout-container { padding: var(--space-4) var(--space-3); }
    .logo-word { font-size: 0.95rem; }
    .home-hero {
        grid-template-columns: 1fr;
        min-height: 0;
        padding: 30px 24px;
        margin-bottom: var(--space-8);
    }
    .home-hero h1 { max-width: 13ch; }
    .archive-stage {
        width: 300px;
        height: 270px;
        justify-self: center;
        transform: scale(0.92);
    }
    .home-tool-grid,
    .home-writing-grid,
    .home-resource-grid { grid-template-columns: 1fr; }
    .home-tool-card.featured,
    .home-writing-card.lead { grid-column: auto; }
    .home-writing-card.lead { min-height: 170px; padding: var(--space-5); }
    .home-tool-card { min-height: 168px; }
    .home-profile { grid-template-columns: auto minmax(0, 1fr); }
    .home-profile-links {
        grid-column: 1 / -1;
        flex-direction: row;
        gap: var(--space-5);
        padding: var(--space-4) 0 0;
        border-top: 1px solid var(--border-light);
        border-left: 0;
    }
    .section-heading { align-items: flex-start; }
    .section-heading > p { display: none; }
    .home-status { grid-template-columns: 1fr; }
    .home-page .footer { flex-direction: column; align-items: flex-start; }
    .convert-page .formats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .convert-page .result-actions { flex-direction: column; align-items: stretch; }
    .convert-page .result-actions .download-btn { align-self: flex-start; }
    .convert-workflow { margin-bottom: var(--space-5); }
    .convert-step { padding: 10px; font-size: 0.68rem; gap: 6px; }
}

@media (max-width: 480px) {
    .top-header { height: 60px; }
    .main-navigation { top: 60px; }
    .logo img { height: 30px; }
    .logo-word { display: none; }
    .home-hero { padding: 26px 20px; box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.13); }
    .home-hero h1 { font-size: 2.15rem; }
    .hero-description { font-size: 0.9rem; }
    .hero-actions { align-items: stretch; }
    .hero-actions a { flex: 1; padding-inline: 14px; }
    .archive-stage { width: 270px; height: 245px; transform: scale(0.82); }
    .archive-sheet { width: 154px; height: 198px; padding: 16px; }
    .zip-sheet { left: 4px; }
    .pdf-sheet { right: 2px; bottom: 14px; }
    .archive-arrow { top: 112px; }
    .home-utility-strip { grid-template-columns: 1fr; }
    .home-utility-link { min-height: 54px; }
    .home-notice summary { align-items: flex-start; flex-wrap: wrap; gap: 8px 12px; }
    .home-notice summary strong { flex: 1; min-width: 160px; }
    .home-notice .post-meta { padding-inline: var(--space-4) !important; }
    .home-notice .post-body { padding: 0 var(--space-4) var(--space-4); }
    .convert-page .upload-area { padding: 44px 18px 32px; box-shadow: 5px 5px 0 #0b1c1f; }
    .convert-page .upload-text { font-size: 0.94rem; }
    .convert-workflow { grid-template-columns: 1fr; }
    .convert-step { border-bottom: 1px solid var(--border-light); }
    .convert-step:last-child { border-bottom: 0; }
}