* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: #f5f7fa; color: #333; }
a { text-decoration: none; color: inherit; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* 登录页面 */
.login-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); width: 400px; }
.login-box h2 { text-align: center; margin-bottom: 30px; color: #333; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; color: #555; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.3s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #667eea; }
.btn { display: inline-block; padding: 12px 24px; background: #667eea; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 14px; transition: background 0.3s; }
.btn:hover { background: #5a67d8; }
.btn-success { background: #48bb78; }
.btn-success:hover { background: #38a169; }
.btn-danger { background: #f56565; }
.btn-danger:hover { background: #e53e3e; }
.btn-warning { background: #ed8936; }
.btn-warning:hover { background: #dd6b20; }
.btn-block { display: block; width: 100%; }
.login-footer { text-align: center; margin-top: 20px; }
.login-footer a { color: #667eea; }

/* 后台布局 */
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: #2d3748; color: #fff; padding: 20px 0; }
.sidebar .logo { padding: 0 20px 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid #4a5568; margin-bottom: 20px; }
.sidebar nav a { display: flex; align-items: center; padding: 12px 20px; color: #cbd5e0; transition: all 0.3s; white-space: nowrap; text-align: left; }
.sidebar nav a:hover, .sidebar nav a.active { background: #4a5568; color: #fff; }
.sidebar nav a .nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 10px; flex-shrink: 0; font-size: 16px; line-height: 1; text-align: center; vertical-align: middle; }
.sidebar nav a span:last-child { display: inline-block; line-height: 22px; }

/* 折叠子菜单 */
.sidebar .nav-group { margin: 0; }
.sidebar .nav-group-toggle { display: flex; align-items: center; padding: 12px 20px; color: #cbd5e0; cursor: pointer; transition: all 0.3s; user-select: none; }
.sidebar .nav-group-toggle:hover { background: #4a5568; color: #fff; }
.sidebar .nav-group-toggle .nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-right: 10px; flex-shrink: 0; font-size: 16px; line-height: 1; }
.sidebar .nav-group-toggle .arrow { margin-left: auto; font-size: 10px; transition: transform 0.25s; opacity: .6; }
.sidebar .nav-group.open > .nav-group-toggle .arrow { transform: rotate(90deg); }
.sidebar .nav-group-toggle.active-parent { color: #fff; background: #3a4a5e; }
.sidebar .nav-submenu { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.sidebar .nav-group.open > .nav-submenu { max-height: 500px; }
.sidebar .nav-submenu a { padding-left: 48px; font-size: 13px; color: #a0aec0; }
.sidebar .nav-submenu a:hover, .sidebar .nav-submenu a.active { background: #4a5568; color: #fff; }
.sidebar .nav-submenu a .nav-icon { width: 18px; font-size: 14px; }
.main-content { flex: 1; padding: 20px; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h1 { font-size: 24px; }

/* Tab 导航（链接式视图切换，参考 AI 使用记录） */
.cms-tab-nav { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 20px; }
.cms-tab-nav a { padding: 10px 24px; font-size: 14px; font-weight: 500; color: #888; border-bottom: 3px solid transparent; text-decoration: none; transition: all .2s; }
.cms-tab-nav a:hover { color: #667eea; }
.cms-tab-nav a.active { color: #667eea; border-bottom-color: #667eea; }

/* ===== Bootstrap-style utility classes (used by CMS views) ===== */

/* Buttons - extended */
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a67d8; }
.btn-secondary { background: #a0aec0; color: #fff; }
.btn-secondary:hover { background: #718096; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { display: block; width: 100%; }

/* Forms */
.form-control { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; transition: border-color 0.3s; }
.form-control:focus { outline: none; border-color: #667eea; }
.form-row { display: flex; gap: 15px; }

/* Flex utilities */
.d-flex { display: flex; }
.justify-content-between { justify-content: space-between; }
.justify-content-end { justify-content: flex-end; }
.justify-content-center { justify-content: center; }
.align-items-center { align-items: center; }
.align-items-end { align-items: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-fill { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 15px; }

/* Spacing utilities */
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 20px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 20px; }
.ml-2 { margin-left: 8px; }
.mr-3 { margin-right: 15px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.p-3 { padding: 15px; }

/* Text utilities */
.text-center { text-align: center; }
.text-muted { color: #999; }

/* Border utilities */
.border { border: 1px solid #dee2e6; }

/* Card heading */
.card h4 { margin-bottom: 15px; font-size: 16px; color: #333; }

/* 表格 */
.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid #e2e8f0; }
.table th { background: #f7fafc; font-weight: 600; color: #4a5568; }
.table tr:hover { background: #f7fafc; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.badge-success { background: #c6f6d5; color: #22543d; }
.badge-danger { background: #fed7d7; color: #742a2a; }
.badge-warning { background: #feebc8; color: #744210; }
.badge-info { background: #bee3f8; color: #2a4365; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }
.toast { padding: 16px 24px; border-radius: 6px; color: #fff; margin-bottom: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideInUp 0.3s ease; }
.toast-success { background: #48bb78; }
.toast-error { background: #f56565; }
.toast-warning { background: #ed8936; }
.toast-info { background: #4299e1; }
@keyframes slideInUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 分页 */
.pagination { display: flex; list-style: none; gap: 5px; }
.pagination .page-item .page-link { padding: 8px 14px; border: 1px solid #ddd; border-radius: 4px; color: #667eea; cursor: pointer; }
.pagination .page-item.active .page-link { background: #667eea; color: #fff; border-color: #667eea; }
.pagination .page-item.disabled .page-link { color: #aaa; cursor: not-allowed; }
.justify-content-end { justify-content: flex-end; }
