/* ============================================================
   跑跑社区管理后台 — 样式表
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    font-size: 14px;
    color: #1a1a2e;
    background: #f0f2f5;
    line-height: 1.6;
}
a { text-decoration: none; color: inherit; }

/* --- Alert --- */
.alert {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #e6f7e6; color: #2d7d46; border: 1px solid #b7e4b7; }
.alert-error   { background: #fde8e8; color: #b91c1c; border: 1px solid #f5b5b5; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px;
    border: none; border-radius: 8px;
    font-size: 14px; cursor: pointer;
    transition: all 0.2s;
}
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a6fd6; }
.btn-ghost { background: #fff; color: #555; border: 1px solid #d0d5dd; }
.btn-ghost:hover { background: #f5f5f5; }
.btn-danger { background: #fff; color: #e53e3e; border: 1px solid #f5b5b5; }
.btn-danger:hover { background: #fef2f2; }
.btn-block { display: block; width: 100%; justify-content: center; }
.btn-sm { padding: 4px 12px; font-size: 13px; }
.btn-xs { padding: 2px 8px; font-size: 12px; }

/* --- Form --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; color: #444; }
.form-input {
    display: block; width: 100%;
    padding: 10px 14px;
    border: 1px solid #d0d5dd; border-radius: 8px;
    font-size: 14px; font-family: inherit;
    transition: border-color 0.2s;
    background: #fff;
    outline: none;
}
.form-input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.12); }
.form-textarea { resize: vertical; min-height: 200px; line-height: 1.7; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.required { color: #e53e3e; }

/* --- Form Panel --- */
.form-panel {
    background: #fff; border-radius: 12px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    max-width: 800px;
}
.form-panel h3 { margin-bottom: 20px; font-size: 18px; }

/* --- Table --- */
.table-panel {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow: hidden;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px;
    background: #fafbfc; font-size: 12px; font-weight: 600;
    color: #888; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid #e8eaed;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.action-cell { white-space: nowrap; display: flex; gap: 6px; }
.empty-cell { text-align: center; color: #999; padding: 40px 16px !important; }
.tag {
    display: inline-block; padding: 2px 10px;
    background: #eef0ff; color: #5a67d8;
    border-radius: 20px; font-size: 12px;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 16px;
    font-size: 13px; color: #666;
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-box {
    background: #fff; border-radius: 16px;
    padding: 40px 36px; width: 380px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.login-logo { margin-bottom: 12px; display: flex; justify-content: center; }
.login-box h1 { font-size: 22px; color: #1a1a2e; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: #999; margin-bottom: 24px; }
.login-form { text-align: left; }
.login-form .form-group label { color: #444; }
.login-form .btn { margin-top: 8px; padding: 12px; font-size: 15px; }

/* ============================================================
   后台布局
   ============================================================ */
.admin-page { background: #f0f2f5; }
.admin-layout { display: flex; min-height: 100vh; }

/* --- 侧边栏 --- */
.sidebar {
    width: 240px; min-width: 240px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #c9d1d9;
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 28px;
    font-size: 18px; font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-nav {
    flex: 1; padding: 12px 12px;
    display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px; color: #8b949e;
    transition: all 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #c9d1d9; }
.nav-item.active { background: rgba(102,126,234,0.25); color: #fff; }
.nav-group-label { display:flex; align-items:center; gap:10px; padding:10px 14px; border-radius:8px; font-size:14px; color:#8b949e; cursor:pointer; user-select:none; transition:all .15s; }
.nav-group-label:hover { background:rgba(255,255,255,.06); color:#c9d1d9; }
.nav-group-items { overflow:hidden; max-height:200px; transition:max-height .25s ease; }
.nav-group-items.collapsed { max-height:0 !important; }
.nav-group-items .nav-item { padding-left:40px; }
.sidebar-footer {
    padding: 12px; border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
    display: block; padding: 8px 14px;
    font-size: 13px; color: #8b949e;
    margin-bottom: 2px;
}

/* --- 主内容 --- */
.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 0;
}
.topbar {
    background: #fff;
    padding: 16px 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #e8eaed;
    position: sticky; top: 0; z-index: 50;
}
.topbar h2 { font-size: 18px; font-weight: 600; }
.content-body { padding: 24px 28px; }

/* --- 统计卡片 --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: #fff; border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex; align-items: center; gap: 16px;
}
.stat-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-num { font-size: 28px; font-weight: 700; color: #1a1a2e; }
.stat-label { font-size: 13px; color: #888; margin-top: 2px; }

/* --- 快捷操作 --- */
.quick-actions { margin-bottom: 20px; }
.quick-actions h3 { font-size: 16px; margin-bottom: 12px; color: #444; }
.actions-row { display: flex; gap: 12px; flex-wrap: wrap; }
.action-card {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border-radius: 10px;
    padding: 16px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    font-size: 14px; font-weight: 500;
    transition: all 0.2s;
}
.action-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.action-icon { font-size: 22px; }

/* --- 安装页 --- */
.install-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.install-box {
    background: #fff; border-radius: 16px;
    padding: 40px; width: 500px; max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.install-box h1 { font-size: 22px; margin-bottom: 20px; color: #1a1a2e; }
.install-box p { margin-bottom: 12px; color: #555; }
.install-box .btn { margin-top: 12px; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar { width: 200px; min-width: 200px; }
    .main-content { margin-left: 200px; }
    .content-body { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}
@media (max-width: 640px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
}
