/* ============================================================
   神木实验中学北校区积分管理系统 - 全局样式
   ============================================================ */

:root {
  --blue: #1E4FD8;
  --blue-light: #E8EDFB;
  --green: #0F9B8E;
  --green-light: #E6F7F5;
  --gold: #F4B740;
  --gold-light: #FEF8EC;
  --red: #D64545;
  --red-light: #FDECEC;
  --bg: #F6F8FB;
  --white: #FFFFFF;
  --text: #172033;
  --text-secondary: #7A869A;
  --border: #E2E8F0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px; border: 1px solid transparent;
  font-size: 14px; cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-warning { background: var(--gold); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========== Forms ========== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: var(--text); }
.form-control {
  width: 100%; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 14px; font-family: inherit;
  transition: border-color .2s; outline: none;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(30,79,216,0.1); }
.form-control.error { border-color: var(--red); }
select.form-control { background: #fff; }
textarea.form-control { resize: vertical; min-height: 60px; }

.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

/* ========== Cards ========== */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.card-title { font-size: 18px; font-weight: 600; }

/* ========== Tables ========== */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table th, table td {
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border);
}
table th { background: #F8FAFC; font-weight: 600; color: var(--text-secondary); font-size: 12px; text-transform: uppercase; white-space: nowrap; }
table tr:hover { background: #F8FAFC; }
table .text-right { text-align: right; }
table .text-center { text-align: center; }

/* ========== Status Badges ========== */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 12px; font-weight: 500;
}
.badge-success { background: var(--green-light); color: var(--green); }
.badge-danger { background: var(--red-light); color: var(--red); }
.badge-warning { background: var(--gold-light); color: #B8860B; }
.badge-info { background: var(--blue-light); color: var(--blue); }
.badge-gray { background: #F1F3F4; color: var(--text-secondary); }

/* Score colors */
.score-positive { color: var(--green); font-weight: 600; }
.score-negative { color: var(--red); font-weight: 600; }
.score-zero { color: var(--text-secondary); }

/* ========== Layout ========== */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 100; transition: transform .3s;
}
.sidebar-brand {
  padding: 20px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 700; color: var(--blue);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: var(--text); font-size: 14px; transition: all .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover, .sidebar-nav a.active {
  background: var(--blue-light); color: var(--blue);
  border-left-color: var(--blue); text-decoration: none;
}
.sidebar-user {
  padding: 16px 20px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary);
}

/* Header */
.header {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.header-title { font-size: 18px; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 12px; }

/* Main Content */
.main-content { flex: 1; margin-left: 240px; display: flex; flex-direction: column; }
.main-body { flex: 1; padding: 24px; }

/* Mobile bottom nav */
.bottom-nav {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid var(--border);
  z-index: 100; padding: 4px 0 env(safe-area-inset-bottom);
  justify-content: space-around;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; font-size: 11px; color: var(--text-secondary);
  text-decoration: none;
}
.bottom-nav a.active { color: var(--blue); }
.bottom-nav a svg { width: 20px; height: 20px; }

/* ========== Stat Cards ========== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stat-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.stat-card .stat-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ========== Modal ========== */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 90%; max-width: 560px;
  max-height: 85vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  font-size: 16px; font-weight: 600;
}
.modal-body { padding: 20px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 20px; border-top: 1px solid var(--border);
}
.modal-close { cursor: pointer; background: none; border: none; font-size: 20px; color: var(--text-secondary); }

/* ========== Alerts ========== */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #B7E4DE; }
.alert-error { background: var(--red-light); color: var(--red); border: 1px solid #F5C6C6; }
.alert-warning { background: var(--gold-light); color: #B8860B; border: 1px solid #FCE4B0; }
.alert-info { background: var(--blue-light); color: var(--blue); border: 1px solid #C4D2F7; }

/* ========== Search Bar ========== */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar .form-control { max-width: 300px; }

/* ========== Pagination ========== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 16px; }
.pagination button {
  padding: 6px 12px; border: 1px solid var(--border); background: #fff;
  border-radius: 4px; cursor: pointer; font-size: 13px;
}
.pagination button.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ========== Empty State ========== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state svg { width: 60px; height: 60px; margin-bottom: 16px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ========== Tabs ========== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
}
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab:hover { color: var(--blue); }

/* ========== Point Action Styles ========== */
.point-action-card { text-align: center; padding: 24px; cursor: pointer; border-radius: var(--radius); border: 2px solid var(--border); transition: all .2s; }
.point-action-card:hover { border-color: var(--blue); }
.point-action-card.add:hover { border-color: var(--green); background: var(--green-light); }
.point-action-card.deduct:hover { border-color: var(--red); background: var(--red-light); }
.point-action-card .icon { font-size: 36px; margin-bottom: 8px; }

/* ========== Responsive ========== */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .header { padding: 0 16px; }
  .main-body { padding: 16px; }
  /* Show menu toggle */
  .menu-toggle { display: block !important; }
}
@media (max-width: 768px) {
  .bottom-nav { display: flex; }
  .main-body { padding-bottom: 72px; }
  .form-row { flex-direction: column; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .header-title { font-size: 15px; }
}
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text); }

/* ========== Login Page ========== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1E4FD8 0%, #3B6EF0 50%, #5B8AF7 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 90%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 8px; color: var(--text); }
.login-card .subtitle { text-align: center; color: var(--text-secondary); margin-bottom: 32px; font-size: 13px; }

/* ========== Quick Actions ========== */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.quick-action { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; transition: all .15s; }
.quick-action:hover { border-color: var(--blue); box-shadow: var(--shadow); }
.quick-action .label { font-size: 13px; font-weight: 500; margin-top: 6px; }

/* ========== Utility ========== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.font-bold { font-weight: 600; }
.hidden { display: none !important; }
.w-full { width: 100%; }
