/* 竞赛报名及计分管理系统 - 全局样式 */
:root {
  --primary: #1a56db;
  --primary-dark: #1343a8;
  --secondary: #6b7280;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #0891b2;
  --bg: #f3f4f6;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --text-muted: #6b7280;
  --sidebar-bg: #1e3a5f;
  --sidebar-text: #e2e8f0;
  --sidebar-active: #2563eb;
  --header-bg: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.12);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

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

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

/* ===== 侧边栏 ===== */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 16px;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}
.sidebar-logo .icon { font-size: 22px; }
.sidebar-menu { flex: 1; padding: 12px 0; }
.menu-group-title {
  padding: 8px 16px 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: 0;
  transition: background .15s;
  font-size: 13.5px;
  text-decoration: none;
}
.menu-item:hover { background: rgba(255,255,255,.1); text-decoration: none; }
.menu-item.active { background: var(--sidebar-active); color: #fff; }
.menu-item .mi { width: 18px; text-align: center; }

/* ===== 主内容区 ===== */
.main-content {
  margin-left: 220px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== 顶部栏 ===== */
.topbar {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--text-muted); }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* ===== 内容区 ===== */
.content { padding: 24px; flex: 1; }

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 统计卡片 ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  border-left: 4px solid var(--primary);
}
.stat-card.green { border-left-color: var(--success); }
.stat-card.orange { border-left-color: var(--warning); }
.stat-card.red { border-left-color: var(--danger); }
.stat-card.cyan { border-left-color: var(--info); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border: none; border-radius: 6px;
  cursor: pointer; font-size: 13.5px;
  font-weight: 500; transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.data-table th, .data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table th { background: #f9fafb; font-weight: 600; color: var(--text-muted); font-size: 12.5px; }
.data-table tr:hover td { background: #f9fafb; }
.data-table td .btn { margin-right: 4px; }

/* ===== 徽章 ===== */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #cffafe; color: #155e75; }
.badge-secondary { background: #f3f4f6; color: #374151; }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-silver { background: #f3f4f6; color: #374151; }
.badge-bronze { background: #fde8d8; color: #7c3017; }

/* ===== 表单 ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 500; margin-bottom: 5px; font-size: 13.5px; }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-control[readonly] { background: #f9fafb; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== 搜索栏 ===== */
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search-bar .form-control { max-width: 220px; }

/* ===== 分页 ===== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }
.page-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  transition: all .15s;
}
.page-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.disabled { opacity: .4; cursor: not-allowed; }

/* ===== 模态框 ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: none;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  margin: auto;
}
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1050px; }
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 16px;
  font-weight: 600;
}
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ===== 警告框 ===== */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-danger { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: #e0f2fe; color: #075985; border-left: 4px solid var(--info); }

/* ===== 复选框 ===== */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.checkbox-item { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 13.5px; }
.checkbox-item input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.login-box {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  padding: 40px 48px;
  width: 100%;
  max-width: 460px;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 10px; }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  background: #f9fafb;
  transition: all .15s;
  border: none;
}
.login-tab.active { background: var(--primary); color: #fff; }

/* ===== 参赛证 ===== */
.cert-card {
  background: #fff;
  border: 2px solid #1a56db;
  border-radius: 12px;
  max-width: 420px;
  margin: 20px auto;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(26,86,219,.15);
}
.cert-header {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: #fff;
  text-align: center;
  padding: 20px;
}
.cert-header h2 { font-size: 22px; margin-bottom: 4px; }
.cert-body { padding: 24px; }
.cert-photo { text-align: center; margin-bottom: 16px; }
.cert-photo img { width: 100px; height: 130px; object-fit: cover; border-radius: 4px; border: 2px solid #ddd; }
.cert-info { display: grid; grid-template-columns: 90px 1fr; gap: 8px 0; font-size: 14px; }
.cert-info dt { color: var(--text-muted); font-weight: 500; }
.cert-info dd { font-weight: 600; color: var(--text); }
.cert-no { text-align: center; margin-top: 16px; font-size: 24px; font-weight: 700; color: var(--primary); letter-spacing: 2px; }

/* ===== 打印 ===== */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .cert-card { box-shadow: none; page-break-after: always; }
}

/* ===== 工具类 ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .login-box { padding: 28px 20px; }
}
