/* ================================================================
 * 杨师读书 · 教师后台 · 全局样式
 * 与小程序保持青绿主题统一，以现代企业 dashboard 风格呈现
 * ================================================================ */

:root {
  --primary:        #4A9B86;
  --primary-deep:   #3A7F6E;
  --primary-soft:   #E8F3EE;
  --primary-tint:   #F2F8F6;

  --bg-page:        #FAF8F4;
  --bg-tint:        #F7F5F1;
  --bg-card:        #FFFFFF;

  --text-main:      #1F3A36;
  --text-sub:       #6B7A78;
  --text-mute:      #A0AEB0;

  --border:         #E5EAE9;
  --border-soft:    #EFF2F1;

  --shadow-soft:    0 4px 24px rgba(31, 58, 54, 0.06);
  --shadow-card:    0 8px 32px rgba(74, 155, 134, 0.12);
  --shadow-modal:   0 24px 80px rgba(0, 0, 0, 0.18);

  --radius:         16px;
  --radius-sm:      12px;
  --radius-xs:      8px;

  --green:          #2E8B57;
  --green-soft:     #E8F3EE;
  --yellow:         #B8860B;
  --yellow-soft:    #FFF4E0;
  --red:            #C0392B;
  --red-soft:       #FBEAEA;
  --purple:         #6B4D9B;
  --purple-soft:    #EFE7F5;
}

/* ===== Reset / 基础 ===== */

*, *::before, *::after {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.font-serif {
  font-family: "Source Han Serif SC", "Songti SC", "STSong",
    "SimSun", "Noto Serif SC", serif;
}
.text-mute { color: var(--text-mute); }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== 启动占位 ===== */

.boot-loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-mute);
}
.boot-loading__logo {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  opacity: 0.85;
}

/* ===== 按钮 ===== */

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 24px;
  height: 44px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  transition: opacity 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 4px 12px rgba(74, 155, 134, 0.25);
}
.btn-primary:hover { opacity: 0.92; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 0 18px;
  height: 40px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
}
.btn-outline:hover { background: var(--primary-soft); }

.btn-ghost {
  background: transparent;
  color: var(--text-sub);
  border: none;
  padding: 0 12px;
  height: 32px;
  font-size: 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.btn-ghost:hover { background: var(--bg-tint); color: var(--text-main); }

/* ===== 输入框 ===== */

.field {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s;
  margin-bottom: 8px;
}
.field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(74, 155, 134, 0.1);
}
.field.is-error { border-color: var(--red); }
.field__icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mute);
  margin-right: 12px;
}
.field__input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--text-main);
  background: transparent;
  height: 100%;
}
.field__input::placeholder { color: var(--text-mute); }

/* ===== 登录页 ===== */

.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg-page);
  overflow: hidden;
}
.login-deco {
  position: absolute;
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 70%);
  opacity: 0.55;
  pointer-events: none;
  filter: blur(10px);
}
.login-deco--left { top: -160px; left: -160px; }
.login-deco--right { bottom: -160px; right: -160px; }

.login-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow-card);
  padding: 56px 56px 40px;
  text-align: center;
}
.login-logo {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  margin: 0 auto 24px;
  display: block;
  object-fit: cover;
}
.login-title {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 12px;
  padding-left: 12px;
}
.login-sub {
  font-size: 14px;
  color: var(--text-sub);
  letter-spacing: 3px;
  margin-top: 8px;
}
.login-divider {
  position: relative;
  margin: 28px 0 24px;
  color: var(--primary);
  font-size: 18px;
  line-height: 1;
  height: 18px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 38%;
  height: 1px;
  background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }
.login-divider span {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 0 12px;
}

.login-btn {
  width: 100%;
  height: 52px;
  margin-top: 4px;
  font-size: 16px;
  letter-spacing: 6px;
}
.login-error {
  color: var(--red);
  font-size: 13px;
  margin: 4px 4px 8px;
  text-align: left;
}
.login-tip {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 1px;
}

/* ===== 记录页 ===== */

.records-page {
  min-height: 100vh;
  background: var(--bg-tint);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar__logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}
.topbar__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 2px;
}
.topbar__title-sub {
  font-size: 14px;
  color: var(--text-sub);
  margin-left: 4px;
  letter-spacing: 1px;
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-sub);
  font-size: 14px;
}
.topbar__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.topbar__hello { color: var(--text-main); font-weight: 500; }

.main {
  padding: 32px 48px;
  max-width: 1400px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-head__title {
  font-size: 30px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 4px;
}
.page-head__sub {
  font-size: 14px;
  color: var(--text-sub);
  margin-top: 6px;
  letter-spacing: 1px;
}
.page-head__badge {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 16px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
}

/* ===== 筛选条 ===== */

.filter-bar {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar__input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.filter-bar__search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-mute);
  pointer-events: none;
}
.filter-bar__search {
  height: 40px;
  width: 260px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
}
.filter-bar__search:focus { border-color: var(--primary); }
.filter-bar select {
  height: 40px;
  padding: 0 30px 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7A78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>")
    no-repeat right 10px center;
  font-size: 14px;
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 0.15s;
}
.filter-bar select:focus { border-color: var(--primary); }
.filter-bar__spacer { flex: 1; }

