/* ================================================
   TP-Nav 后台管理样式
   ================================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #6366f1;
    --bg: #f0f2f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.08);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-w: 220px;
    --header-h: 56px;
    --transition: all .2s ease;
}

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Noto Sans SC',sans-serif; background:var(--bg); color:var(--text); font-size:14px; line-height:1.5; }
a { text-decoration:none; color:inherit; }
ul { list-style:none; }
button { cursor:pointer; border:none; font-family:inherit; }
input,select,textarea { font-family:inherit; font-size:14px; }

/* 布局 */
.admin-layout { display:flex; min-height:100vh; }

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-w); background:var(--bg-sidebar); color:var(--text-light);
    position:fixed; top:0; bottom:0; left:0; z-index:100;
    display:flex; flex-direction:column; transition:var(--transition);
}
.sidebar-header { height:var(--header-h); display:flex; align-items:center; padding:0 20px; border-bottom:1px solid rgba(255,255,255,.1); }
.sidebar-header .logo { font-size:18px; font-weight:700; color:#fff; white-space:nowrap; overflow:hidden; }
.sidebar-nav { flex:1; overflow-y:auto; padding:8px 0; }
.sidebar-nav .nav-group-title { padding:12px 20px 4px; font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }
.sidebar-nav a {
    display:flex; align-items:center; gap:10px; padding:10px 20px;
    color:var(--text-light); font-size:14px; transition:var(--transition); white-space:nowrap;
}
.sidebar-nav a:hover { background:var(--bg-sidebar-hover); color:#fff; }
.sidebar-nav a.active { background:var(--primary); color:#fff; border-radius:0; }
.sidebar-nav a i { width:16px; text-align:center; }
.sidebar-nav a .badge-count { margin-left:auto; background:var(--danger); color:#fff; font-size:10px; padding:1px 6px; border-radius:8px; }

/* 主内容区 */
.main { flex:1; margin-left:var(--sidebar-w); display:flex; flex-direction:column; min-height:100vh; }
.header {
    height:var(--header-h); background:var(--bg-card); border-bottom:1px solid var(--border);
    display:flex; align-items:center; justify-content:space-between; padding:0 24px;
    position:sticky; top:0; z-index:99;
}
.header-left { display:flex; align-items:center; gap:16px; }
.header-left .menu-toggle { font-size:20px; color:var(--text-secondary); display:none; }
.breadcrumb { font-size:14px; color:var(--text-secondary); }
.header-right { display:flex; align-items:center; gap:12px; }
.header-right .avatar { width:32px; height:32px; border-radius:50%; background:var(--primary); color:#fff; display:flex; align-items:center; justify-content:center; }
.header-right .user-info { font-size:13px; }
.header-right .user-info .name { font-weight:600; }
.header-right .user-info .role { font-size:11px; color:var(--text-muted); }

.content { flex:1; padding:24px; }

/* 统计卡片 */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--bg-card); border-radius:var(--radius-lg); padding:20px; box-shadow:var(--shadow); display:flex; align-items:center; gap:16px; }
.stat-card .icon { width:48px; height:48px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:22px; color:#fff; }
.stat-card .info .value { font-size:24px; font-weight:700; }
.stat-card .info .label { font-size:13px; color:var(--text-muted); }
.stat-card .icon.blue { background:linear-gradient(135deg,#3b82f6,#2563eb); }
.stat-card .icon.green { background:linear-gradient(135deg,#34d399,#10b981); }
.stat-card .icon.orange { background:linear-gradient(135deg,#fbbf24,#f59e0b); }
.stat-card .icon.purple { background:linear-gradient(135deg,#a78bfa,#7c3aed); }
.stat-card .icon.red { background:linear-gradient(135deg,#f87171,#ef4444); }

/* 卡片 */
.card { background:var(--bg-card); border-radius:var(--radius-lg); box-shadow:var(--shadow); margin-bottom:24px; }
.card-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.card-header .title { font-size:16px; font-weight:600; }
.card-body { padding:20px; }
.card-body.no-padding { padding:0; }

/* 按钮 */
.btn { display:inline-flex; align-items:center; gap:4px; padding:7px 16px; border-radius:var(--radius); font-size:13px; font-weight:500; transition:var(--transition); border:1px solid transparent; white-space:nowrap; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover { background:var(--primary-dark); }
.btn-success { background:var(--success); color:#fff; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover { background:#dc2626; }
.btn-outline { background:transparent; border-color:var(--border); color:var(--text-secondary); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-sm { padding:4px 10px; font-size:12px; }
.btn-lg { padding:10px 24px; font-size:15px; }
.btn-block { width:100%; justify-content:center; }
.btn:disabled { opacity:.5; }

/* 表单 */
.form-row { margin-bottom:16px; }
.form-label { display:block; margin-bottom:6px; font-size:13px; font-weight:500; color:var(--text); }
.form-label .req { color:var(--danger); }
.form-input,.form-select,.form-textarea {
    width:100%; padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius);
    background:var(--bg-card); color:var(--text); outline:none; transition:var(--transition);
}
.form-input:focus,.form-select:focus,.form-textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.1); }
.form-textarea { resize:vertical; min-height:80px; }
.form-row.row-2 { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-hint { font-size:12px; color:var(--text-muted); margin-top:4px; }

/* 表格 */
.table { width:100%; border-collapse:collapse; }
.table th { text-align:left; padding:12px 16px; font-size:12px; color:var(--text-muted); font-weight:500; border-bottom:1px solid var(--border); white-space:nowrap; }
.table td { padding:12px 16px; font-size:13px; border-bottom:1px solid var(--border); }
.table tr:last-child td { border-bottom:none; }
.table tr:hover td { background:#f8fafc; }
.table .site-icon-sm { width:20px; height:20px; border-radius:4px; vertical-align:middle; margin-right:8px; }

/* 标签 */
.tag { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:500; }
.tag-success { background:#d1fae5; color:#059669; }
.tag-warning { background:#fef3c7; color:#d97706; }
.tag-danger { background:#fee2e2; color:#dc2626; }
.tag-info { background:#dbeafe; color:#2563eb; }
.tag-gray { background:#f1f5f9; color:#64748b; }

/* 搜索栏 */
.toolbar { display:flex; align-items:center; gap:12px; margin-bottom:16px; flex-wrap:wrap; }
.toolbar .search-input { max-width:240px; }
.toolbar .spacer { flex:1; }

/* 分页 */
.pagination { display:flex; justify-content:center; gap:4px; padding:16px; }
.pagination a,.pagination span { min-width:32px; height:32px; display:flex; align-items:center; justify-content:center; border:1px solid var(--border); border-radius:6px; font-size:13px; color:var(--text-secondary); padding:0 8px; }
.pagination a:hover { border-color:var(--primary); color:var(--primary); }
.pagination .current { background:var(--primary); color:#fff; border-color:var(--primary); }

/* 模态框 */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:1000; display:none; align-items:center; justify-content:center; }
.modal-overlay.show { display:flex; }
.modal { background:var(--bg-card); border-radius:var(--radius-lg); width:90%; max-width:520px; max-height:90vh; overflow:hidden; display:flex; flex-direction:column; }
.modal-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; }
.modal-header .title { font-size:16px; font-weight:600; }
.modal-close { font-size:20px; color:var(--text-muted); width:28px; height:28px; display:flex; align-items:center; justify-content:center; border-radius:50%; }
.modal-close:hover { background:var(--bg); }
.modal-body { padding:20px; overflow-y:auto; }
.modal-footer { padding:12px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; gap:8px; }

/* 登录页 */
.login-page { display:flex; align-items:center; justify-content:center; min-height:100vh; background:linear-gradient(135deg,#667eea 0%,#764ba2 100%); }
.login-card { background:#fff; border-radius:16px; box-shadow:0 20px 60px rgba(0,0,0,.3); width:380px; max-width:90vw; padding:40px; }
.login-card .logo { text-align:center; margin-bottom:24px; }
.login-card .logo .icon { width:56px; height:56px; border-radius:14px; background:linear-gradient(135deg,#2563eb,#7c3aed); display:flex; align-items:center; justify-content:center; margin:0 auto 12px; font-size:28px; color:#fff; }
.login-card h1 { text-align:center; font-size:22px; margin-bottom:4px; }
.login-card p { text-align:center; color:#64748b; font-size:14px; margin-bottom:28px; }

/* 空状态 */
.empty { text-align:center; padding:48px 20px; color:var(--text-muted); }
.empty .icon { font-size:48px; opacity:.3; margin-bottom:12px; }

/* 开关 */
.switch { position:relative; width:40px; height:22px; display:inline-block; }
.switch input { opacity:0; width:0; height:0; }
.switch .slider { position:absolute; inset:0; background:#cbd5e1; border-radius:22px; transition:var(--transition); }
.switch .slider::before { content:''; position:absolute; width:18px; height:18px; border-radius:50%; background:#fff; left:2px; top:2px; transition:var(--transition); }
.switch input:checked + .slider { background:var(--primary); }
.switch input:checked + .slider::before { transform:translateX(18px); }

/* 响应式 */
@media (max-width:768px) {
    .sidebar { transform:translateX(-100%); }
    .sidebar.show { transform:translateX(0); }
    .main { margin-left:0; }
    .header-left .menu-toggle { display:block; }
    .stats-grid { grid-template-columns:1fr 1fr; }
    .form-row.row-2 { grid-template-columns:1fr; }
    .table { font-size:12px; }
    .table th,.table td { padding:8px 10px; }
    .toolbar { flex-direction:column; align-items:stretch; }
    .toolbar .search-input { max-width:none; }
}
