/* =====================================================================
   后台管理样式 admin.css
   表格布局清晰,分页,弹窗提示,缩略图预览
   ===================================================================== */

body { background: #f0f2f5; }

/* ---- 登录页 ---- */
.login-bg { min-height: 100vh; background: linear-gradient(135deg,#1a3a5f,#1a73e8); display: flex; align-items: center; justify-content: center; }
.login-box { background: #fff; border-radius: 12px; padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-box h1 { text-align: center; color: #2c3e50; font-size: 22px; margin-bottom: 6px; }
.login-box .sub { text-align: center; color: #8a94a6; font-size: 13px; margin-bottom: 28px; }
.login-box .form-row { margin-bottom: 18px; }
.login-box .form-row input { width: 100%; padding: 12px 14px; border: 1px solid #d8dee8; border-radius: 6px; font-size: 15px; }
.login-box .form-row input:focus { border-color: #1a73e8; outline: none; box-shadow: 0 0 0 3px rgba(26,115,232,.12); }
.login-box .btn { width: 100%; padding: 12px; font-size: 16px; }
.login-box .tip { text-align: center; color: #aab2c0; font-size: 12px; margin-top: 16px; }
.login-box .alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.login-box .alert.err { background: #f8d7da; color: #721c24; }

/* ---- 后台框架 ---- */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #2c3e50; color: #c2cad6; flex-shrink: 0; position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; }
.sidebar .side-header { padding: 20px; text-align: center; border-bottom: 1px solid #3a4254; }
.sidebar .side-header .badge { width: 50px; height: 50px; margin: 0 auto 10px; background: linear-gradient(135deg,#1a73e8,#4a90d9); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; }
.sidebar .side-header h3 { color: #fff; font-size: 16px; }
.sidebar .side-header p { font-size: 12px; color: #8a94a6; margin-top: 4px; }
.sidebar .menu { padding: 12px 0; }
.sidebar .menu .group-title { padding: 8px 20px; font-size: 12px; color: #5a6478; text-transform: uppercase; }
.sidebar .menu a { display: flex; align-items: center; gap: 10px; padding: 11px 20px; color: #c2cad6; font-size: 14px; border-left: 3px solid transparent; }
.sidebar .menu a:hover { background: #34495e; color: #fff; }
.sidebar .menu a.active { background: #34495e; color: #fff; border-left-color: #1a73e8; }
.sidebar .menu .ico { width: 18px; text-align: center; }

.main-area { flex: 1; margin-left: 220px; }
.topbar { height: 60px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar .crumb { color: #5a6478; font-size: 15px; }
.topbar .crumb b { color: #2c3e50; }
.topbar .user-area { display: flex; align-items: center; gap: 14px; }
.topbar .user-area .name { color: #2c3e50; font-weight: 600; font-size: 14px; }
.topbar .user-area .role { font-size: 12px; padding: 2px 8px; border-radius: 4px; background: #eef4ff; color: #1a73e8; }
.topbar .user-area a { color: #8a94a6; font-size: 13px; }
.content { padding: 24px; }

/* ---- 面板统计 ---- */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.stat-card .num { font-size: 28px; font-weight: 700; color: #2c3e50; }
.stat-card .label { color: #8a94a6; font-size: 14px; margin-top: 4px; }
.stat-card .ico { float: right; font-size: 32px; opacity: .2; }
.stat-card.blue { border-top: 3px solid #1a73e8; }
.stat-card.green { border-top: 3px solid #27ae60; }
.stat-card.orange { border-top: 3px solid #e67e22; }
.stat-card.red { border-top: 3px solid #e74c3c; }

/* ---- 工具栏 ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .filters select, .toolbar .filters input { padding: 8px 12px; border: 1px solid #d8dee8; border-radius: 6px; font-size: 14px; }
.toolbar .actions { display: flex; gap: 8px; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 5px; }

/* ---- 表格 ---- */
.data-table { width: 100%; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.data-table table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f7f9fc; color: #5a6478; font-size: 13px; font-weight: 600; padding: 12px 14px; text-align: left; border-bottom: 1px solid #e8edf3; white-space: nowrap; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid #f0f2f5; font-size: 14px; color: #4a5568; }
.data-table tr:hover td { background: #fafbfc; }
.data-table .center { text-align: center; }
.data-table .actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.data-table .actions-cell a { padding: 4px 10px; border-radius: 4px; font-size: 13px; }

/* 缩略图 */
.thumb-sm { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid #e8edf3; cursor: pointer; }
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(140px,1fr)); gap: 12px; }
.thumb-grid .item { position: relative; border-radius: 6px; overflow: hidden; border: 1px solid #e8edf3; aspect-ratio: 1; background: #f7f9fc; }
.thumb-grid .item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.thumb-grid .item .info { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; padding: 4px 6px; }
.thumb-grid .item .check { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; }

/* ---- 弹窗 ---- */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: none; align-items: center; justify-content: center; }
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 10px; padding: 24px; width: 90%; max-width: 560px; max-height: 88vh; overflow-y: auto; }
.modal .modal-title { font-size: 18px; color: #2c3e50; margin-bottom: 16px; border-bottom: 1px solid #e8edf3; padding-bottom: 12px; }
.modal .modal-close { float: right; font-size: 22px; color: #aab2c0; cursor: pointer; line-height: 1; }
.modal .modal-actions { text-align: right; margin-top: 20px; border-top: 1px solid #e8edf3; padding-top: 16px; }

/* 图片大图预览 */
.img-viewer { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 300; display: none; align-items: center; justify-content: center; }
.img-viewer.show { display: flex; }
.img-viewer img { max-width: 92%; max-height: 92%; border-radius: 6px; }
.img-viewer .close { position: absolute; top: 20px; right: 24px; color: #fff; font-size: 30px; cursor: pointer; }

/* ---- 详情卡片 ---- */
.detail-grid { display: grid; grid-template-columns: 120px 1fr; gap: 12px 18px; padding: 12px 0; border-bottom: 1px dashed #e8edf3; }
.detail-grid .k { color: #8a94a6; font-size: 14px; }
.detail-grid .v { color: #2c3e50; font-size: 14px; word-break: break-all; }
.detail-block { background: #f7f9fc; border-radius: 6px; padding: 16px; margin: 12px 0; }
.detail-block .bt { font-weight: 600; color: #2c3e50; margin-bottom: 8px; }

/* ---- 空状态 ---- */
.empty { text-align: center; padding: 50px 20px; color: #aab2c0; }
.empty .ico { font-size: 48px; margin-bottom: 12px; }

/* ---- 打印样式(档案台账) ---- */
@media print {
    .sidebar, .topbar, .toolbar, .form-actions, .no-print { display: none !important; }
    .main-area { margin: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff; }
    .data-table { box-shadow: none; }
    .print-only { display: block !important; }
    .data-table th, .data-table td { font-size: 12px; padding: 6px 8px; }
}
.print-only { display: none; }

/* ---- 移动端菜单按钮 ---- */
.menu-toggle { display: none; background: none; border: none; font-size: 22px; color: #2c3e50; cursor: pointer; padding: 4px 8px; line-height: 1; margin-right: 8px; }

/* 遮罩层默认隐藏,移动端通过 .show 显示 */
.sidebar-mask { display: none; }

/* ---- 响应式 ---- */
@media (max-width: 1000px) {
    .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .sidebar {
        position: fixed; top: 0; left: 0; width: 240px; height: 100vh;
        transform: translateX(-100%); transition: transform .3s ease;
        z-index: 150; box-shadow: 4px 0 16px rgba(0,0,0,.15);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar .menu { display: block; padding: 12px 0; }
    .sidebar .menu a { display: flex; padding: 10px 20px; }
    .sidebar .menu .group-title { display: block; }

    /* 遮罩层(真实DOM元素,兼容所有移动浏览器) */
    .sidebar-mask {
        position: fixed; inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 140;
        display: none;
        opacity: 0;
        transition: opacity .25s ease;
    }
    .sidebar-mask.show { display: block; opacity: 1; }
    body.sidebar-open { overflow: hidden; }

    .main-area { margin-left: 0; width: 100%; }
    .admin-wrap { flex-direction: column; }

    .topbar { padding: 0 12px; height: 52px; gap: 8px; }
    .topbar .crumb { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
    .topbar .user-area { gap: 8px; }
    .topbar .user-area .name { display: none; }
    .topbar .user-area .role { font-size: 11px; padding: 1px 6px; }
    .topbar .user-area a { font-size: 12px; }

    .content { padding: 14px 12px; }
    .stats-grid { grid-template-columns: repeat(2,1fr); gap: 12px; }
    .stat-card { padding: 14px; }
    .stat-card .num { font-size: 22px; }
    .stat-card .label { font-size: 12px; }
    .stat-card .ico { font-size: 24px; }

    .toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .toolbar .filters { flex-wrap: wrap; }
    .toolbar .filters select, .toolbar .filters input { flex: 1; min-width: 120px; font-size: 13px; }
    .toolbar .actions { justify-content: flex-end; }

    .data-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table table { min-width: 600px; }
    .data-table th, .data-table td { padding: 10px 10px; font-size: 13px; }
    .data-table .actions-cell a { padding: 3px 8px; font-size: 12px; }

    .detail-grid { grid-template-columns: 1fr; gap: 6px; padding: 10px 0; }
    .detail-grid .k { font-weight: 600; }

    .thumb-grid { grid-template-columns: repeat(auto-fill,minmax(100px,1fr)); gap: 8px; }
    .thumb-sm { width: 48px; height: 48px; }

    .modal { padding: 16px; width: 94%; }
    .modal .modal-title { font-size: 16px; }

    .login-box { width: calc(100% - 40px); padding: 28px 22px; }
    .login-box h1 { font-size: 18px; }
    .login-box .form-row input { font-size: 16px; }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 12px; }
    .stat-card .num { font-size: 20px; }
    .content { padding: 12px 10px; }
    .data-table table { min-width: 540px; }
}
