/* ============================================================
 * 教室課表 — 樣式
 * 沿用站上既有的設計語言（卡片、navy/gold 色系），
 * 另外處理「手機只看一天」的版面。
 * ============================================================ */

.rs-modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.rs-mode {
  font: inherit;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line, #d8dee9);
  background: #fff;
  color: var(--ink-2, #475569);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.rs-mode:hover { border-color: var(--navy, #1e3a5f); color: var(--navy, #1e3a5f); }
.rs-mode.is-active {
  background: var(--navy, #1e3a5f);
  border-color: var(--navy, #1e3a5f);
  color: #fff;
  font-weight: 600;
}

/* ── 教室選擇（下拉選單）───────────────────────
   教室會隨學期增減，用下拉才不會因為教室變多而把版面撐成好幾列。 */
.rs-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.rs-picker-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy, #1e3a5f);
  white-space: nowrap;
}
.rs-select {
  font: inherit;
  font-size: 15px;
  min-width: 190px;
  max-width: 100%;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--line, #d8dee9);
  border-radius: 9px;
  background-color: #fff;
  color: var(--ink, #1f2937);
  cursor: pointer;
  /* 自繪箭頭：各瀏覽器預設外觀差很多，統一畫一個 */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231e3a5f' d='M1.4 1.4 6 6l4.6-4.6L12 2.8 6 8 0 2.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.rs-select:focus {
  outline: none;
  border-color: var(--navy, #1e3a5f);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, .12);
}
.rs-picker-hint {
  font-size: 13px;
  color: #94a3b8;
}
@media (max-width: 520px) {
  .rs-select { flex: 1 1 100%; min-width: 0; }
}

/* ── 工具列 ─────────────────────────────────── */
.rs-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.rs-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-2, #475569);
  cursor: pointer;
}
.rs-now {
  font-size: 13px;
  font-weight: 600;
  color: var(--navy, #1e3a5f);
  background: #eef4fb;
  border-radius: 999px;
  padding: 4px 12px;
}
.rs-now[hidden] { display: none; }

/* ── 課表格線 ───────────────────────────────── */
.rs-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.rs-grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 620px;
  font-size: 13px;
}
.rs-grid th,
.rs-grid td {
  border: 1px solid var(--line, #dde3ec);
  padding: 6px 8px;
  vertical-align: top;
  text-align: left;
}
.rs-grid thead th {
  background: #f4f7fb;
  color: var(--navy, #1e3a5f);
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
}
.rs-grid tbody th {
  background: #f8fafc;
  color: var(--ink-2, #475569);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  width: 74px;
}
.rs-grid td.rs-empty { background: #fff; }

/* 一堂課 */
.rs-course {
  display: block;
  margin-bottom: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  background: #eef4fb;
  border-left: 3px solid var(--navy, #1e3a5f);
  line-height: 1.45;
}
.rs-course:last-child { margin-bottom: 0; }
.rs-course b { display: block; color: var(--navy, #1e3a5f); font-size: 13.5px; }
.rs-course span { display: block; color: #64748b; font-size: 12px; }
.rs-course .rs-cls { color: #0f766e; }

/* 現在這一節：整格加底色 */
.rs-grid td.rs-now {
  background: #fff7e6;
  box-shadow: inset 0 0 0 2px var(--gold, #d4a017);
}

/* 空堂模式 */
.rs-grid td.rs-free { background: #f0fdf4; }
.rs-grid td.rs-free::after {
  content: '空堂';
  color: #15803d;
  font-size: 12px;
  font-weight: 600;
}

/* ── 手機：只看一天 ─────────────────────────── */
.rs-daytabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.rs-daytabs button {
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line, #d8dee9);
  background: #fff;
  cursor: pointer;
}
.rs-daytabs button.is-active {
  background: var(--navy, #1e3a5f);
  border-color: var(--navy, #1e3a5f);
  color: #fff;
  font-weight: 600;
}

@media (max-width: 720px) {
  .rs-grid { min-width: 0; }
  /* 只留選取的那一天 */
  .rs-grid td[data-day]:not(.rs-show),
  .rs-grid th[data-day]:not(.rs-show) { display: none; }
  .rs-grid td.rs-empty::after { content: '空堂'; }
}

/* ── 我的課表 / 搜尋結果 ────────────────────── */
.rs-h3 { margin: 0 0 12px; font-size: 17px; color: var(--navy, #1e3a5f); }
.rs-list { list-style: none; padding: 0; margin: 0; }
.rs-list li {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line, #eef2f7);
  font-size: 14px;
}
.rs-list li:last-child { border-bottom: 0; }
.rs-when {
  flex: 0 0 auto;
  min-width: 116px;
  font-weight: 600;
  color: var(--navy, #1e3a5f);
  font-size: 13px;
}
.rs-what { flex: 1 1 auto; }
.rs-what b { color: var(--ink, #1f2937); }
.rs-what span { display: block; color: #64748b; font-size: 12.5px; margin-top: 2px; }
.rs-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4fb;
  color: var(--navy, #1e3a5f);
  margin-left: 6px;
}
.rs-badge.is-free { background: #f0fdf4; color: #15803d; }
.rs-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2, #475569);
  margin: 18px 0 6px;
  padding-bottom: 6px;
  border-bottom: 2px solid #eef2f7;
}
.rs-group-title:first-child { margin-top: 0; }
.rs-none { color: #94a3b8; font-size: 14px; padding: 8px 0; }

/* ⚠️ 下面這些元素自己有 display 規則，會蓋掉瀏覽器預設的 [hidden] { display: none }。
   沒補這條，未登入／非系辦的人照樣看得到編輯介面（權限 UI 失效）。 */
.rs-manage[hidden],
#mine-picker[hidden] { display: none; }

/* ── 管理員（系辦）才看到的編輯介面 ─────────────────────── */
.rs-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed var(--c-border, #cbd5e1);
  border-radius: 10px;
  background: #f8fafc;
}
.rs-manage-hint { font-size: 13px; color: #475569; }

/* 可編輯的課程格：滑過／聚焦時給明確回饋，右下角加一支小鉛筆 */
.rs-course.rs-editable { cursor: pointer; position: relative; }
.rs-course.rs-editable:hover { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 6px; }
.rs-course.rs-editable:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 6px; }
.rs-course.rs-editable::after {
  content: '✎';
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: 11px;
  line-height: 1;
  color: #2563eb;
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 刪除確認的內文要保留換行 */
#rs-del-text { white-space: pre-line; margin: 6px 0 16px; font-size: 14px; color: #334155; }

/* 我的課表：管理員的老師下拉 */
#mine-picker { margin: 4px 0 14px; }
#mine-picker select { max-width: 320px; }

@media (max-width: 720px) {
  .rs-manage { font-size: 13px; }
  #mine-picker select { max-width: 100%; }
}
