/* 2026-01-04 由 Codex 添加：轻量月历（仅渲染当前月）样式 */

:root {
  /* 2026-01-05 由 Codex 更新：对齐 cal.com 的基础视觉 token（黑白灰 + 更克制的阴影与圆角） */
  --radius: 0.625rem;

  --bg: #fafafa;
  --panel: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --border-soft: rgba(0, 0, 0, 0.06);
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);

  /* 2026-01-05 由 Codex 添加：事件三色体系 */
  --event-sjtu: #c8161e;
  --event-chuangzhi: #023e9b;
  --event-other: #fde69a;

  --week-col-width: 3.75rem;
  --cell-min-height: 86px;

  --seg-autumn: #f1f5ff;
  --seg-spring: #ecfdf5;
  --seg-summer: #fff7ed;
  --seg-break: #f8fafc;

  --badge-holiday-bg: #fee2e2;
  --badge-holiday-text: #b91c1c;
  --badge-special-bg: #ede9fe;
  --badge-special-text: #6d28d9;
  --badge-reg-bg: #dbeafe;
  --badge-reg-text: #1d4ed8;
  --badge-teaching-bg: #dcfce7;
  --badge-teaching-text: #166534;
  --badge-showcase-bg: #ffedd5;
  --badge-showcase-text: #9a3412;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
}

.app-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.app-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-title h1 {
  font-size: 16px;
  margin: 0;
  line-height: 1.25;
}

.app-title p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar__month {
  min-width: 8.5rem;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.toolbar__divider {
  width: 1px;
  height: 26px;
  background: var(--border);
  margin: 0 4px;
}

.toolbar-select {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1;
  box-shadow: var(--shadow);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.toolbar-select:hover {
  background: rgba(0, 0, 0, 0.04);
}

.toolbar-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 60ms ease;
}

.btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12);
}

.btn--icon {
  width: 40px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn--secondary {
  background: transparent;
  box-shadow: none;
}

.app-main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calendar-panel {
  padding: 12px;
}

.course-panel {
  width: 100%;
}

.course-panel__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.calendar-grid {
  display: grid;
  grid-template-columns: var(--week-col-width) repeat(7, minmax(0, 1fr));
}

.cell {
  border-right: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.cell:nth-child(8n) {
  border-right: none;
}

.cell--header {
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  padding: 10px 6px;
  user-select: none;
}

.cell--week {
  background: #f1f5f9;
  color: var(--text);
  font-size: 11px;
  text-align: center;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  user-select: none;
}

.cell--week[data-empty="true"] {
  color: transparent;
}

.day {
  position: relative;
  min-height: var(--cell-min-height);
  padding: 8px 8px 6px;
  background: var(--panel);
  cursor: pointer;
}

.day[data-seg="autumn"] {
  background: var(--seg-autumn);
}
.day[data-seg="spring"] {
  background: var(--seg-spring);
}
.day[data-seg="summer"] {
  background: var(--seg-summer);
}
.day[data-seg="break"] {
  background: var(--seg-break);
}

.day[data-outside="true"] {
  background: #f8fafc;
  color: var(--muted-2);
}

.day__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.day__num {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 13px;
}

.day[data-today="true"] .day__num {
  background: #0ea5e9;
  color: white;
}

.day[data-selected="true"] {
  outline: 2px solid #0ea5e9;
  outline-offset: -2px;
}

.events {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.event-pill {
  font-size: 10px;
  line-height: 1.2;
  padding: 2px 6px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid transparent;
}

.event-pill[data-type="holiday"] {
  background: var(--badge-holiday-bg);
  color: var(--badge-holiday-text);
  border-color: #fecaca;
}

.event-pill[data-type="special"] {
  background: var(--badge-special-bg);
  color: var(--badge-special-text);
  border-color: #ddd6fe;
}

.event-pill[data-type="registration"] {
  background: var(--badge-reg-bg);
  color: var(--badge-reg-text);
  border-color: #bfdbfe;
}

.event-pill[data-type="teaching"] {
  background: var(--badge-teaching-bg);
  color: var(--badge-teaching-text);
  border-color: #bbf7d0;
}

.event-pill[data-type="showcase"] {
  background: var(--badge-showcase-bg);
  color: var(--badge-showcase-text);
  border-color: #fed7aa;
}

.event-pill[data-type="other"] {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}

.info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  padding: 12px;
}

.card h3 {
  margin: 0;
  font-size: 14px;
}

.card__sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list__item {
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
  border-left: 4px solid var(--event-other);
}

.list__item[data-accent="sjtu"] {
  border-left-color: var(--event-sjtu);
}

.list__item[data-accent="chuangzhi"] {
  border-left-color: var(--event-chuangzhi);
}

.list__item[data-accent="other"] {
  border-left-color: var(--event-other);
}

.list__item-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.list__item-dot {
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  background: currentColor;
  flex: 0 0 auto;
}

.list__item[data-accent="sjtu"] .list__item-dot {
  background: var(--event-sjtu);
}

.list__item[data-accent="chuangzhi"] .list__item-dot {
  background: var(--event-chuangzhi);
}

.list__item[data-accent="other"] .list__item-dot {
  background: var(--event-other);
}

.list__item-meta {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.course-table-wrap {
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.course-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.course-table th,
.course-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  white-space: nowrap;
}

.course-table thead th {
  position: sticky;
  top: 0;
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
  font-weight: 800;
  font-size: 11px;
}

.course-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.day-events {
  margin-top: 12px;
  padding: 12px;
}

.day-events__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.day-events__meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  text-align: right;
}