/* ===== 表格 ===== */

.table-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.table-card table {
  width: 100%;
  border-collapse: collapse;
}
.table-card thead th {
  background: var(--primary-tint);
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  letter-spacing: 1px;
}
.table-card tbody td {
  padding: 16px 20px;
  font-size: 14px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-soft);
}
.table-card tbody tr:last-child td { border-bottom: none; }
.table-card tbody tr {
  transition: background 0.15s;
}
.table-card tbody tr:hover { background: var(--bg-tint); }

.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
}
.chip--green  { background: var(--green-soft);  color: var(--green);  }
.chip--yellow { background: var(--yellow-soft); color: var(--yellow); }
.chip--red    { background: var(--red-soft);    color: var(--red);    }

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
}
.pill--primary { background: var(--primary);      color: #fff;            }
.pill--purple  { background: var(--purple-soft);  color: var(--purple);   }
.pill--gray    { background: #EEEEEE;             color: #888888;         }
.pill--outline {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.link {
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s;
}
.link:hover { color: var(--primary-deep); text-decoration: underline; }

/* ===== 分页 ===== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
  gap: 12px;
}
.pagination__info {
  color: var(--text-sub);
  font-size: 13px;
}
.pagination__pages {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pagination__btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.pagination__btn:hover:not(.is-active):not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}
.pagination__btn.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination__ellipsis {
  padding: 0 4px;
  color: var(--text-mute);
}

/* ===== 加载 / 空状态 ===== */

.loading-row, .empty-row {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
  font-size: 14px;
}
.empty-row .btn-ghost {
  margin-left: 12px;
  color: var(--primary);
}

/* ===== 弹层 ===== */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(31, 58, 54, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 40px 20px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease-out;
}
.modal {
  width: 100%;
  max-width: 880px;
  max-height: 85vh;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.modal__title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 2px;
}
.modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-mute);
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal__close:hover { background: var(--bg-tint); color: var(--text-main); }
.modal__body {
  flex: 1;
  overflow-y: auto;
}
.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 36px;
  border-top: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.detail-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 36px;
  background: var(--primary-tint);
  gap: 24px;
}
.detail-summary__left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-summary__name {
  font-size: 30px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 2px;
}
.detail-summary__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-summary__meta {
  font-size: 13px;
  color: var(--text-sub);
}
.detail-summary__score {
  font-size: 64px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.detail-summary__suffix {
  font-size: 18px;
  color: var(--text-mute);
  margin-left: 4px;
  font-weight: 500;
}
.detail-summary__stat {
  text-align: right;
  font-size: 13px;
  color: var(--text-sub);
  margin-top: 8px;
}

.detail-table-title {
  padding: 24px 36px 12px;
  font-size: 16px;
  font-weight: 500;
  color: var(--text-main);
  letter-spacing: 1px;
}
.detail-table {
  width: calc(100% - 72px);
  margin: 0 36px 28px;
  border-collapse: collapse;
}
.detail-table thead th {
  background: var(--bg-tint);
  text-align: left;
  font-size: 12px;
  color: var(--text-sub);
  padding: 10px 14px;
  font-weight: 500;
  border-bottom: 1px solid var(--border-soft);
}
.detail-table tbody td {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-soft);
}
.detail-table tbody tr:last-child td { border-bottom: none; }
.detail-table tbody tr.is-wrong { background: var(--red-soft); }
.detail-table tbody tr.is-wrong:hover { background: #F5D8D5; }
.detail-table tbody tr:not(.is-wrong):hover { background: var(--bg-tint); }
.detail-table .star { color: var(--primary); letter-spacing: 1px; }
.detail-table .res-ok  { color: var(--green); font-weight: 500; }
.detail-table .res-err { color: var(--red);   font-weight: 500; }

/* ===== 响应式 ===== */

@media (max-width: 960px) {
  .main { padding: 24px 20px; }
  .topbar { padding: 0 20px; }
  .topbar__title-sub { display: none; }
  .filter-bar__search { width: 100%; }
  .filter-bar { flex-wrap: wrap; }
  .filter-bar select { flex: 1 1 calc(50% - 6px); min-width: 0; }
  .filter-bar__spacer { display: none; }
  .filter-bar .btn-outline { width: 100%; justify-content: center; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  .login-card { padding: 40px 28px 32px; }
  .login-title { font-size: 26px; letter-spacing: 8px; padding-left: 8px; }
  .detail-summary {
    flex-direction: column;
    align-items: flex-start;
  }
  .detail-summary__score { text-align: left; font-size: 52px; }
  .detail-summary__stat  { text-align: left; }
  .table-card { font-size: 13px; }
  .table-card thead th,
  .table-card tbody td { padding: 12px 10px; }
}
