/* ══════════════════════════════════════════════
   小萝资源中心 · 全局样式
   简洁、实用，无多余装饰
   ══════════════════════════════════════════════ */

/* ── 基础重置 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.6;
    background: #f4f4f5;
    color: #1a1a1a;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ── 布局 ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── 顶部导航 ── */
.site-header {
    background: #fff;
    border-bottom: 1px solid #e4e4e7;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 16px;
}
.site-name {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    white-space: nowrap;
    text-decoration: none;
}
.site-name:hover { text-decoration: none; }
.search-form {
    display: flex;
    flex: 1;
    max-width: 480px;
}
.search-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    outline: none;
}
.search-form input:focus { border-color: #2563eb; }
.search-form button {
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
}
.search-form button:hover { background: #1d4ed8; }
.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    color: #6b7280;
}

/* ── 主内容区 ── */
.page-main { padding: 28px 0 60px; }

/* ── 文件卡片网格（首页） ── */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    margin-top: 24px;
}
.file-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.file-card:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37,99,235,.12);
    text-decoration: none;
}
.card-thumb {
    aspect-ratio: 3 / 4;
    background: #f4f4f5;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.card-no-preview {
    font-size: 22px;
    font-weight: 700;
    color: #9ca3af;
    letter-spacing: 1px;
}
.card-info {
    padding: 8px 10px 10px;
    border-top: 1px solid #f0f0f0;
}
.card-name {
    font-size: 13px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 3px;
}

