/* ===== 基础样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 14px; color: #333; background: #f5f6fa; line-height: 1.6; }
a { color: #4a6cf7; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin-bottom: 10px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
h3 { font-size: 16px; margin-bottom: 10px; }
h4 { font-size: 14px; margin-bottom: 5px; color: #666; }
code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; font-size: 13px; color: #e74c3c; }
pre { background: #2d3436; color: #dfe6e9; padding: 15px; border-radius: 6px; overflow-x: auto; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-all; }
small { color: #999; font-size: 12px; display: block; margin-top: 5px; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ===== 按钮 ===== */
.btn { display: inline-block; padding: 8px 20px; border: 1px solid #ddd; border-radius: 4px; background: #fff; cursor: pointer; font-size: 14px; color: #333; text-decoration: none; transition: all 0.2s; }
.btn:hover { background: #f5f5f5; text-decoration: none; }
.btn-primary { background: #4a6cf7; color: #fff; border-color: #4a6cf7; }
.btn-primary:hover { background: #3b5de7; }
.btn-default { background: #fff; color: #333; }
.btn-warning { background: #f39c12; color: #fff; border-color: #f39c12; }
.btn-warning:hover { background: #e67e22; }
.btn-error { background: #e74c3c; color: #fff; border-color: #e74c3c; }
.btn-error:hover { background: #c0392b; }
.btn-success { background: #27ae60; color: #fff; border-color: #27ae60; }
.btn-success:hover { background: #219a52; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: #555; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: #4a6cf7; box-shadow: 0 0 0 2px rgba(74,108,247,0.1); }
select.form-control { background: #fff; }

/* ===== 表格 ===== */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 6px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.table th { background: #fafbfc; font-weight: 600; color: #555; font-size: 13px; white-space: nowrap; }
.table tr:hover td { background: #fafbfc; }
.table-info td { border: none; padding: 8px 14px; }
.table-info td:first-child { color: #999; font-weight: 500; width: 120px; }

/* ===== 卡片 ===== */
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* ===== 徽章 ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; background: #eee; color: #666; }
.badge-success { background: #d4edda; color: #155724; }
.badge-error { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }

/* ===== 提示 ===== */
.alert { padding: 12px 16px; border-radius: 4px; margin-bottom: 15px; font-size: 14px; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }

/* ===== 登录页 ===== */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 10px; width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,0.15); }
.login-box h2 { text-align: center; margin-bottom: 25px; color: #333; }

/* ===== 后台布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #2c3e50; color: #fff; flex-shrink: 0; }
.sidebar-brand { padding: 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-nav a { display: block; padding: 12px 20px; color: rgba(255,255,255,0.7); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; transition: all 0.2s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.08); color: #fff; border-left-color: #4a6cf7; text-decoration: none; }
.main-content { flex: 1; padding: 25px 30px; overflow-x: auto; }

/* ===== 用户中心布局 ===== */
.user-layout { min-height: 100vh; }
.user-header { background: #fff; border-bottom: 1px solid #eee; padding: 0 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.user-header .container { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.user-header .brand { font-size: 18px; font-weight: bold; color: #333; }
.user-header nav { display: flex; gap: 20px; }
.user-header nav a { color: #666; text-decoration: none; font-size: 14px; padding: 5px 0; border-bottom: 2px solid transparent; }
.user-header nav a:hover { color: #4a6cf7; text-decoration: none; }

/* ===== 余额卡片 ===== */
.balance-card { text-align: center; }
.balance-label { font-size: 14px; color: #999; margin-bottom: 5px; }
.balance-value { font-size: 42px; font-weight: bold; color: #4CAF50; }

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; margin-top: 15px; }
.stat-card { background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.stat-label { font-size: 13px; color: #999; margin-bottom: 5px; }
.stat-value { font-size: 24px; font-weight: bold; color: #333; }

/* ===== 工具栏 ===== */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.search-form { display: flex; gap: 8px; align-items: center; }

/* ===== 分页 ===== */
.pagination { margin-top: 15px; display: flex; gap: 5px; }
.pagination a { padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; color: #666; text-decoration: none; font-size: 13px; }
.pagination a:hover, .pagination a.active { background: #4a6cf7; color: #fff; border-color: #4a6cf7; text-decoration: none; }
.stats-bar { margin-top: 15px; color: #999; font-size: 13px; }
.stats-bar a { padding: 4px 10px; border: 1px solid #ddd; border-radius: 3px; color: #666; margin: 0 2px; font-size: 13px; }
.stats-bar a:hover, .stats-bar a.active { background: #4a6cf7; color: #fff; border-color: #4a6cf7; text-decoration: none; }

/* ===== 弹窗 ===== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; z-index: 1000; }
.modal-content { background: #fff; padding: 30px; border-radius: 8px; width: 420px; max-width: 90%; position: relative; }
.modal-close { position: absolute; top: 10px; right: 15px; font-size: 24px; cursor: pointer; color: #999; }

/* ===== 代码块 ===== */
.code-block { background: #f8f9fa; border: 1px solid #e9ecef; border-radius: 6px; padding: 12px; }
.code-block h4 { color: #4a6cf7; margin-bottom: 8px; }
.code-block pre { background: #2d3436; color: #dfe6e9; padding: 10px 15px; border-radius: 4px; font-size: 12px; margin: 0; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar-nav { display: flex; flex-wrap: wrap; }
    .sidebar-nav a { flex: 1; min-width: 80px; text-align: center; border-left: none; border-bottom: 2px solid transparent; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .main-content { padding: 15px; }
}