/* ============================================
   i四班班务系统 - 移动端全局样式
   ============================================ */
:root {
  --primary: #4a6cf7;
  --primary-light: #eef1ff;
  --primary-dark: #3a56d4;
  --accent: #ff6b6b;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e7eb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
  --tabbar-height: 60px;
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html { font-size:16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 顶部导航 ---------- */
.navbar {
  background: var(--card);
  padding: env(safe-area-inset-top, 0px) 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 0.5px solid var(--border);
}
.navbar-inner {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.navbar-title { font-size: 17px; font-weight: 600; }
.navbar-back {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
}
.navbar-right {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--primary);
  cursor: pointer;
}

/* ---------- 底部Tab栏 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 0.5px solid var(--border);
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-light);
  font-size: 10px;
  position: relative;
  cursor: pointer;
  transition: color .2s;
}
.tabbar-item.active { color: var(--primary); }
.tabbar-item .icon {
  font-size: 22px;
  line-height: 1;
}
.tabbar-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 22px);
  min-width: 16px;
  height: 16px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-weight: 600;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 12px 16px;
  overflow: hidden;
}
.card-pad { padding: 16px; }

/* ---------- 页面容器 ---------- */
.page { padding: 12px 0 20px; min-height: calc(100vh - var(--tabbar-height)); }

/* ---------- 列表项 ---------- */
.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  gap: 12px;
  cursor: pointer;
  transition: background .15s;
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #f9fafb; }
.list-item .icon-box {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.list-item .content { flex: 1; min-width: 0; }
.list-item .title { font-size: 15px; font-weight: 500; }
.list-item .desc { font-size: 12px; color: var(--text-light); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .arrow { color: var(--text-light); font-size: 14px; }
.list-item .badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-weight: 600;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: opacity .2s, transform .1s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), #6c5ce7); color: #fff; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: var(--text); }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--card);
  outline: none;
  transition: border .2s;
  -webkit-appearance: none;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--primary); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 6px; }

/* ---------- 头像 ---------- */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
}
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 96px; height: 96px; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty .text { font-size: 14px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.tag-warning { background: #fff8e6; color: var(--warning); }
.tag-success { background: #e8f8ef; color: var(--success); }
.tag-danger { background: #ffeaea; color: var(--danger); }
.tag-info { background: var(--primary-light); color: var(--primary); }

/* ---------- 个人中心头部 ---------- */
.profile-header {
  background: linear-gradient(135deg, var(--primary), #6c5ce7);
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px 24px;
  color: #fff;
}
.profile-header .row { display: flex; align-items: center; gap: 16px; }
.profile-header .info .name { font-size: 20px; font-weight: 700; }
.profile-header .info .sub { font-size: 13px; opacity: .85; margin-top: 4px; }

/* ---------- 统计数字 ---------- */
.stat-row { display: flex; text-align: center; }
.stat-item { flex: 1; }
.stat-item .num { font-size: 20px; font-weight: 700; }
.stat-item .label { font-size: 12px; opacity: .8; margin-top: 2px; }

/* ---------- 课程表 ---------- */
.schedule-grid { width: 100%; border-collapse: collapse; font-size: 12px; }
.schedule-grid th, .schedule-grid td {
  border: 0.5px solid var(--border);
  padding: 6px 4px;
  text-align: center;
  vertical-align: middle;
}
.schedule-grid th { background: #f9fafb; font-weight: 600; color: var(--text-secondary); font-size: 11px; }
.schedule-cell {
  border-radius: 6px;
  padding: 4px 2px;
  font-size: 11px;
  line-height: 1.3;
  color: #fff;
}
.schedule-cell .room { font-size: 10px; opacity: .85; }

/* ---------- 消息项 ---------- */
.notice-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 0.5px solid var(--border);
  cursor: pointer;
}
.notice-item:active { background: #f9fafb; }
.notice-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}
.notice-item .dot.read { background: transparent; }
.notice-item .body { flex: 1; min-width: 0; }
.notice-item .title { font-size: 15px; font-weight: 500; }
.notice-item .title.unread { font-weight: 700; }
.notice-item .meta { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,.75);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  background: linear-gradient(160deg, #4a6cf7 0%, #6c5ce7 50%, #8b5cf6 100%);
  display: flex;
  flex-direction: column;
  padding: 60px 32px 40px;
}
.login-logo {
  text-align: center;
  color: #fff;
  margin-bottom: 48px;
}
.login-logo .icon {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,.2);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 16px;
  backdrop-filter: blur(10px);
}
.login-logo h1 { font-size: 26px; font-weight: 700; }
.login-logo p { font-size: 14px; opacity: .8; margin-top: 6px; }
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.login-card .form-input {
  background: #f5f7fa;
  border: 1.5px solid transparent;
  margin-bottom: 14px;
}
.login-card .form-input:focus { border-color: var(--primary); background: #fff; }
.login-links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 13px;
}
.login-links a { color: var(--primary); }

/* ---------- 工具 ---------- */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
