/* Common styles for admin panel */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f0f2f5; color: #333; }

/* Login page */
.login-container { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.login-box { background: #fff; border-radius: 12px; padding: 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box h2 { text-align: center; margin-bottom: 30px; color: #333; font-size: 24px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: #555; }
.form-group input { width: 100%; padding: 12px 16px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; transition: border .2s; }
.form-group input:focus { outline: none; border-color: #667eea; }
.btn-primary { width: 100%; padding: 12px; background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; border-radius: 8px; font-size: 16px; cursor: pointer; transition: opacity .2s; }
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.msg-error { color: #e74c3c; font-size: 13px; margin-top: 8px; text-align: center; min-height: 20px; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: #1a1a2e; color: #fff; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100; }
.sidebar-header { padding: 20px; font-size: 18px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,.1); text-align: center; }
.sidebar-nav { padding: 10px 0; }
.sidebar-nav a { display: flex; align-items: center; padding: 12px 20px; color: rgba(255,255,255,.7); text-decoration: none; font-size: 14px; transition: all .2s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a .icon { margin-right: 10px; font-size: 16px; width: 20px; text-align: center; }
.main { flex: 1; margin-left: 240px; }
.topbar { background: #fff; padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 1px 4px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user button { background: #e74c3c; color: #fff; border: none; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.content { padding: 24px; }

/* Cards */
.card { background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 20px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #eee; }

/* Stat cards */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.stat-card .label { font-size: 13px; color: #888; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: #333; }
.stat-card .change { font-size: 12px; margin-top: 4px; }
.stat-card .change.up { color: #27ae60; }
.stat-card .change.down { color: #e74c3c; }

/* Table */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; }
th { background: #fafafa; font-weight: 600; color: #555; white-space: nowrap; }
td { color: #333; }
tr:hover td { background: #f8f9ff; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* Buttons */
.btn { display: inline-block; padding: 6px 16px; border-radius: 6px; font-size: 13px; cursor: pointer; border: none; transition: all .2s; text-decoration: none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-blue { background: #667eea; color: #fff; }
.btn-blue:hover { background: #5a6fd6; }
.btn-green { background: #27ae60; color: #fff; }
.btn-green:hover { background: #219a52; }
.btn-red { background: #e74c3c; color: #fff; }
.btn-red:hover { background: #c0392b; }
.btn-orange { background: #f39c12; color: #fff; }
.btn-orange:hover { background: #e67e22; }
.btn-gray { background: #95a5a6; color: #fff; }
.btn-gray:hover { background: #7f8c8d; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* Filter bar */
.filter-bar { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.filter-bar input { min-width: 200px; }
.filter-bar select { min-width: 120px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination button { padding: 6px 12px; border: 1px solid #ddd; background: #fff; border-radius: 4px; cursor: pointer; font-size: 13px; }
.pagination button:hover { background: #f0f0f0; }
.pagination button.active { background: #667eea; color: #fff; border-color: #667eea; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.page-info { font-size: 13px; color: #888; margin-top: 12px; text-align: center; }

/* Modal */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 500px; max-width: 90vw; max-height: 80vh; overflow-y: auto; }
.modal h3 { margin-bottom: 20px; font-size: 18px; }
.modal .form-group { margin-bottom: 16px; }
.modal .form-group label { display: block; margin-bottom: 4px; font-weight: 500; font-size: 13px; color: #555; }
.modal .form-group input, .modal .form-group select, .modal .form-group textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.modal .form-group textarea { min-height: 80px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: #888; }
.loading::before { content: '加载中...'; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }
}
