/* ============================================================
   家长端样式（Mobile-First，紫色系，严格按需求第十节）
   主色 #7C3AED / 辅助 #8B5CF6 #C4B5FD / 浅紫背景 #F5F3FF
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --primary: #7C3AED;
  --primary-deep: #6D28D9;
  --primary-2: #8B5CF6;
  --primary-3: #C4B5FD;
  --bg: #F6F5FE;
  --text: #1F2937;
  --text-2: #6B7280;
  --danger: #EF4444;
  --radius: 18px;
  --shadow-sm: 0 2px 8px rgba(109, 40, 217, .05), 0 1px 2px rgba(109, 40, 217, .04);
  --shadow-md: 0 8px 24px rgba(109, 40, 217, .08), 0 2px 6px rgba(109, 40, 217, .05);
  --shadow-lg: 0 16px 40px rgba(109, 40, 217, .14), 0 4px 10px rgba(109, 40, 217, .06);
  --card-border: 1px solid rgba(124, 58, 237, .07);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Source Han Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

/* 自定义背景生效时：容器透明，让 body 背景透出（卡片仍保持白色保证可读性） */
html.custom-bg, html.custom-bg body { background: transparent; }
html.custom-bg #app { background: transparent; }

/* ---------- 顶部导航（固定顶部：LOGO + 学校名称 + 当前用户） ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary) 55%, var(--primary-2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(109, 40, 217, .30);
}
.topbar .logo { width: 38px; height: 38px; border-radius: 50%; background: #fff; object-fit: cover; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.topbar .school { font-weight: 700; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.topbar .user { font-size: 13px; opacity: .95; text-align: right; line-height: 1.3; cursor: pointer; }
.topbar .user b { font-size: 14px; }

/* 用户菜单 */
.user-menu {
  position: absolute; right: 12px; top: 62px; z-index: 30;
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-lg); min-width: 150px;
  border: 1px solid rgba(124, 58, 237, .08);
}
.user-menu .item { padding: 13px 16px; font-size: 15px; color: var(--text); cursor: pointer; transition: background .15s; }
.user-menu .item:active { background: var(--bg); }
.user-menu .item.danger { color: var(--danger); }

/* ---------- 登录页 ---------- */
.login-wrap { padding: 56px 20px 24px; text-align: center; }
.login-logo { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; background: #fff;
  box-shadow: 0 12px 32px rgba(109, 40, 217, .28); margin-bottom: 18px; }
.login-school {
  font-size: 24px; font-weight: 700; margin-bottom: 10px; letter-spacing: .01em;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary-2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
/* 欢迎语：强制单行完整显示，字号随屏宽自适应（小屏自动缩小，绝不折行、不溢出） */
.login-welcome {
  font-size: clamp(9px, 2.9vw, 14px);
  color: var(--text-2); line-height: 1.8; margin-bottom: 36px;
  white-space: nowrap; letter-spacing: .03em;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 26px 22px;
  box-shadow: var(--shadow-lg); text-align: left; border: var(--card-border);
}
.login-card label { font-size: 14px; color: var(--text-2); display: block; margin: 14px 0 6px; font-weight: 500; }
.login-card label:first-child { margin-top: 0; }
/* 登录页底部的管理员入口：低调小字，不干扰家长 */
.admin-entry { display: inline-block; margin-top: 28px; font-size: 13px; color: var(--text-2); text-decoration: none; opacity: .75; }
.admin-entry:active { opacity: 1; }

.input {
  width: 100%; height: 50px; border: 1.5px solid #E5E7EB; border-radius: 14px;
  padding: 0 14px; font-size: 16px; font-family: inherit; background: #FAFAFA;
  outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:focus { border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 4px rgba(139, 92, 246, .14); }

/* ---------- 按钮（主按钮紫色渐变，圆角 14px，禁用浅灰） ---------- */
.btn {
  display: block; width: 100%; height: 52px; border: none; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary) 55%, var(--primary-2)); color: #fff;
  font-size: 17px; font-weight: 600; letter-spacing: .06em; font-family: inherit; cursor: pointer;
  box-shadow: 0 6px 18px rgba(109, 40, 217, .32); transition: transform .12s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { background: #E5E7EB; color: #9CA3AF; box-shadow: none; cursor: not-allowed; letter-spacing: normal; }
.btn.small { height: 42px; font-size: 15px; width: auto; padding: 0 22px; display: inline-block; letter-spacing: normal; }
.btn.ghost { background: #fff; color: var(--primary); border: 1.5px solid var(--primary-3); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, #DC2626, #F87171); box-shadow: 0 6px 18px rgba(220, 38, 38, .25); }
.btn.mt { margin-top: 18px; }

/* ---------- 页面容器与卡片 ---------- */
.page { padding: 18px 16px 90px; }
.card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-md); margin-bottom: 14px; border: var(--card-border);
}

.page-title { font-size: 21px; font-weight: 700; margin: 6px 0 4px; letter-spacing: .01em; }
.page-sub { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }

/* ---------- 首页大卡片入口 ---------- */
.entry-card {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border-radius: 20px; padding: 24px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-md); border: var(--card-border); cursor: pointer;
  transition: transform .12s, box-shadow .2s;
}
.entry-card:active { transform: scale(.98); }
.entry-card .icon {
  width: 60px; height: 60px; border-radius: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .10);
}
.entry-card .t1 { font-size: 19px; font-weight: 700; letter-spacing: .01em; }
.entry-card .t2 { font-size: 13px; color: var(--text-2); margin-top: 4px; line-height: 1.6; }
.entry-card .arrow { margin-left: auto; color: var(--primary-3); font-size: 22px; }

