/* ============================================================
   课表页样式：网格、单元格、走班拆分、锁定、拖拽、浮层、年级总表
   依赖 css/app.css 的全局基调（浅色、#2F5597、圆角6px、边框#e2e6ee）
   ============================================================ */

/* ---------- 工具栏 ---------- */
.tt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
}
.tt-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #3a4354;
  white-space: nowrap;
}
.tt-toolbar select {
  padding: 5px 8px;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
  max-width: 220px;
}
.tt-toolbar button {
  padding: 5px 10px;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  background: #fff;
  color: #3a4354;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.tt-toolbar button:hover { border-color: #2F5597; color: #2F5597; }
.tt-toolbar button:disabled { opacity: .5; cursor: not-allowed; }
.tt-toolbar button.danger { color: #b3312f; }
.tt-toolbar button.danger:hover { border-color: #b3312f; }
.tt-spacer { flex: 1; }

/* 视图切换（班级/教师/年级总表） */
.tt-views {
  display: inline-flex;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  overflow: hidden;
}
.tt-views button {
  border: none;
  border-radius: 0;
  border-left: 1px solid #e2e6ee;
  padding: 6px 14px;
  background: #fff;
  color: #3a4354;
  font-size: 13px;
  cursor: pointer;
}
.tt-views button:first-child { border-left: none; }
.tt-views button.active { background: #2F5597; color: #fff; }

/* ---------- 单元（一个班/一位教师一张表） ---------- */
.tt-unit { margin-bottom: 26px; }
.tt-unit-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #2F5597;
}
.tt-scroll { overflow-x: auto; }

/* ---------- 课表网格 ---------- */
table.tt-grid {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
  background: #fff;
}
.tt-grid th, .tt-grid td {
  border: 1px solid #e2e6ee;
  vertical-align: top;
}
.tt-grid thead th {
  background: #f4f6fb;
  color: #3a4354;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 4px;
  text-align: center;
}
.tt-seg-col  { width: 34px; }
.tt-th-period { width: 40px; }

/* 时段列（上午/下午/晚间，竖排文字） */
th.tt-seg {
  background: #f4f6fb;
  color: #2F5597;
  font-weight: 600;
  font-size: 13px;
  writing-mode: vertical-lr;
  letter-spacing: 6px;
  text-align: center;
  vertical-align: middle;
  padding: 6px 0;
}
/* 节次列 */
th.tt-period {
  background: #fafbfe;
  color: #6b7486;
  font-weight: 500;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
}
/* 上午/下午/晚间分界：加粗分隔线 */
tr.tt-seg-start > th, tr.tt-seg-start > td { border-top: 2px solid #93a0b6; }

/* ---------- 单元格 ---------- */
td.tt-cell { padding: 3px; }
.tt-cellbox {
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.tt-empty {
  color: #c3c9d4;
  text-align: center;
  font-size: 13px;
  user-select: none;
}

/* 课程项 */
.tt-item {
  position: relative;
  border-radius: 6px;
  padding: 4px 6px;
  line-height: 1.3;
  cursor: pointer;
}
.tt-item[draggable="true"] { cursor: grab; }
.tt-item[draggable="true"]:active { cursor: grabbing; }
.tt-course { font-weight: 700; font-size: 13px; color: #1f2937; }
.tt-sub    { font-size: 11px; color: #8a93a5; }

/* 走班拆分项：浅蓝背景 + 组标签小字，多项目上下排（由 .tt-cellbox 纵向排列） */
.tt-item.tt-walk {
  background: #e8f1fb;
  border: 1px solid #d3e2f6;
}
.tt-tag { font-size: 10px; color: #4a76b8; margin-top: 1px; }

/* 派生自习：灰底灰字，不可拖 */
.tt-item.tt-study {
  background: #f0f1f4;
  border: 1px dashed #d8dce4;
  cursor: default;
}
.tt-study .tt-course { color: #9aa1af; font-weight: 600; }
.tt-study .tt-sub, .tt-study .tt-tag { color: #b3b9c4; }

/* 锁定：右上角 🔒 */
.tt-lock {
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

/* ---------- 拖拽状态 ---------- */
.tt-dragging { opacity: .35; }
td.tt-cell.drop-ok {
  outline: 2px solid #34a853;
  outline-offset: -2px;
  background: #f0faf2;
}
td.tt-cell.drop-bad {
  outline: 2px solid #d64545;
  outline-offset: -2px;
  background: #fdf2f2;
}

/* ---------- 单元格浮层 ---------- */
.tt-popover {
  position: fixed;
  z-index: 1000;
  width: 264px;
  background: #fff;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(31, 41, 55, .16);
  padding: 10px 12px;
  font-size: 13px;
  color: #3a4354;
}
.tt-pop-head { font-weight: 600; color: #2F5597; margin-bottom: 4px; }
.tt-pop-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid #eef1f6;
}
.tt-pop-course { font-weight: 700; color: #1f2937; }
.tt-pop-walkflag {
  display: inline-block;
  margin-left: 6px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 400;
  color: #4a76b8;
  background: #e8f1fb;
  border-radius: 4px;
  vertical-align: 1px;
}
.tt-pop-meta { font-size: 12px; color: #6b7486; margin-top: 2px; }
.tt-pop-lock {
  flex: none;
  padding: 3px 10px;
  border: 1px solid #e2e6ee;
  border-radius: 6px;
  background: #fff;
  color: #2F5597;
  font-size: 12px;
  cursor: pointer;
}
.tt-pop-lock:hover { border-color: #2F5597; }
.tt-pop-note {
  margin-top: 8px;
  padding: 6px 8px;
  font-size: 12px;
  color: #8a6d1a;
  background: #fdf6e3;
  border-radius: 6px;
}

/* ---------- 年级总表（行=班级，列=天×节，只读） ---------- */
table.tt-grade { table-layout: auto; font-size: 11px; }
.tt-grade thead th { padding: 5px 3px; font-size: 12px; }
.tt-grade th.tt-gr-p { min-width: 42px; font-weight: 500; color: #6b7486; }
.tt-grade th.tt-gr-class {
  background: #f4f6fb;
  color: #2F5597;
  font-weight: 600;
  white-space: nowrap;
  padding: 4px 8px;
  position: sticky;
  left: 0;
  z-index: 2;
}
.tt-grade td {
  padding: 3px 4px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.tt-grade td.tt-gr-empty { color: #d0d5de; }

/* ---------- 加载与空状态 ---------- */
.tt-loading, .tt-page-empty {
  padding: 48px 16px;
  text-align: center;
  color: #8a93a5;
  background: #fff;
  border: 1px dashed #e2e6ee;
  border-radius: 6px;
}
