/* ============================================
   教师工作台 · 全局样式
   第2步：SVG图标适配 + 深色模式 + 动效精修
   ============================================ */

:root {
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --text: #1F2A44;
  --text-2: #6B7695;
  --text-3: #9AA3BD;
  --primary: #5B7CFA;
  --hero1: #5B7CFA;
  --hero2: #7FB5FF;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(37, 57, 118, 0.08);
  --shadow-lg: 0 8px 28px rgba(37, 57, 118, 0.12);
  --header-bg: rgba(244, 246, 251, 0.92);
}

/* 深色模式：跟随系统设置 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11141F;
    --card: #1A1F2E;
    --text: #E8ECF7;
    --text-2: #9AA3BD;
    --text-3: #6B7695;
    --hero1: #3D5BD9;
    --hero2: #5E93E8;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, 0.45);
    --header-bg: rgba(17, 20, 31, 0.85);
  }
  body { background: #0B0E16; }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: #EDF0F7;
  color: var(--text);
  min-height: 100vh;
}

/* 手机宽度适配：居中容器，两侧留白 */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

@media (min-width: 520px) {
  #app {
    box-shadow: 0 0 40px rgba(31, 45, 90, 0.08);
  }
}

/* ---------- 顶部渐变区（日期） ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--hero1) 0%, var(--hero2) 100%);
  border-radius: 0 0 28px 28px;
  padding: calc(26px + env(safe-area-inset-top)) 20px 64px;
}

/* 装饰圆 */
.hero::before {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  right: -50px;
  top: -40px;
}

.hero::after {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  left: -30px;
  bottom: -60px;
}

.date-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.92);
}

.date-main {
  font-weight: 600;
  font-size: 15px;
}

.date-sun {
  font-size: 12px;
}

.greeting {
  margin-left: auto;
  font-size: 12px;
  opacity: 0.85;
}

/* ---------- 三个统计卡片（压住渐变区底部） ---------- */
.stats {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  margin-top: -44px;
  position: relative;
  z-index: 2;
}

.stat-card {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 6px 12px;
  box-shadow: var(--shadow);
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.stat-card:active {
  transform: scale(0.96);
}

.stat-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.stat-icon svg {
  width: 19px;
  height: 19px;
}

.stat-num {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  font-size: 25px;
  font-weight: 700;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}

.stat-num .unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
}

.stat-label {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
}

/* ---------- 区块标题 ---------- */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 26px 20px 12px;
  font-size: 15px;
  font-weight: 700;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--primary);
}

/* ---------- 功能入口宫格 ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 16px;
}

.fn-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fn-card:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-lg);
}

/* 桌面端悬停效果（手机无鼠标不生效） */
@media (hover: hover) {
  .stat-card:hover,
  .fn-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
}

.fn-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.fn-icon svg {
  width: 22px;
  height: 22px;
}

.fn-name {
  font-size: 15px;
  font-weight: 600;
}

