/* ==================================================================
 * 空教室查询 —— 样式（/kt/ 子目录版）
 *
 * 相比独立站版本，本文件做了两处清理：
 *   1. 删除已废弃的登录页样式（零登录版已无登录入口）；
 *   2. 删除历史遗留的第三方推广样式 —— 备案性质为非经营性，
 *      不得有任何收费或引流内容。
 * ================================================================== */

:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --line: #e8e9f0;
  --text: #1c1d27;
  --text-2: #6b6f80;
  --text-3: #9aa0b4;
  --brand: #7c3aed;
  --brand-2: #a855f7;
  --brand-soft: #f3eefe;
  --free: #16a34a;
  --free-bg: #e9f8ef;
  --busy: #ef4444;
  --busy-bg: #fdeaea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 45, .04), 0 8px 24px -12px rgba(20, 20, 45, .12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

button { font-family: inherit; cursor: pointer; border: none; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 11px; min-width: 0; }
.topbar-title { font-size: 15px; font-weight: 650; }
.topbar-term { font-size: 11.5px; color: var(--text-3); }

/* 返回主页：子目录页面里 / 就是 ixili.top 首页 */
.back {
  width: 34px; height: 34px; flex: none;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 21px; font-weight: 600; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: background .15s;
}
.back:hover { background: #e9e0fd; }

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 13px 0 12px; padding: 11px 13px;
}
.nav {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--brand-soft); color: var(--brand);
  font-size: 19px; line-height: 1; font-weight: 600;
  transition: background .15s;
}
.nav:hover { background: #e9e0fd; }

#date-picker {
  height: 36px; padding: 0 11px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fbfbfd; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none;
}
#date-picker:focus { border-color: var(--brand); background: #fff; }

#campus-select {
  height: 36px; padding: 0 10px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fbfbfd; color: var(--text);
  font-size: 13.5px; font-family: inherit; outline: none;
  max-width: 150px;
}
#campus-select:focus { border-color: var(--brand); background: #fff; }

.chip {
  height: 36px; padding: 0 14px; border-radius: 10px;
  background: #f2f3f8; color: var(--text-2); font-size: 13px;
  transition: background .15s, color .15s;
}
.chip:hover { background: #e8e9f1; color: var(--text); }

.week-chip {
  margin-left: auto; padding: 6px 13px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}

/* ---------------- 概览 ---------------- */
.summary { padding: 0 3px 11px; font-size: 13px; color: var(--text-2); }
.summary b { color: var(--free); font-weight: 650; }
.summary .warn { color: #d97706; }

/* ---------------- 图例 ---------------- */
.legend {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 0 3px 10px; font-size: 12.5px; color: var(--text-2);
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 3.5px; display: inline-block; }
.dot.free { background: var(--free); }
.dot.busy { background: var(--busy); }
.legend-hint { margin-left: auto; color: var(--text-3); font-size: 11.5px; }

/* ---------------- 网格 ---------------- */
.grid-wrap { overflow: hidden; }
.grid-host { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 720px; }

table.grid th, table.grid td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0; font-size: 12px; text-align: center;
}
table.grid th:last-child, table.grid td:last-child { border-right: none; }
table.grid tr:last-child td { border-bottom: none; }

table.grid thead th {
  position: sticky; top: 0; z-index: 5;
  background: #fafafd; color: var(--text-2);
  font-weight: 600; font-size: 11.5px;
  height: 40px; padding: 4px 6px; white-space: nowrap;
}
table.grid thead th small { display: block; font-weight: 400; font-size: 10px; color: var(--text-3); }

table.grid th.room-col, table.grid td.room-col {
  position: sticky; left: 0; z-index: 4;
  background: #fff; text-align: left;
  padding: 8px 12px; min-width: 168px; max-width: 220px;
  font-size: 12.5px; color: var(--text);
}
table.grid thead th.room-col { z-index: 6; background: #fafafd; }
td.room-col .rn { font-weight: 550; }
td.room-col .rb { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

td.slot { height: 30px; cursor: default; }
td.slot.free { background: var(--free-bg); color: var(--free); font-size: 13px; font-weight: 700; }
td.slot.busy { background: var(--busy-bg); color: var(--busy); font-size: 12px; }
td.slot.na   { background: #fafafb; color: #d5d7e0; }

tr.room-row.hl td.slot.free { background: #d5f2e2; }
tr.room-row.dim { opacity: .28; }

.empty-state { padding: 54px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.loading {
  padding: 54px 20px; text-align: center; color: var(--text-3); font-size: 13.5px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
}
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 筛选 ---------------- */
.filters { display: flex; gap: 8px; margin-top: 12px; }
#room-filter {
  flex: 1; height: 38px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); font-size: 13.5px;
  font-family: inherit; outline: none;
}
#room-filter:focus { border-color: var(--brand); box-shadow: 0 0 0 3.5px rgba(124, 58, 237, .1); }

/* ---------------- 提示条 ---------------- */
.notice {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

/* ---------------- 数据更新时间说明条 ---------------- */
.datastamp {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--brand-soft);
  border: 1px solid #e2d6fb;
}
.datastamp-ico {
  flex: none;
  color: var(--brand);
  font-size: 15px;
  line-height: 1.5;
}
.datastamp-body { min-width: 0; }
.datastamp-body b {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: #5b21b6;
}
.datastamp-body em {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11.5px;
  line-height: 1.6;
  color: #7c6ba8;
}

/* ---------------- 催更新（展示邮箱 + 一键复制） ---------------- */
.contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 14px 16px;
}
.contact-text { min-width: 0; flex: 1; }
.contact-text b { display: block; font-size: 14px; font-weight: 650; }
.contact-text em {
  display: block;
  margin-top: 3px;
  font-style: normal;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.contact-btn {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 16px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 8px 20px -12px rgba(124, 58, 237, .9);
  transition: transform .12s, filter .16s;
}
.contact-btn:hover { filter: brightness(1.06); }
.contact-btn:active { transform: scale(.98); }
.contact-btn span {
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: .2px;
  word-break: break-all;
}
.contact-btn small { font-size: 10.5px; color: rgba(255, 255, 255, .82); }
.contact-btn.done { background: linear-gradient(135deg, #16a34a, #22c55e); }
.contact-btn.fail { background: linear-gradient(135deg, #d97706, #f59e0b); }

/* ---------------- 页脚 ---------------- */
.site-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.site-footer .fineprint {
  margin: 0;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.6;
}

/* 备案号：依工信部要求必须展示，但不做成醒目的超链接，只作一行浅灰小字 */
.site-footer .icp-text {
  margin: 6px 0 0;
  font-size: 11px;
  color: #b6bac9;
  letter-spacing: .2px;
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .wrap { padding: 0 10px 22px; }
  .week-chip { margin-left: 0; width: 100%; text-align: center; }
  .legend-hint { display: none; }
  table.grid th.room-col, table.grid td.room-col { min-width: 132px; padding: 7px 9px; }

  .datastamp { padding: 10px 12px; gap: 9px; }
  .datastamp-body b { font-size: 12.5px; }
  .datastamp-body em { font-size: 11px; }

  .contact { flex-direction: column; align-items: stretch; gap: 11px; padding: 13px 14px; }
  .contact-btn { width: 100%; }
}
