/* =====================================================
   MetaLab 管理面板 - 通用样式
   单一职责：布局、导航、通用组件（按钮/表格/卡片/弹窗等）
   不包含任何页面特有样式
   ===================================================== */

/* --- 变量 --- */
:root {
    --bg: #f5f6fa;
    --bg-card: #ffffff;
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #e0e0e0;
    --primary: #0984e3;
    --primary-hover: #0773c5;
    --danger: #d63031;
    --danger-hover: #c0392b;
    --success: #00b894;
    --warning: #e17055;
    --sidebar-bg: #1e272e;
    --sidebar-text: #b2bec3;
    --sidebar-active: #0984e3;
    --header-bg: #2d3436;
    --radius: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- 重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* --- 顶部导航 --- */
.admin-header {
    background: var(--header-bg);
    color: #fff;
    height: 52px;
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.admin-header-inner {
    max-width: 100%;
    height: 100%;
    padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between;
}
.admin-logo {
    font-size: 18px; font-weight: 700;
    color: #fff; letter-spacing: 0.5px;
    display: flex; align-items: center; gap: 6px;
}
.admin-logo span {
    font-weight: 400; font-size: 14px;
    color: var(--sidebar-text);
}
.admin-logo:hover { color: #fff; }
.admin-header-right {
    display: flex; align-items: center; gap: 16px;
}
.admin-user { color: #dfe6e9; font-size: 13px; }
.admin-back-btn {
    font-size: 12px; color: #b2bec3;
    padding: 4px 10px; border: 1px solid #636e72;
    border-radius: 4px; transition: all 0.2s;
}
.admin-back-btn:hover { color: #fff; border-color: #fff; }

/* --- 整体布局 --- */
.admin-container {
    display: flex;
    margin-top: 52px;
    min-height: calc(100vh - 52px);
}

/* --- 侧边栏 --- */
.admin-sidebar {
    width: 200px; min-width: 200px;
    background: var(--sidebar-bg);
    padding: 16px 0;
    position: sticky; top: 52px;
    height: calc(100vh - 52px);
    overflow-y: auto;
}
.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.sidebar-item:hover { color: #fff; background: rgba(255,255,255,0.05); }
.sidebar-item.active {
    color: #fff; background: rgba(9,132,227,0.2);
    border-left-color: var(--sidebar-active);
}
.sidebar-icon { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-icon svg { width: 100%; height: 100%; }

/* --- 主内容区 --- */
.admin-main {
    flex: 1; padding: 28px 32px;
    max-width: 1200px; min-width: 0;
}

/* --- 页面标题 --- */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 22px; font-weight: 600; color: var(--text); }
.page-desc { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* --- 统计卡片 --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 24px; height: 24px; }
.stat-blue { background: #e3f2fd; color: var(--primary); }
.stat-green { background: #e8f5e9; color: var(--success); }
.stat-orange { background: #fff3e0; color: var(--warning); }
.stat-red { background: #ffebee; color: var(--danger, #e53935); }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-value { font-size: 22px; font-weight: 600; color: var(--text); }
.stat-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-badge { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 10px; margin-left: 8px; vertical-align: middle; }
.badge-warn { background: #fff3e0; color: var(--warning); }

/* --- 信息卡片 --- */
.info-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.info-card h3 { font-size: 16px; margin-bottom: 12px; }
.info-card ul { padding-left: 20px; color: var(--text-muted); font-size: 13px; line-height: 2; }

/* --- 筛选栏 --- */
.filter-bar {
    display: flex; gap: 10px; margin-bottom: 16px;
    flex-wrap: wrap;
}
.filter-input {
    flex: 1; min-width: 180px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}
.filter-input:focus { border-color: var(--primary); }
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    outline: none;
    background: #fff;
    cursor: pointer;
}
.filter-select:focus { border-color: var(--primary); }

/* --- 按钮 --- */
.btn {
    padding: 8px 18px; border: none; border-radius: var(--radius);
    font-size: 13px; cursor: pointer; transition: all 0.2s;
    font-weight: 500;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-outline {
    background: transparent; border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- 表格容器 --- */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

/* --- 数据表格 --- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; padding: 12px 16px;
    background: #fafafa; color: var(--text-muted);
    font-weight: 600; font-size: 12px; text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8f9ff; }
.table-loading td { text-align: center; padding: 40px; color: var(--text-muted); }

/* --- 状态标签 --- */
.badge {
    display: inline-block; padding: 2px 8px;
    border-radius: 12px; font-size: 11px; font-weight: 600;
}
.badge-active { background: #e8f5e9; color: var(--success); }
.badge-banned { background: #ffebee; color: var(--danger); }
.badge-deleted { background: #fff3e0; color: var(--warning); }
.badge-locked { background: #eceff1; color: #546e7a; }

/* --- 角色标签 --- */
.role-tag {
    display: inline-block; padding: 2px 8px;
    border-radius: 4px; font-size: 11px; font-weight: 600;
}
.role-user { background: #e3f2fd; color: #1976d2; }
.role-moderator { background: #e8f5e9; color: #2e7d32; }
.role-admin { background: #fce4ec; color: #c62828; }
.role-owner { background: #fff3e0; color: #e65100; }

/* --- 操作按钮组 --- */
.action-group { display: flex; gap: 6px; }

/* --- 分页 --- */
.pagination-bar {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 20px;
}
.pagination-bar button {
    padding: 6px 14px; border: 1px solid var(--border);
    background: #fff; border-radius: 4px; font-size: 13px;
    cursor: pointer; transition: all 0.15s;
}
.pagination-bar button:hover:not(:disabled) {
    border-color: var(--primary); color: var(--primary);
}
.pagination-bar button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination-bar .page-current {
    padding: 6px 14px; font-size: 13px; color: var(--text-muted);
}

/* --- 确认弹窗 --- */
.modal-overlay {
    display: none; position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 200;
    align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff; border-radius: 8px;
    padding: 28px 32px; min-width: 340px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal-box h3 { margin-bottom: 12px; font-size: 17px; }
.modal-box p { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* --- Toast 通知 --- */
.toast-container {
    position: fixed; top: 64px; right: 20px;
    z-index: 300; display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 20px; border-radius: 6px;
    font-size: 13px; color: #fff; font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
