/* ═══════════════════════════════════════════════════════════════
   style.css — 轻量考勤系统样式
   设计方向：专业后台风格，手机优先，深色导航 + 浅色内容
═══════════════════════════════════════════════════════════════ */

/* ─── CSS 变量 ─────────────────────────────────────────────── */
:root {
  --nav-bg: #1a1f2e;
  --nav-accent: #4f8ef7;
  --primary: #4f8ef7;
  --primary-dark: #3a7aed;

  --present: #22c55e;
  --absent: #ef4444;
  --late: #f59e0b;
  --leave: #3b82f6;
  --night: #8b5cf6;

  --bg: #f4f6fb;
  --card-bg: #ffffff;
  --border: #e5e9f2;
  --text: #1e2533;
  --text-muted: #6b7280;

  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

/* ─── 基础 ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ─── 导航栏 ─────────────────────────────────────────────────── */
#mainNav {
  background: var(--nav-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,.2);
  padding-top: .5rem;
  padding-bottom: .5rem;
}

.nav-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
}

.brand-icon {
  font-size: 1.25rem;
  color: var(--nav-accent);
}

#mainNav .navbar-brand { font-size: 1rem; letter-spacing: .02em; }

#mainNav .nav-link {
  color: rgba(255,255,255,.7) !important;
  font-size: .875rem;
  transition: background .15s, color .15s;
}
#mainNav .nav-link:hover,
#mainNav .nav-link.active {
  background: rgba(79,142,247,.15);
  color: #fff !important;
}

/* ─── 页面标题 ───────────────────────────────────────────────── */
.page-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}
.page-sub { font-size: .8rem; }

/* ─── 卡片面板 ───────────────────────────────────────────────── */
.card-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.panel-header {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ─── 统计卡片 ───────────────────────────────────────────────── */
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  text-align: center;
  transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: .25rem;
}
.stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-total .stat-value  { color: var(--primary); }
.stat-present .stat-value{ color: var(--present); }
.stat-absent .stat-value { color: var(--absent); }
.stat-leave .stat-value  { color: var(--leave); }
.stat-night .stat-value  { color: var(--night); }
.stat-late .stat-value   { color: var(--late); }

/* ─── 快捷操作按钮 ───────────────────────────────────────────── */
.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  transition: transform .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.action-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.action-btn i { font-size: 1.4rem; }

.action-primary {
  background: var(--primary);
  color: #fff;
}
.action-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

/* ─── 横幅提示 ───────────────────────────────────────────────── */
.alert-banner {
  padding: .8rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .9rem;
}
.alert-banner.success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-banner.warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.alert-banner a { color: inherit; }

/* ─── 趋势图 ─────────────────────────────────────────────────── */
.trend-row {
  display: flex;
  gap: .5rem;
  align-items: flex-end;
  height: 80px;
  padding-top: .5rem;
}
.trend-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.trend-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.trend-bar {
  width: 70%;
  background: var(--present);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .3s ease;
  opacity: .75;
}
.trend-bar-empty { background: var(--border); opacity: 1; }
.trend-label { font-size: .7rem; color: var(--text-muted); font-weight: 600; }
.trend-num   { font-size: .7rem; color: var(--text); font-weight: 700; }

/* ─── 登录页 ─────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1f2e 0%, #2d3555 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-wrapper { width: 100%; max-width: 400px; }
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  font-size: 3rem;
  color: var(--primary);
  line-height: 1;
  margin-bottom: .5rem;
}

.login-logo-img {
  max-height: 90px;
  width: auto;
  object-fit: contain;
}
.login-title { font-size: 1.5rem; font-weight: 800; color: var(--text); margin-bottom: 0; }
.login-sub   { font-size: .75rem; color: var(--text-muted); letter-spacing: .08em; }

/* ─── 点名页 ─────────────────────────────────────────────────── */
/* 状态图例 */
.status-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.legend-item {
  font-size: .8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem;
}
.legend-item i { font-size: .6rem; }
.legend-item.present { color: var(--present); }
.legend-item.absent  { color: var(--absent); }
.legend-item.late    { color: var(--late); }
.legend-item.leave   { color: var(--leave); }
.legend-item.night   { color: var(--night); }