/* ---------- 课程卡片 ---------- */
.course-card {
  background: #fff; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-md); margin-bottom: 14px;
  border: 2px solid transparent; transition: border-color .2s, transform .12s, box-shadow .2s;
}
.course-card.selected { border-color: var(--primary); background: linear-gradient(180deg, #F6F4FF, #fff); }
.course-card.disabled { opacity: .55; }
.course-name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: .01em; }
.course-meta { font-size: 13px; color: var(--text-2); margin-top: 8px; line-height: 1.9; }
.course-meta b { color: var(--text); font-weight: 600; }
.course-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; gap: 10px; }

.tag { display: inline-block; font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.tag.selected { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.tag.off { background: #F3F4F6; color: #9CA3AF; }
.tag.free { background: #ECFDF5; color: #059669; }
.tag.fee { background: #FFFBEB; color: #D97706; }
.tag.remain { background: #EDE9FE; color: var(--primary); }
.tag.full { background: #FEF2F2; color: var(--danger); }

/* ---------- 星期 Tab ---------- */
.day-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.day-tab {
  flex: 1; text-align: center; padding: 10px 0; border-radius: 14px;
  background: #fff; font-size: 15px; font-weight: 600; color: var(--text-2);
  box-shadow: var(--shadow-sm); border: 1px solid rgba(124, 58, 237, .06); cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}
.day-tab.active { background: linear-gradient(135deg, var(--primary-deep), var(--primary-2)); color: #fff; box-shadow: 0 6px 16px rgba(109, 40, 217, .30); }
.day-tab .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary-2); margin-left: 3px; vertical-align: middle; }
.day-tab.active .dot { background: #fff; }

.day-banner {
  border-radius: 14px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px;
  background: #EDE9FE; color: var(--primary); font-weight: 600; line-height: 1.6;
  border: 1px solid rgba(124, 58, 237, .10);
}
.empty-day { text-align: center; color: var(--text-2); padding: 48px 0; font-size: 15px; }

/* ---------- 底部导航 ---------- */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  display: flex; background: rgba(255, 255, 255, .92); border-top: 1px solid #F0EFFE;
  box-shadow: 0 -4px 24px rgba(109, 40, 217, .10);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.bottom-nav .nav-item {
  flex: 1; text-align: center; padding: 9px 0 7px; font-size: 12px; color: var(--text-2); cursor: pointer;
  transition: color .15s;
}
.bottom-nav .nav-item .ico { font-size: 21px; display: block; margin-bottom: 2px; }
.bottom-nav .nav-item.active { color: var(--primary); font-weight: 700; }

/* ---------- 弹窗（确认选课 / 退选） ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(31, 41, 55, .45); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.dialog {
  width: 100%; max-width: 480px; background: #fff; border-radius: 22px 22px 0 0;
  padding: 24px 20px calc(20px + env(safe-area-inset-bottom)); animation: slideUp .22s ease;
  max-height: 86vh; overflow: auto;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.dialog-title { font-size: 18px; font-weight: 700; text-align: center; margin-bottom: 14px; letter-spacing: .01em; }
.dialog-body { font-size: 15px; color: var(--text); line-height: 1.9; background: var(--bg); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.dialog-btns { display: flex; gap: 12px; }
.dialog-btns .btn { flex: 1; }
/* 选课预占倒计时条（确认弹窗内） */
.hold-countdown { font-size: 13px; color: #B45309; background: #FEF3C7; border-radius: 10px; padding: 7px 12px; margin: -8px 0 14px; text-align: center; }
.hold-countdown b { font-variant-numeric: tabular-nums; font-size: 15px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%); z-index: 99;
  padding: 12px 22px; border-radius: 999px; color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.20); max-width: 86%; text-align: center;
  animation: toastIn .25s ease;
}
.toast.success { background: linear-gradient(135deg, var(--primary-deep), var(--primary-2)); }
.toast.error { background: linear-gradient(135deg, #DC2626, #F87171); }
@keyframes toastIn { from { transform: translate(-50%, -10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- 学生选择（多子女） ---------- */
.student-item {
  display: flex; align-items: center; gap: 14px; background: #fff; border-radius: var(--radius);
  padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow-md); border: var(--card-border); cursor: pointer;
  transition: transform .12s;
}
.student-item:active { transform: scale(.98); }
.student-item .avatar {
  width: 48px; height: 48px; border-radius: 50%; color: #fff; font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-deep), var(--primary-2)); flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(109, 40, 217, .30);
}
.student-item .nm { font-size: 17px; font-weight: 700; }
.student-item .cl { font-size: 13px; color: var(--text-2); margin-top: 3px; }

/* 记录页 */
.record-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 2px; border-bottom: 1px solid #F3F0FF; font-size: 15px; }
.record-row:last-child { border-bottom: none; }
.record-row .day { color: var(--text-2); width: 64px; flex-shrink: 0; }
.record-row .cname { flex: 1; font-weight: 600; }
.record-row .cname .sub { display: block; font-size: 12px; color: var(--text-2); font-weight: 400; margin-top: 2px; }
.record-row .none { color: #C0C4CC; font-weight: 400; }
.link-btn { color: var(--danger); font-size: 13px; cursor: pointer; border: 1px solid #FECACA; border-radius: 10px; padding: 5px 10px; background: #fff; transition: background .15s; }
.link-btn:active { background: #FEF2F2; }

/* ---------- 背景设置弹窗 ---------- */
.bg-section { margin-bottom: 18px; text-align: left; }
.bg-label { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 10px; }
.bg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bg-swatch {
  height: 62px; border-radius: 14px; cursor: pointer; position: relative;
  border: 2px solid rgba(124, 58, 237, .12); transition: transform .12s, border-color .15s;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.bg-swatch:active { transform: scale(.96); }
.bg-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, .20); color: var(--primary); }
.bg-row { display: flex; gap: 10px; align-items: center; }
.bg-row .input { height: 46px; }
.bg-color-input {
  width: 56px; height: 46px; padding: 4px; border: 1.5px solid #E5E7EB; border-radius: 12px;
  background: #fff; cursor: pointer; flex-shrink: 0;
}

/* ---------- 页脚（ICP 备案号：按规定在页面底部展示并链接工信部） ---------- */
.site-footer {
  padding: 22px 16px 92px; /* 底部留白避开固定底部导航（约 71px 高） */
  text-align: center; font-size: 12px; line-height: 1.9; color: var(--text-2);
}
.site-footer a {
  color: var(--text-2); text-decoration: none; opacity: .85;
  transition: color .15s, opacity .15s;
}
.site-footer a:hover, .site-footer a:active {
  color: var(--primary); opacity: 1; text-decoration: underline;
}
