/* ==================== 全局重置与基础样式 ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
}
a { color: #1890ff; text-decoration: none; transition: color .2s; }
a:hover { color: #40a9ff; }
img { max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.text-center { text-align: center; }
.text-gray { color: #999; }
.required { color: #ff4d4f; }

/* ==================== 按钮 ==================== */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    line-height: 1.5;
    background: #fff;
    color: #333;
}
.btn:hover { opacity: .85; }
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-success { background: #52c41a; color: #fff; border-color: #52c41a; }
.btn-warning { background: #faad14; color: #fff; border-color: #faad14; }
.btn-danger { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.btn-info { background: #13c2c2; color: #fff; border-color: #13c2c2; }
.btn-outline { background: transparent; border-color: #d9d9d9; color: #595959; }
.btn-outline:hover { border-color: #1890ff; color: #1890ff; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 12px; }
.btn-block { display: block; width: 100%; }
.btn-download { font-weight: 500; }

/* ==================== 表单 ==================== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,.2);
}
.form-control-sm { padding: 4px 8px; font-size: 13px; }
textarea.form-control { resize: vertical; min-height: 60px; }
.form-hint { display: block; margin-top: 4px; font-size: 12px; color: #999; }
.form-row { display: flex; gap: 16px; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

/* ==================== 标签 ==================== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.5;
}
.tag-blue { background: #e6f7ff; color: #1890ff; }
.tag-green { background: #f6ffed; color: #52c41a; }
.tag-red { background: #fff2f0; color: #ff4d4f; }
.tag-gray { background: #f5f5f5; color: #8c8c8c; }
.tag-orange { background: #fff7e6; color: #fa8c16; }

/* ==================== 提示框 ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-success { background: #f6ffed; border-color: #b7eb8f; color: #389e0d; }
.alert-error { background: #fff2f0; border-color: #ffccc7; color: #cf1322; }
.alert-warning { background: #fffbe6; border-color: #ffe58f; color: #d48806; }
.alert-info { background: #e6f7ff; border-color: #91d5ff; color: #0050b3; }

/* ==================== 表格 ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}
.data-table th {
    background: #fafafa;
    font-weight: 600;
    color: #595959;
    white-space: nowrap;
}
.data-table tr:hover { background: #fafafa; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
.info-table td:first-child { width: 200px; color: #8c8c8c; font-weight: 500; }

/* ==================== 弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 { font-size: 16px; }
.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; }

/* ==================== 分页 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.page-link {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #595959;
    background: #fff;
    font-size: 13px;
}
.page-link:hover { border-color: #1890ff; color: #1890ff; }
.page-link.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.page-dots { padding: 6px 4px; color: #999; }

/* ==================== 登录页 ==================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15);
}
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { font-size: 48px; margin-bottom: 12px; }
.login-header h1 { font-size: 22px; color: #333; margin-bottom: 6px; }
.login-header p { color: #999; font-size: 14px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form input { padding: 10px 14px; font-size: 15px; }
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { color: #999; font-size: 13px; }

/* ==================== 后台布局 ==================== */
.admin-page { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 220px;
    background: #001529;
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.sidebar-logo {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.logo-icon { font-size: 24px; }
.logo-text { font-size: 16px; 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 20px;
    color: rgba(255,255,255,.75);
    font-size: 14px;
    transition: all .2s;
    border-left: 3px solid transparent;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active {
    color: #fff;
    background: #1890ff;
    border-left-color: #fff;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: 8px 0; }

.admin-main {
    flex: 1;
    margin-left: 220px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.admin-header {
    background: #fff;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    position: sticky;
    top: 0;
    z-index: 50;
}
.admin-header h1 { font-size: 20px; color: #333; }
.admin-user { display: flex; align-items: center; gap: 12px; }
.admin-user span { color: #595959; font-size: 14px; }
.admin-content { padding: 24px; flex: 1; }

/* ==================== 后台 - 统计卡片 ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.stat-icon { font-size: 36px; }
.stat-value { font-size: 24px; font-weight: 700; color: #333; }
.stat-label { font-size: 13px; color: #999; margin-top: 2px; }

/* ==================== 后台 - 面板 ==================== */
.panel {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    overflow: hidden;
}
.panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.panel-header h3 { font-size: 15px; color: #333; }
.panel-body { padding: 20px; }

/* ==================== 后台 - 工具栏 ==================== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-right .form-control { width: auto; min-width: 140px; }

/* ==================== 后台 - 文件列表单元格 ==================== */
.file-name-cell { display: flex; align-items: center; gap: 10px; }
.file-icon { font-size: 24px; flex-shrink: 0; }
.file-title { font-weight: 500; color: #333; }
.file-desc { font-size: 12px; color: #999; margin-top: 2px; }

/* ==================== 后台 - 上传区域 ==================== */
.upload-area {
    position: relative;
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafafa;
}
.upload-area:hover, .upload-area.dragover { border-color: #1890ff; background: #e6f7ff; }
.upload-area input[type="file"] {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    cursor: pointer;
}
.upload-placeholder .upload-icon { font-size: 40px; margin-bottom: 8px; }
.upload-placeholder p { color: #666; margin: 4px 0; }
.upload-hint { font-size: 12px; color: #999 !important; }
.file-info {
    margin-top: 12px;
    padding: 10px;
    background: #f0f5ff;
    border-radius: 4px;
    font-size: 13px;
    color: #1890ff;
}
.upload-progress { margin-top: 12px; display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 8px; background: #f0f0f0; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: #1890ff; border-radius: 4px; transition: width .3s; width: 0%; }
.parse-result { margin-left: 10px; font-size: 13px; }
.parse-result.success { color: #52c41a; }
.parse-result.error { color: #ff4d4f; }

/* ==================== 前台 - 头部 ==================== */
.front-header {
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 20px;
    flex-wrap: wrap;
}
.site-brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { font-size: 28px; }
.brand-name { font-size: 20px; font-weight: 700; color: #333; }
.header-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-link {
    padding: 6px 14px;
    border-radius: 6px;
    color: #595959;
    font-size: 14px;
    transition: all .2s;
}
.nav-link:hover { background: #f0f5ff; color: #1890ff; }
.nav-link.active { background: #1890ff; color: #fff; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.search-form { display: flex; align-items: center; }
.search-input {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 13px;
    width: 180px;
    outline: none;
}
.search-input:focus { border-color: #1890ff; }
.search-btn {
    padding: 6px 12px;
    border: 1px solid #1890ff;
    background: #1890ff;
    color: #fff;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 13px;
}

/* ==================== 前台 - 公告 ==================== */
.announcement-section { padding: 16px 0; }
.announcement-box {
    background: linear-gradient(135deg, #fff7e6 0%, #fffbe6 100%);
    border: 1px solid #ffe58f;
    border-radius: 8px;
    padding: 16px 20px;
}
.announcement-title {
    font-size: 15px;
    font-weight: 600;
    color: #d48806;
    margin-bottom: 10px;
}
.announcement-list { display: flex; flex-direction: column; gap: 8px; }
.announcement-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
}
.announcement-label {
    flex-shrink: 0;
    background: #faad14;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}
.announcement-content { color: #874d00; line-height: 1.6; }
.announcement-content a { color: #d46b08; text-decoration: underline; }

/* ==================== 前台 - 主内容 ==================== */
.front-main { padding: 20px 0 40px; }
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.tab {
    padding: 6px 16px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 20px;
    color: #595959;
    font-size: 13px;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab:hover { border-color: #1890ff; color: #1890ff; }
.tab.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.tab-count {
    background: rgba(0,0,0,.1);
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 11px;
}
.tab.active .tab-count { background: rgba(255,255,255,.25); }

/* ==================== 前台 - 文件卡片 ==================== */
.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.file-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    transition: transform .2s, box-shadow .2s;
}
.file-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.file-card-icon { font-size: 40px; text-align: center; padding: 10px 0; }
.file-card-info { flex: 1; }
.file-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-card-desc {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
    line-height: 1.5;
    min-height: 18px;
}
.file-card-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #8c8c8c;
    align-items: center;
}
.meta-item { display: inline-flex; align-items: center; gap: 3px; }
.file-card-action { margin-top: auto; }
.file-card-action .btn { width: 100%; }

/* ==================== 前台 - 空状态 ==================== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
}
.empty-icon { font-size: 60px; margin-bottom: 16px; }
.empty-state p { color: #666; margin: 4px 0; }

/* ==================== 前台 - 下载提示页 ==================== */
.download-notice {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
}
.notice-icon { font-size: 56px; margin-bottom: 16px; }
.download-notice h2 { font-size: 22px; margin-bottom: 12px; color: #333; }
.download-notice p { margin: 8px 0; color: #666; }

/* ==================== 前台 - 页脚 ==================== */
.front-footer {
    background: #fff;
    border-top: 1px solid #f0f0f0;
    padding: 24px 0;
    text-align: center;
    color: #999;
    font-size: 13px;
}
.footer-desc { margin-top: 4px; font-size: 12px; }
.front-pagination { margin-top: 32px; }

/* ==================== 前台 - 简洁列表视图 ==================== */
.list-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 4px;
    font-size: 13px;
    color: #8c8c8c;
}
.list-count strong { color: #333; font-weight: 600; }

.file-list {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.file-list-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
    font-weight: 600;
    color: #8c8c8c;
}
.file-list-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    transition: background .15s;
}
.file-list-row:last-child { border-bottom: none; }
.file-list-row:hover { background: #fafbff; }

.col-name { flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.col-size { width: 100px; text-align: center; color: #595959; font-size: 13px; flex-shrink: 0; }
.col-downloads { width: 70px; text-align: center; color: #8c8c8c; font-size: 13px; flex-shrink: 0; }
.col-type { width: 80px; text-align: center; flex-shrink: 0; }
.col-action { width: 90px; text-align: right; flex-shrink: 0; }

.file-icon-sm { font-size: 22px; flex-shrink: 0; }
.file-name-wrap { min-width: 0; flex: 1; }
.file-name-text {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-desc-sm {
    font-size: 12px;
    color: #bfbfbf;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 列表视图空状态 */
.file-list .empty-state {
    padding: 60px 20px;
    background: #fff;
    border-radius: 0;
    box-shadow: none;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .admin-sidebar { width: 60px; }
    .admin-sidebar .logo-text, .admin-sidebar .nav-item span:not(.nav-icon) { display: none; }
    .admin-main { margin-left: 60px; }
    .admin-header { padding: 12px 16px; }
    .admin-content { padding: 16px; }
    .admin-header h1 { font-size: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .header-inner { flex-direction: column; align-items: flex-start; }
    .search-input { width: 140px; }
    .file-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-right { justify-content: flex-start; }
    /* 列表视图移动端 */
    .file-list-header { display: none; }
    .file-list-row {
        flex-wrap: wrap;
        gap: 8px;
        padding: 14px 12px;
    }
    .col-name { width: 100%; flex: none; }
    .col-size, .col-downloads, .col-type, .col-action {
        width: auto;
        text-align: left;
        font-size: 12px;
    }
    .col-action { margin-left: auto; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-box { padding: 24px 20px; }
}