/* 成员行 */
.member-list { display: flex; flex-direction: column; gap: .5rem; }

.member-row {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  transition: border-color .15s;
}

/* 状态高亮 */
.member-row[data-status="present"] { border-color: var(--present); }
.member-row[data-status="absent"]  { border-color: var(--absent); }
.member-row[data-status="late"]    { border-color: var(--late); }
.member-row[data-status="leave"]   { border-color: var(--leave); }

.member-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .5rem;
}

/* 状态按钮组 */
.btn-night {
  --btn-bg: #f5f3ff;
  --btn-color: var(--night);
  --btn-border: var(--night);
}
.btn-night:hover,
.btn-check:checked + .btn-night {
  background: var(--night) !important;
  color: #fff !important;
}
.s-night { color: var(--night); font-weight: 600; }

.status-btn-group {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

.btn-check { position: absolute; clip: rect(0,0,0,0); }

.btn-status {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .45rem .75rem;
  border-radius: 8px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg);
  color: var(--text-muted);
  transition: all .15s;
  user-select: none;
  min-height: 40px; /* 手机友好 */
}
.btn-status i { font-size: 1rem; }

.btn-check:checked + .btn-present {
  background: #dcfce7; color: #166534; border-color: var(--present);
}
.btn-check:checked + .btn-absent {
  background: #fee2e2; color: #991b1b; border-color: var(--absent);
}
.btn-check:checked + .btn-late {
  background: #fef3c7; color: #92400e; border-color: var(--late);
}
.btn-check:checked + .btn-leave {
  background: #dbeafe; color: #1e40af; border-color: var(--leave);
}

/* 备注 */
.remark-wrap { margin-top: .5rem; }
.remark-input { border-radius: 8px; font-size: .85rem; }

/* 保存底栏 */
.save-footer {
  position: sticky;
  bottom: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  padding: .75rem 0;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  z-index: 100;
}
.save-summary { font-size: .8rem; color: var(--text-muted); }
.s-present { color: var(--present); font-weight: 700; }
.s-absent  { color: var(--absent);  font-weight: 700; }
.s-late    { color: var(--late);    font-weight: 700; }
.s-leave   { color: var(--leave);   font-weight: 700; }

.btn-save {
  padding: .65rem 2rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}

/* ─── 报表页 ─────────────────────────────────────────────────── */
.rate-bar-wrap {
  position: relative;
  background: #f1f5f9;
  border-radius: 99px;
  height: 20px;
  width: 100%;
  min-width: 80px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.rate-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  border-radius: 99px;
  transition: width .4s ease;
}
.rate-text {
  position: relative;
  font-size: .75rem;
  width: 100%;
  text-align: center;
  z-index: 1;
}

/* ─── 表格 ───────────────────────────────────────────────────── */
.table-head th {
  background: #f8fafc;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-top: .75rem;
  padding-bottom: .75rem;
}
.table > :not(:first-child) { border-top: none; }
.table td { border-color: var(--border); }

/* ─── 空状态 ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3.5rem;
  display: block;
  margin-bottom: 1rem;
  opacity: .3;
}
.empty-state p { font-size: 1rem; margin-bottom: 0; }

/* ─── 响应式适配 ─────────────────────────────────────────────── */
@media (max-width: 576px) {
  .stat-value { font-size: 1.75rem; }
  .page-title { font-size: 1.15rem; }
  .btn-status { padding: .4rem .6rem; font-size: .75rem; }
  .status-label { display: none; } /* 小屏只显示图标 */
  .save-footer { flex-direction: column; align-items: stretch; }
  .btn-save { width: 100%; }
  .login-card { padding: 2rem 1.25rem; }
}

@media (min-width: 768px) {
  main.container-fluid { max-width: 900px; }
}
