/* ===== 练习框里的「提交历史」面板 =====
 * 贴着输入框展开，就地看记录；样式跟练习框、结果块保持同一套绿灰配色。
 */

/* 工具栏按钮：跟「运行 / 清空」同高，用蓝色跟绿按钮区分开（那些是跑 SQL，这个是看记录） */
.content .history-btn {
  margin-left: 8px; padding: 7px 12px;
  border: 1px solid #cfdcd4; border-radius: 6px;
  background: #fff; color: #3f6fa8; font-size: 13px; font-weight: 600; cursor: pointer;
}
.content .history-btn:hover { border-color: #a9c3dd; background: #f5f9fd; }
.content .history-btn[aria-expanded="true"] { background: #eef4fb; border-color: #a9c3dd; }

.content .ph-panel {
  margin: 10px 0 4px; border: 1px solid #d5e4da; border-radius: 8px;
  background: #fff; overflow: hidden;
}
.content .ph-head {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  padding: 9px 12px; background: #f7fbf9; border-bottom: 1px solid #eef2ef;
}
.content .ph-title { font-weight: 700; font-size: 13.5px; color: #22503c; }
.content .ph-meta { font-size: 12px; color: #6b7d73; }
.content .ph-tools { margin-left: auto; display: flex; gap: 6px; }
.content .ph-btn {
  padding: 4px 9px; border: 1px solid #cfe0d6; border-radius: 6px;
  background: #fff; color: #2f6b4f; font-size: 12.5px; cursor: pointer;
  font-family: inherit;
}
.content .ph-btn:hover { border-color: #8fc0a6; background: #f6fbf8; }

.content .ph-body { max-height: 460px; overflow: auto; padding: 4px 12px 10px; }
.content .ph-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 4px 0 2px; }
.content .ph-table th, .content .ph-table td {
  border-bottom: 1px solid #eef2ef; padding: 6px 8px; text-align: left; vertical-align: top;
}
.content .ph-table th { background: #fbfdfc; color: #3f574b; font-weight: 600; white-space: nowrap; }
.content .ph-table tr:last-child td { border-bottom: 0; }
.content .ph-dim, .content .ph-time { color: #6b7d73; white-space: nowrap; }
.content .ph-time { font-variant-numeric: tabular-nums; }
.content .ph-note { font-size: 11.5px; color: #8a9a91; }

.content .ph-st { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.content .ph-st.pass { background: #eaf7f0; color: #1f6b45; }
.content .ph-st.bad { background: #fff6e8; color: #8a5a12; }
.content .ph-st.err { background: #fdecec; color: #a33; }
.content .ph-st.none { background: #eef2ef; color: #93a49a; }

.content .ph-sql { max-width: 460px; }
/* 站点全局给 summary 加了 12px/16px 的内边距和底色，表格里要压回一行的高度 */
.content .ph-sql summary {
  padding: 1px 4px; background: transparent; border-radius: 4px;
  cursor: pointer; color: #3f6fa8; font-weight: 400; font-size: 12px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.content .ph-sql summary::before { color: #8aa8c6; font-size: 10px; margin-right: 4px; }
.content .ph-sql details[open] summary { border-bottom: 0; }
.content .ph-sql details > pre { margin-left: 0; margin-right: 0; }
.content .ph-sql pre {
  margin: 6px 0 0; padding: 8px 10px; max-height: 240px; overflow: auto;
  background: #f7f9f8; border: 1px solid #e3e8e4; border-radius: 6px;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.content .ph-empty { padding: 10px 2px; color: #6b7d73; font-size: 12.5px; line-height: 1.6; }
.content .ph-loading { padding: 12px 2px; color: #6b7d73; font-size: 12.5px; }
.content .ph-missing { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; padding: 8px 0 2px; }

/* 教师端：点一行看这个学生这道题的每一次提交 */
.content .ph-table tr.ph-row-link { cursor: pointer; }
.content .ph-table tr.ph-row-link:hover td { background: #f7fbf9; }
.content .ph-cand { margin: 8px 0 2px; border: 1px solid #e3ece7; border-radius: 7px; background: #fcfefd; }
.content .ph-cand-head {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid #eef2ef; font-size: 12.5px; color: #22503c;
}
.content .ph-cand-head .ph-btn { margin-left: auto; }
.content .ph-cand-body { padding: 4px 10px 8px; }
.content .ph-cand-meta { font-size: 11.5px; color: #8a9a91; padding: 4px 0 2px; }
.content .ph-cand-row {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 5px 0; border-bottom: 1px dashed #eef2ef; font-size: 12.5px;
}
.content .ph-cand-row:last-child { border-bottom: 0; }
.content .ph-cand-row details { flex: 1 1 260px; min-width: 0; }
.content .ph-cand-row summary {
  padding: 1px 4px; background: transparent; border-radius: 4px; font-weight: 400;
  font-size: 12px; color: #3f6fa8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.content .ph-cand-row summary::before { color: #8aa8c6; font-size: 10px; margin-right: 4px; }
.content .ph-cand-row details[open] summary { border-bottom: 0; }
.content .ph-cand-row details > pre { margin-left: 0; margin-right: 0; }
.content .ph-cand-row pre {
  margin: 6px 0 0; padding: 8px 10px; max-height: 220px; overflow: auto;
  background: #f7f9f8; border: 1px solid #e3e8e4; border-radius: 6px;
  font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}

@media (max-width: 960px) {
  .content .ph-body { max-height: 320px; padding: 4px 8px 8px; }
  .content .ph-sql { max-width: 220px; }
  .content .ph-table { font-size: 12px; }
  .content .history-btn { margin-left: 0; }
}

/* 手机：表格压成一条条记录，别让人横着拖 */
@media (max-width: 700px) {
  .content .ph-table, .content .ph-table tbody, .content .ph-table tr, .content .ph-table td {
    display: block; width: auto;
  }
  .content .ph-table thead { display: none; }
  .content .ph-table tr {
    border: 1px solid #eef2ef; border-radius: 7px;
    padding: 7px 9px; margin: 7px 0; background: #fdfefd;
  }
  .content .ph-table td { border: 0; padding: 1px 0; white-space: normal; }
  .content .ph-table td[data-label]::before {
    content: attr(data-label) "："; color: #93a49a; font-size: 11.5px;
  }
  .content .ph-table td.ph-time { font-weight: 600; color: #3f574b; }
  .content .ph-table td.ph-sql { max-width: none; margin-top: 3px; }
  .content .ph-table td.ph-sql summary { white-space: normal; }
  .content .ph-head { padding: 8px 10px; }
  .content .ph-tools { margin-left: 0; }
}