/* ── 分页 ── */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 32px;
    flex-wrap: wrap;
}
.pagination a,
.pagination span {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
}
.pagination a:hover { background: #eff6ff; border-color: #2563eb; text-decoration: none; }
.pagination .current {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* ── 文件详情页 ── */
.file-detail-header {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 22px 26px;
    margin-bottom: 20px;
}
.file-detail-header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 10px;
    word-break: break-all;
}
.file-meta-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.preview-grid img {
    width: 100%;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    cursor: pointer;
}
.preview-grid img:hover { border-color: #2563eb; }

/* ── 按钮 ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.4;
    white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover   { background: #1d4ed8; text-decoration: none; color: #fff; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover   { background: #15803d; text-decoration: none; color: #fff; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover   { background: #b45309; text-decoration: none; color: #fff; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover    { background: #b91c1c; text-decoration: none; color: #fff; }
.btn-secondary { background: #f3f4f6; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover { background: #e5e7eb; text-decoration: none; }
.btn-sm     { padding: 4px 10px; font-size: 13px; }
.btn-link   { background: none; border: none; padding: 0; color: #2563eb; cursor: pointer; font-size: 14px; }

/* ── 管理后台布局 ── */
.admin-header {
    background: #1e293b;
    color: #fff;
    padding: 12px 0;
}
.admin-header .container {
    display: flex;
    align-items: center;
    gap: 20px;
}
.admin-logo { font-size: 16px; font-weight: 700; }
.admin-nav  { display: flex; gap: 4px; flex: 1; }
.admin-nav-link {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 14px;
    color: #cbd5e1;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
}
.admin-nav-link:hover { background: #334155; color: #fff; text-decoration: none; }
.admin-nav-link.active { background: #2563eb; color: #fff; }
.admin-user { font-size: 13px; color: #94a3b8; margin-left: auto; }
.admin-user a { color: #94a3b8; }
.admin-user a:hover { color: #fff; }

.admin-tab { display: none; }
.admin-tab.active { display: block; }

/* ── 表格 ── */
.table-wrap { background: #fff; border: 1px solid #e4e4e7; border-radius: 6px; overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table th {
    padding: 11px 14px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    border-bottom: 1px solid #e4e4e7;
    background: #fafafa;
    white-space: nowrap;
}
.table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafafa; }
.file-name-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions-cell { display: flex; gap: 5px; flex-wrap: wrap; }

/* ── 状态徽章 ── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-pending    { background: #f3f4f6; color: #6b7280; }
.badge-processing { background: #dbeafe; color: #1d4ed8; }
.badge-completed  { background: #dcfce7; color: #16a34a; }
.badge-failed     { background: #fee2e2; color: #dc2626; }
.badge-published  { background: #dcfce7; color: #16a34a; }
.badge-draft      { background: #f3f4f6; color: #6b7280; }

/* ── 表单 ── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: #2563eb; }

/* ── 上传区域 ── */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    transition: border-color .15s, background .15s;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
.upload-zone p { color: #6b7280; font-size: 14px; margin-top: 8px; }

/* 上传进度 */
.progress-wrap { margin-top: 14px; display: none; }
.progress-bar  { height: 6px; background: #e4e4e7; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: #2563eb; transition: width .3s; width: 0; }
.progress-text { font-size: 13px; color: #6b7280; margin-bottom: 5px; }

/* ── 消息提示 ── */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ── 空状态 ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}
.empty-state p { font-size: 15px; }

/* ── 登录页 ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 36px 40px;
    width: 100%;
    max-width: 380px;
}
.login-card h1 { font-size: 22px; font-weight: 700; margin-bottom: 24px; text-align: center; }

/* ── 初始化页 ── */
.setup-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.setup-card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 36px 40px;
    width: 100%;
    max-width: 400px;
}

/* ── 面包屑 ── */
.breadcrumb {
    font-size: 13px;
    color: #9ca3af;
    margin-bottom: 16px;
    display: flex;
    gap: 6px;
    align-items: center;
}
.breadcrumb a { color: #6b7280; }

/* ── 全宽白色卡片 ── */
.card {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 22px 24px;
    margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }

/* ── 响应式 ── */
@media (max-width: 640px) {
    .files-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .site-header .container { flex-wrap: wrap; gap: 10px; }
    .search-form { max-width: 100%; order: 3; width: 100%; }
    .login-card, .setup-card { padding: 28px 20px; }
}

/* ══ 分类功能新增样式 ══ */

/* ── 卡片分类标签（前台） ── */
.card-category {
    display: inline-block;
    font-size: 11px;
    padding: 1px 7px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 3px;
    margin-top: 4px;
    line-height: 1.6;
}

/* ── 公开前台分类导航 ── */
.cat-nav {
    background: #fff;
    border-bottom: 1px solid #e4e4e7;
    padding: 8px 0;
    overflow-x: auto;
    white-space: nowrap;
}
.cat-nav .container { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── 分类胶囊（前后台通用） ── */
.cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: #6b7280;
    background: #f3f4f6;
    border: 1px solid #e4e4e7;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.cat-pill:hover { background: #eff6ff; border-color: #93c5fd; color: #2563eb; text-decoration: none; }
.cat-pill.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.cat-pill-count { font-size: 11px; opacity: .75; }

/* ── 管理工具栏 ── */
.admin-toolbar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.admin-search { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.admin-search input {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    width: 200px;
    font-family: inherit;
}
.admin-search input:focus { outline: none; border-color: #2563eb; }
.admin-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; }

/* ── 批量操作栏 ── */
.batch-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.batch-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.batch-sep { width: 1px; height: 22px; background: #bfdbfe; flex-shrink: 0; }
.batch-cat-sel {
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    height: 30px;
    font-family: inherit;
}

/* ── 复选框列 ── */
.col-check { width: 38px; padding-left: 14px !important; }
.col-check input[type=checkbox],
.row-cb { width: 15px; height: 15px; cursor: pointer; accent-color: #2563eb; }

/* ── 行内分类选择器 ── */
.inline-cat-sel {
    padding: 3px 6px;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    font-size: 12px;
    color: #374151;
    background: #fff;
    max-width: 130px;
    font-family: inherit;
}
.inline-cat-sel:focus { outline: none; border-color: #2563eb; }

/* ── 响应式补充 ── */
@media (max-width: 900px) {
    .admin-toolbar { flex-direction: column; align-items: stretch; }
    .admin-filters { flex-wrap: wrap; }
    .batch-bar { flex-direction: column; align-items: flex-start; }
}