.fn-desc {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 图标渐变色 */
.g-blue   { background: linear-gradient(135deg, #4D8DFF, #6DB8FF); }
.g-orange { background: linear-gradient(135deg, #FF9A56, #FFC371); }
.g-red    { background: linear-gradient(135deg, #FF6B8A, #FF9A76); }
.g-purple { background: linear-gradient(135deg, #9B6BFF, #C39BFF); }
.g-teal   { background: linear-gradient(135deg, #2EC4B6, #6BE2D5); }
.g-green  { background: linear-gradient(135deg, #34C77B, #7BE0A8); }
.g-indigo { background: linear-gradient(135deg, #5B7CFA, #8AA0FF); }

/* ---------- 子页面 ---------- */
.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 14px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.back-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.back-btn svg {
  width: 20px;
  height: 20px;
}

.page-title {
  font-size: 17px;
  font-weight: 700;
}

.placeholder {
  text-align: center;
  padding: 100px 30px;
}

.placeholder-emoji {
  font-size: 56px;
  margin-bottom: 18px;
}

.placeholder p:first-of-type {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.placeholder-sub {
  font-size: 13px;
  margin-top: 10px;
  color: var(--text-3);
  line-height: 1.8;
}

/* ---------- 动效 ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(48px); }
  to   { opacity: 1; transform: none; }
}

.hero       { animation: fadeUp 0.4s ease both; }
.stats      { animation: fadeUp 0.4s ease 0.08s both; }
.grid       { animation: fadeUp 0.4s ease 0.15s both; }
.page-slide { animation: slideIn 0.28s cubic-bezier(0.25, 0.8, 0.3, 1) both; }

/* ---------- 首页齿轮按钮 ---------- */
.gear-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.92);
  padding: 4px;
  display: flex;
  cursor: pointer;
  margin-left: 6px;
}

.gear-btn svg { width: 19px; height: 19px; }

/* ---------- 设置与数据页 ---------- */
.settings {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.set-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.set-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}

.set-title::before {
  content: '';
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--primary);
}

.set-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.set-stat {
  flex: 1 1 28%;
  min-width: 88px;
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}

.set-stat b {
  display: block;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.set-stat span {
  font-size: 12px;
  color: var(--text-2);
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-row:last-child {
  margin-bottom: 0;
}

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 12px;
  padding: 12px 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.btn svg { width: 17px; height: 17px; }

.btn:active { transform: scale(0.97); }

.btn-blue {
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  color: #fff;
}

.btn-blue-outline {
  background: var(--card);
  border: 1.5px solid var(--text-3);
}

.btn-danger {
  background: linear-gradient(135deg, #FF6B6B, #FF8E8E);
  color: #fff;
}

.btn-danger-outline {
  background: var(--card);
  border: 1.5px solid #E5484D;
  color: #E5484D;
}

.btn-text {
  flex: 0 0 auto;
  background: none;
  color: var(--primary);
  padding: 8px 4px;
  font-size: 13px;
}

.set-hint {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
  margin-bottom: 12px;
}

.set-hint b { color: var(--text-2); }

.set-danger .set-title::before { background: #E5484D; }

.paste-area {
  width: 100%;
  min-height: 90px;
  border-radius: 12px;
  border: 1.5px dashed var(--text-3);
  background: var(--bg);
  color: var(--text);
  padding: 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 10px;
}

/* ---------- 底部提示条 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: rgba(31, 42, 68, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 999;
  max-width: 84%;
  text-align: center;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- 子页面通用 ---------- */
.page-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
}

/* 筛选小胶囊 */
.chips {
  display: flex;
  gap: 8px;
  padding: 14px 16px 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 18px;
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  font-family: inherit;
  border: none;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.chip:active { transform: scale(0.95); }

.chip.active {
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  color: #fff;
  font-weight: 600;
}

/* 列表 */
.list {
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-head {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  padding: 8px 2px 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.row:active { transform: scale(0.98); }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-m { background: linear-gradient(135deg, #4D8DFF, #6DB8FF); }
.avatar-f { background: linear-gradient(135deg, #F071A6, #FF9AC1); }
.avatar-u { background: linear-gradient(135deg, #9AA3BD, #C3CADD); }

.row-main { min-width: 0; }

.row-name {
  font-size: 15px;
  font-weight: 600;
}

.row-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 2px;
}

/* 待办日程 */
.add-bar {
  display: flex;
  gap: 10px;
  padding: 14px 16px 4px;
}

.add-input {
  flex: 1;
  background: var(--card);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text);
  box-shadow: var(--shadow);
  font-family: inherit;
  outline: none;
}

.add-btn {
  width: 46px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.add-btn svg { width: 20px; height: 20px; }

.todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: 14px;
  padding: 13px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.todo-row:active { transform: scale(0.98); }

.todo-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}

.todo-check svg { width: 12px; height: 12px; }

.todo-row.done .todo-check {
  background: linear-gradient(135deg, #34C77B, #7BE0A8);
  border-color: transparent;
}

.todo-row.done .todo-title {
  text-decoration: line-through;
  color: var(--text-3);
}

.todo-title {
  flex: 1;
  font-size: 14px;
}

.todo-date {
  font-size: 11px;
  color: var(--text-2);
  flex-shrink: 0;
}

/* 班级课表 */
.sched {
  padding: 12px 12px 24px;
}

.sched-table {
  display: grid;
  grid-template-columns: 44px repeat(5, 1fr);
  gap: 4px;
}

.sched-corner { min-height: 8px; }

.sched-day {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  padding: 6px 0;
}

.sched-period {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-3);
}

.sched-sub {
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  text-align: center;
  padding: 2px;
}

.sched-empty { background: transparent; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 60px 30px;
  color: var(--text-3);
}

.empty-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.empty p:first-of-type {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-sub {
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.7;
}

/* ---------- 悬浮"+"按钮 ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  color: #fff;
  box-shadow: 0 6px 20px rgba(91, 124, 250, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: transform 0.15s ease;
}

.fab:active { transform: scale(0.92); }

.fab svg { width: 24px; height: 24px; }

@media (min-width: 520px) {
  .fab { right: calc(50% - 220px); }
}

.row-more {
  margin-left: auto;
  color: var(--text-3);
  display: flex;
}

.row-more svg { width: 16px; height: 16px; }

/* ---------- 底部表单弹层 ---------- */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 35, 0.45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: maskIn 0.2s ease both;
}

.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg);
  border-radius: 20px 20px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.3s cubic-bezier(0.25, 0.8, 0.3, 1) both;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}

@keyframes maskIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
}

.sheet-cancel {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 0;
}

.sheet-save {
  border: none;
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 20px;
  border-radius: 18px;
  font-family: inherit;
  cursor: pointer;
}

/* 表单字段 */
.field { margin-bottom: 14px; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.req { color: #E5484D; }

.field-input {
  width: 100%;
  background: var(--card);
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  font-family: inherit;
  box-shadow: var(--shadow);
  outline: none;
}

.field-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%239AA3BD" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

/* 性别分段选择 */
.seg { display: flex; gap: 8px; }

.seg-btn {
  flex: 1;
  padding: 11px 0;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  border: none;
  font-size: 14px;
  color: var(--text-2);
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s ease;
}

.seg-btn.active {
  background: linear-gradient(135deg, var(--hero1), var(--hero2));
  color: #fff;
  font-weight: 600;
}

.sheet-delete { width: 100%; }
