/* ========================================
   卫生管理系统 v2 - 管理后台样式
   侧边栏 · 移动端自适应 · 弹窗 · 仪表盘
   ======================================== */

/* ---- 登录页 ---- */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: #f5f6fa; padding: 20px;
}
.login-card {
    background: #fff; border-radius: 16px; padding: 40px 32px;
    width: 100%; max-width: 380px; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    text-align: center;
}
.login-input {
    width: 100%; padding: 12px; font-size: 16px; border: 1px solid #ddd;
    border-radius: 8px; margin-bottom: 16px; text-align: center;
}

/* ---- 管理布局 ---- */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar-toggle { display: none; }

/* ---- 侧边栏 ---- */
.sidebar {
    width: 220px; min-width: 220px; background: #1a1a2e; color: #ccc;
    display: flex; flex-direction: column; position: sticky; top: 0;
    height: 100vh; overflow-y: auto; z-index: 100;
}
.sidebar-brand {
    padding: 20px 16px; font-size: 16px; font-weight: 700; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex; justify-content: space-between; align-items: center;
}
.sidebar-close { display: none; cursor: pointer; font-size: 18px; color: #999; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px;
    font-size: 14px; color: #aaa; text-decoration: none; transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background: rgba(52,152,219,0.2); color: #fff; border-right: 3px solid #3498db; }
.nav-icon { font-size: 16px; width: 24px; text-align: center; }
.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; flex-direction: column; gap: 4px;
}
.sidebar-footer a { font-size: 12px; color: #888; text-decoration: none; }
.sidebar-footer a:hover { color: #ccc; }

/* ---- 主内容区 ---- */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: #fff; padding: 12px 20px; border-bottom: 1px solid #eee;
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 50;
}
.hamburger { display: none; font-size: 22px; cursor: pointer; color: #666; }
.topbar-title { font-size: 16px; font-weight: 600; }
.content-area { padding: 16px 20px 40px; flex: 1; }

/* ---- 统计卡片 ---- */
.stats-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 100px; background: #fff; border-radius: 10px; padding: 16px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-num { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: #999; margin-top: 4px; }

/* ---- 区域网格（仪表盘） ---- */
.area-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.area-card { padding: 12px; border-radius: 8px; border: 1px solid #eee; }
.area-done { background: #f8fdf8; border-color: #d5f5e3; }
.area-miss { background: #fef9f9; border-color: #fadbd8; }
.area-name { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.area-status { margin-bottom: 4px; }
.area-meta { font-size: 12px; color: #999; }
.badge-miss { background: #fdecea; color: #c0392b; }

/* ---- 对比区域 ---- */
.compare-section { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.compare-side { flex: 1; min-width: 200px; }
.compare-side h4 { font-size: 14px; margin-bottom: 8px; color: #666; }
.compare-empty {
    width: 100%; aspect-ratio: 4/3; background: #f8f9fa; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #ccc; font-size: 14px; border: 1px dashed #ddd;
}
.photo-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.photo-thumb {
    width: calc(33.33% - 4px); aspect-ratio: 1; object-fit: cover;
    border-radius: 6px; border: 1px solid #eee; cursor: pointer;
}

/* ---- 表格 ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-weight: 600; border-bottom: 2px solid #e9ecef; white-space: nowrap; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; }
.data-table tr:hover td { background: #f8f9fa; }

/* ---- 筛选栏 ---- */
.filter-bar { padding: 12px 16px !important; }

/* ---- 弹窗 ---- */
.modal { display: flex; position: fixed; inset: 0; z-index: 200; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); }
.modal-content { position: relative; background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-content h3 { margin: 0 0 16px; font-size: 18px; }

/* ---- 移动端 ---- */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -240px; transition: left 0.25s; }
    .sidebar-toggle:checked ~ .sidebar { left: 0; }
    .sidebar-close { display: inline; }
    .hamburger { display: inline; }
    .content-area { padding: 12px; }
    .topbar { padding: 10px 12px; }
    .area-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .compare-section { flex-direction: column; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 6px; }
    .stats-row { gap: 6px; }
    .stat-card { padding: 10px 6px; }
    .stat-num { font-size: 22px; }
    .modal-content { padding: 16px; margin: 8px; }
}

@media (max-width: 480px) {
    .photo-thumb { width: calc(50% - 3px); }
    .area-grid { grid-template-columns: 1fr 1fr; }
}

/* 仪表盘区域分组 */
.area-problem { background: #fef2f2 !important; border-color: #fecaca !important; }
.area-problem .area-name { color: #991b1b; }
td .badge { font-size: 11px; margin: 1px; white-space: nowrap; }

/* 人员头像 */
.person-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.person-avatar-empty { width: 32px; height: 32px; border-radius: 50%; background: #e0e0e0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #999; }

/* 审核证据预览 */
#evidencePreview img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }

/* 权限设置区块 */
.perm-section { background: #fef9e7; padding: 10px; border-radius: 8px; }

/* 移动端审核快捷 */
@media (max-width: 768px) {
    .review-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; padding: 10px; box-shadow: 0 -2px 8px rgba(0,0,0,0.1); z-index: 50; display: flex; gap: 8px; }
    .review-nav .btn { flex: 1; }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .sidebar { width: 200px; min-width: 200px; }
    .main-content { padding: 8px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 6px 4px; }
    .card { padding: 10px; }
    .stats-row { flex-wrap: wrap; }
    .stat-card { min-width: calc(50% - 4px); }
    .btn { padding: 8px 12px; font-size: 13px; }
    .btn-sm { padding: 4px 8px; font-size: 11px; }
    .content-area { overflow-x: hidden; }
}

@media (max-width: 480px) {
    .sidebar { width: 180px; min-width: 180px; }
    .data-table { font-size: 11px; }
    .photo-thumb { width: calc(50% - 3px); }
    .area-grid { grid-template-columns: 1fr 1fr; }
}