/* ============================================================
   管理后台样式（商务深蓝主题）
   ============================================================ */
:root {
    --c-primary: #0a3d62;
    --c-primary-light: #1b6ca8;
    --c-accent: #2196f3;
    --c-gold: #c9a24b;
    --c-text: #2c3e50;
    --c-text-light: #5c6b7a;
    --c-bg: #f0f3f7;
    --c-border: #e4e9f0;
    --shadow: 0 4px 16px rgba(10, 61, 98, 0.08);
    --font: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font); background: var(--c-bg); color: var(--c-text); font-size: 14px; line-height: 1.7; }
a { text-decoration: none; color: var(--c-primary-light); }
img { max-width: 100%; }
ul { list-style: none; }

/* 布局 */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 230px; background: var(--c-primary); color: rgba(255,255,255,.85);
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100;
}
.admin-main { flex: 1; margin-left: 230px; display: flex; flex-direction: column; min-height: 100vh; }

/* 侧边栏 */
.sidebar-brand {
    display: flex; align-items: center; gap: 12px; padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand .brand-badge {
    width: 42px; height: 42px; border-radius: 10px; background: #fff;
    color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; padding: 4px;
}
.sidebar-brand .brand-badge img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand strong { display: block; color: #fff; font-size: 15px; line-height: 1.3; }
.sidebar-brand small { font-size: 12px; color: rgba(255,255,255,.6); }
.sidebar-nav { flex: 1; padding: 14px 0; overflow-y: auto; }
.sidebar-link {
    display: flex; align-items: center; gap: 12px; padding: 12px 22px;
    color: rgba(255,255,255,.78); font-size: 14px; transition: all .2s;
}
.sidebar-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,.14); color: #fff; border-left: 3px solid var(--c-gold); }
.sl-icon {
    width: 28px; height: 28px; border-radius: 7px; background: rgba(255,255,255,.12);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0;
}
.sidebar-footer { border-top: 1px solid rgba(255,255,255,.1); padding: 10px 0; }

/* 顶栏 */
.admin-topbar {
    background: #fff; padding: 0 28px; height: 64px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid var(--c-border); position: sticky; top: 0; z-index: 50;
}
.admin-topbar h1 { font-size: 19px; color: var(--c-primary); }
.topbar-user { display: flex; align-items: center; gap: 16px; color: var(--c-text-light); }
.topbar-user a { color: var(--c-primary-light); font-weight: 600; }

/* 内容区 */
.admin-content { padding: 28px; flex: 1; }
.card {
    background: #fff; border: 1px solid var(--c-border); border-radius: 10px;
    box-shadow: var(--shadow); margin-bottom: 24px;
}
.card-head { padding: 18px 24px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; color: var(--c-primary); }
.card-body { padding: 24px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--c-border); border-radius: 10px; padding: 24px; box-shadow: var(--shadow); }
.stat-card .num { font-size: 32px; font-weight: 700; color: var(--c-primary); }
.stat-card .label { color: var(--c-text-light); font-size: 13px; margin-top: 6px; }
.stat-card .sub { font-size: 12px; color: var(--c-muted, #8a97a5); margin-top: 4px; }

/* 按钮 */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 6px; font-size: 14px; font-weight: 600; border: none; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-light); }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219653; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline { background: #fff; color: var(--c-primary-light); border: 1px solid var(--c-border); }
.btn-outline:hover { border-color: var(--c-accent); }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-warn { background: var(--c-gold); color: #fff; }
.btn-warn:hover { background: #b58a3a; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--c-border); font-size: 14px; vertical-align: middle; }
th { background: #f8fafc; color: var(--c-text-light); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafcfe; }
td .thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--c-bg); }
.badge { display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 12px; }
.badge-success { background: #e8f5e9; color: #27ae60; }
.badge-muted { background: #eceff1; color: #90a4ae; }
.badge-warn { background: rgba(201,162,75,.15); color: #b58a3a; }
.badge-danger { background: #fdecea; color: #c0392b; }
.actions a { margin-right: 8px; font-size: 13px; }
.actions a.del { color: #e74c3c; }

/* 表单 */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.form-group .help { font-size: 12px; color: #8a97a5; margin-top: 6px; }
.form-control {
    width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 6px;
    font-size: 14px; font-family: var(--font); color: var(--c-text); background: #fff; transition: border-color .2s;
}
.form-control:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(33,150,243,.12); }
textarea.form-control { resize: vertical; min-height: 120px; }
textarea.form-control.code { font-family: Consolas, monospace; min-height: 260px; }
.form-check { display: inline-flex; align-items: center; gap: 8px; }
.form-check input { width: 16px; height: 16px; }

/* 提示 */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 18px; font-size: 14px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-danger { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* 分页 */
.pagination { display: flex; justify-content: flex-end; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.page-link {
    min-width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    padding: 0 10px; background: #fff; border: 1px solid var(--c-border); border-radius: 6px; color: var(--c-text); font-size: 13px;
}
.page-link.active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

/* 搜索栏 */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-bar .form-control { width: auto; min-width: 180px; }

/* 空状态 */
.empty { text-align: center; color: #8a97a5; padding: 48px 0; }

/* 消息列表 */
.message-item { padding: 18px 0; border-bottom: 1px solid var(--c-border); }
.message-item:last-child { border-bottom: none; }
.message-item.unread { background: #f6f9ff; }
.message-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.message-head b { color: var(--c-primary); }
.message-head .msg-time { color: #8a97a5; font-size: 12px; }
.message-content { margin-top: 10px; color: var(--c-text); font-size: 14px; white-space: pre-wrap; }
.message-contact { margin-top: 8px; font-size: 13px; color: var(--c-text-light); }
.message-contact span { margin-right: 16px; }

/* 登录页 */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #072f4c, #0a3d62 55%, #1b6ca8); }
.login-box { background: #fff; border-radius: 12px; padding: 44px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-box h1 { text-align: center; font-size: 22px; color: var(--c-primary); margin-bottom: 6px; }
.login-box .sub { text-align: center; color: #8a97a5; margin-bottom: 26px; font-size: 13px; }

/* 图片上传 */
.upload-preview { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.upload-preview img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-border); }
.upload-field input[type="file"] { padding: 8px; }

/* 响应式 */
@media (max-width: 992px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .admin-sidebar { width: 72px; }
    .admin-main { margin-left: 72px; }
    .sidebar-brand div, .sidebar-link { font-size: 0; }
    .sidebar-link .sl-icon { font-size: 14px; }
    .sidebar-brand { justify-content: center; padding: 18px 8px; }
    .sidebar-link { justify-content: center; padding: 14px 8px; }
    .sidebar-footer .sidebar-link { font-size: 0; }
}
