/* 教师评价墙 — 前端样式（移动端 + 电脑版，一套代码响应式） */

/* 关键：.alert / .detail 等设置了 display，会盖掉 hidden 属性的默认隐藏效果 */
[hidden] { display: none !important; }

:root {
  --bg: #F4F7F6;
  --surface: #FFFFFF;
  --surface-2: #F0F4F2;
  --text: #16211D;
  --text-muted: #5B6B64;
  --border: rgba(22, 33, 29, 0.12);
  --brand: #0FA968;
  --brand-soft: #E4F7EE;
  --brand-text: #04543A;
  --brand-on: #FFFFFF;
  --danger: #D93B30;
  --radius: 10px;
  --radius-card: 16px;
  --radius-full: 999px;
  --shadow: 0 2px 10px rgba(22, 33, 29, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

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

.title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---------- 提示条 ---------- */

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px;
  padding: 12px 16px;
  border: 1px solid rgba(217, 59, 48, 0.3);
  border-radius: var(--radius);
  background: rgba(217, 59, 48, 0.08);
  color: var(--danger);
  font-size: 14px;
}

.alert-btn {
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: transparent;
  color: var(--danger);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- 卡片墙 ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.card-action {
  flex: none;
  padding: 9px 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-on);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.card-action:hover { opacity: 0.88; }

.card:hover { border-color: var(--brand); }

.card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft), var(--shadow);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.card-name {
  font-size: 17px;
  font-weight: 600;
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  line-height: 18px;
}

.badge-strong {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.card-score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.card-avg {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.card-avg.is-empty {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
}

.card-count {
  font-size: 13px;
  color: var(--text-muted);
}

.card-quote {
  padding: 8px 12px;
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- 遮罩 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(10, 20, 16, 0.4);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.overlay.open { opacity: 1; }

/* ---------- 详情面板（移动端：底部抽屉） ---------- */

.detail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  max-height: 88vh;
  overflow-y: auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.16);
  transform: translateY(100%);
  transition: transform 0.28s ease;
}

.detail.open { transform: translateY(0); }

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.detail-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.detail-meta {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.detail-body { margin-top: 16px; }

.block {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
}

.block:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.block-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}

/* 打分按钮：每个 5 个一行，1-10 自动排成两排 */
.score-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.score-pad button {
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.score-pad button:hover { border-color: var(--brand); }

.score-pad button.sel {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-on);
  font-weight: 600;
}

.field {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
}

.field:focus { border-color: var(--brand); background: var(--surface); }

.field.area {
  resize: vertical;
  min-height: 72px;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--brand-on);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.msg {
  margin: 10px 0 0;
  font-size: 13px;
}

.msg.is-error { color: var(--danger); }
.msg.is-ok { color: var(--brand-text); }

/* ---------- 查看模式列表 ---------- */

.view-avg {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.view-avg.is-empty {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

.view-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-item {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.view-badge {
  display: inline-block;
  margin-bottom: 4px;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 12px;
  font-weight: 600;
}

.view-text {
  margin: 0;
  font-size: 14px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.view-time {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.view-empty {
  margin: 0;
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
}

/* ---------- 电脑版 ---------- */

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 16px; padding: 24px; }
}

@media (min-width: 960px) {
  .grid { grid-template-columns: repeat(3, 1fr); }

  .detail {
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    width: 400px;
    max-height: none;
    padding: 20px;
    border-radius: 0;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
  }

  .detail.open { transform: translateX(0); }
}

@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}
