/* 课程表工具样式 — BEM 前缀 tt- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --tt-bg: #f5f7fb;
  --tt-panel: #ffffff;
  --tt-ink: #1f2937;
  --tt-muted: #6b7280;
  --tt-line: #e5e7eb;
  --tt-line-strong: #d1d5db;
  --tt-primary: #2563eb;
  --tt-primary-dark: #1d4ed8;
  --tt-success: #059669;
  --tt-danger: #dc2626;
  --tt-warning: #d97706;
  --tt-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  --tt-radius: 10px;
}

.tt-body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--tt-bg);
  color: var(--tt-ink);
  min-height: 100vh;
}

.tt-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 顶栏 */
.tt-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--tt-panel);
  border-bottom: 1px solid var(--tt-line);
  gap: 16px;
  flex-wrap: wrap;
}

.tt-topbar__left,
.tt-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tt-topbar__class-name {
  font-size: 16px;
  font-weight: 600;
  border: 1px dashed transparent;
  padding: 6px 10px;
  border-radius: 6px;
  background: transparent;
  min-width: 200px;
  color: var(--tt-ink);
}
.tt-topbar__class-name:hover,
.tt-topbar__class-name:focus {
  border-color: var(--tt-line);
  outline: none;
  background: var(--tt-bg);
}

.tt-topbar__save-tip {
  font-size: 12px;
  color: var(--tt-muted);
}

.tt-chip {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--tt-bg);
  color: var(--tt-muted);
  border: 1px solid var(--tt-line);
  cursor: default;
}
.tt-chip--button {
  cursor: pointer;
  background: var(--tt-primary);
  color: #fff;
  border-color: var(--tt-primary);
}
.tt-chip--button:hover {
  background: var(--tt-primary-dark);
}
.tt-chip--ghost {
  cursor: pointer;
  background: var(--tt-panel);
  color: var(--tt-primary);
  border-color: var(--tt-primary);
}

/* 视图切换 + 周次导航条 */
.tt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: var(--tt-panel);
  border-bottom: 1px solid var(--tt-line);
}
.tt-toolbar__group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tt-toolbar__divider {
  width: 1px;
  height: 22px;
  background: var(--tt-line);
}
.tt-toolbar__label {
  font-size: 13px;
  color: var(--tt-muted);
}

.tt-tabs {
  display: inline-flex;
  background: var(--tt-bg);
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--tt-line);
}
.tt-tab {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  color: var(--tt-muted);
}
.tt-tab[aria-selected="true"] {
  background: var(--tt-primary);
  color: #fff;
}

.tt-btn {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--tt-panel);
  border: 1px solid var(--tt-line);
  color: var(--tt-ink);
  cursor: pointer;
}
.tt-btn:hover {
  border-color: var(--tt-primary);
  color: var(--tt-primary);
}
.tt-btn--primary {
  background: var(--tt-primary);
  color: #fff;
  border-color: var(--tt-primary);
}
.tt-btn--primary:hover {
  background: var(--tt-primary-dark);
  color: #fff;
  border-color: var(--tt-primary-dark);
}
.tt-btn--ghost {
  color: var(--tt-primary);
  border-color: var(--tt-primary);
}
.tt-btn--danger {
  color: var(--tt-danger);
  border-color: #fecaca;
}
.tt-btn--block {
  display: block;
  width: 100%;
}
.tt-btn--small {
  padding: 4px 10px;
  font-size: 12px;
}

.tt-week-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tt-week-nav__display {
  font-weight: 600;
  font-size: 14px;
  min-width: 100px;
  text-align: center;
}

.tt-spacer {
  flex: 1;
}

/* 主体 */
.tt-main {
  flex: 1;
  padding: 18px 24px;
  overflow: auto;
}

/* 表格视图（周/日） */
.tt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--tt-panel);
  border: 1px solid var(--tt-line);
  border-radius: var(--tt-radius);
  overflow: hidden;
  table-layout: fixed;
}
.tt-table th,
.tt-table td {
  border-right: 1px solid var(--tt-line);
  border-bottom: 1px solid var(--tt-line);
  padding: 0;
  vertical-align: top;
}
.tt-table th:last-child,
.tt-table td:last-child {
  border-right: 0;
}
.tt-table tr:last-child td {
  border-bottom: 0;
}

.tt-table thead th {
  background: var(--tt-bg);
  font-weight: 600;
  font-size: 13px;
  padding: 8px;
  text-align: center;
}
.tt-table thead th .tt-day-date {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--tt-muted);
  margin-top: 2px;
}
.tt-table thead th.tt-day--today {
  color: var(--tt-primary);
}

.tt-period-cell {
  background: var(--tt-bg);
  width: 110px;
  text-align: center;
  padding: 8px 6px;
}
.tt-period-cell__name {
  font-weight: 600;
  font-size: 13px;
}
.tt-period-cell__time {
  display: block;
  font-size: 11px;
  color: var(--tt-muted);
  margin-top: 2px;
}
.tt-period-cell--break {
  background: #fef3c7;
}
.tt-period-cell--morning,
.tt-period-cell--evening {
  background: #ede9fe;
}

.tt-cell {
  position: relative;
  min-height: 64px;
  padding: 4px;
  cursor: pointer;
}
.tt-cell:hover {
  background: rgba(37, 99, 235, 0.04);
}
.tt-cell--break {
  background: #fafafa;
  cursor: default;
  text-align: center;
  color: var(--tt-muted);
  font-size: 12px;
  padding: 8px;
}
.tt-cell--off {
  background: repeating-linear-gradient(
    45deg,
    #f3f4f6,
    #f3f4f6 8px,
    #fff 8px,
    #fff 16px
  );
  cursor: default;
  font-size: 12px;
  color: var(--tt-muted);
  text-align: center;
  padding: 8px;
}

.tt-course-card {
  display: block;
  border-radius: 8px;
  padding: 6px 8px;
  background: #2563eb;
  color: #fff;
  margin-bottom: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
  border: 0;
  text-align: left;
  width: 100%;
}
.tt-course-card:last-child {
  margin-bottom: 0;
}
.tt-course-card__name {
  font-weight: 600;
  font-size: 13px;
  display: block;
}
.tt-course-card__meta {
  display: block;
  opacity: 0.92;
}
.tt-course-card__badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  margin-left: 4px;
}

/* 列表视图 */
.tt-list {
  background: var(--tt-panel);
  border: 1px solid var(--tt-line);
  border-radius: var(--tt-radius);
  overflow: hidden;
}
.tt-list__group {
  border-bottom: 1px solid var(--tt-line);
}
.tt-list__group:last-child {
  border-bottom: 0;
}
.tt-list__title {
  background: var(--tt-bg);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--tt-muted);
}
.tt-list__row {
  display: grid;
  grid-template-columns: 100px 1fr 160px 100px 80px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--tt-line);
  font-size: 13px;
}
.tt-list__row:first-of-type {
  border-top: 0;
}
.tt-list__row:hover {
  background: rgba(37, 99, 235, 0.03);
}
.tt-list__period {
  color: var(--tt-muted);
  font-size: 12px;
}
.tt-list__name {
  font-weight: 600;
}
.tt-list__color {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.tt-list__empty {
  padding: 30px;
  text-align: center;
  color: var(--tt-muted);
}

/* 月视图 */
.tt-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--tt-line);
  border: 1px solid var(--tt-line);
  border-radius: var(--tt-radius);
  overflow: hidden;
}
.tt-month__head {
  background: var(--tt-bg);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
}
.tt-month__cell {
  background: var(--tt-panel);
  min-height: 100px;
  padding: 6px;
  font-size: 12px;
  cursor: pointer;
}
.tt-month__cell--out {
  background: #fafafa;
  color: var(--tt-muted);
  cursor: default;
}
.tt-month__cell--today {
  background: #eff6ff;
}
.tt-month__cell--off {
  background: repeating-linear-gradient(
    45deg,
    #f3f4f6,
    #f3f4f6 6px,
    #fff 6px,
    #fff 12px
  );
}
.tt-month__date {
  font-weight: 600;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.tt-month__pill {
  display: block;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--tt-primary);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 抽屉/弹窗 */
.tt-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.tt-mask[data-open="1"] {
  opacity: 1;
  pointer-events: auto;
}

.tt-drawer {
  position: fixed;
  top: 0;
  right: -440px;
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  background: var(--tt-panel);
  z-index: 31;
  box-shadow: var(--tt-shadow);
  transition: right 0.2s;
  display: flex;
  flex-direction: column;
}
.tt-drawer[data-open="1"] {
  right: 0;
}
.tt-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--tt-line);
}
.tt-drawer__header h3 {
  margin: 0;
  font-size: 15px;
}
.tt-drawer__close {
  border: 0;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: var(--tt-muted);
}
.tt-drawer__body {
  padding: 16px 18px;
  overflow: auto;
  flex: 1;
}

.tt-section {
  border-top: 1px solid var(--tt-line);
  padding: 14px 0 6px;
}
.tt-section:first-child {
  border-top: 0;
  padding-top: 0;
}
.tt-section__title {
  margin: 0 0 8px;
  font-size: 14px;
}
.tt-section__hint {
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--tt-muted);
}

.tt-form-grid {
  display: grid;
  gap: 10px;
}
.tt-form-grid--2 {
  grid-template-columns: 1fr 1fr;
}
.tt-form-grid--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.tt-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tt-field__label {
  font-size: 12px;
  color: var(--tt-muted);
}
.tt-field input[type="text"],
.tt-field input[type="number"],
.tt-field input[type="date"],
.tt-field input[type="time"],
.tt-field select,
.tt-field textarea {
  border: 1px solid var(--tt-line);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  background: var(--tt-panel);
  color: var(--tt-ink);
  width: 100%;
}
.tt-field textarea {
  resize: vertical;
  min-height: 60px;
}
.tt-field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.tt-period-list,
.tt-holiday-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tt-period-row,
.tt-holiday-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}
.tt-holiday-row {
  grid-template-columns: 1.4fr 1.2fr 1.4fr auto;
}
.tt-period-row input,
.tt-period-row select,
.tt-holiday-row input,
.tt-holiday-row select {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid var(--tt-line);
  border-radius: 4px;
  background: var(--tt-panel);
}

.tt-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tt-color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.tt-color-dot[aria-selected="true"] {
  border-color: var(--tt-ink);
  transform: scale(1.08);
}

.tt-period-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tt-period-pick label {
  border: 1px solid var(--tt-line);
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
  background: var(--tt-bg);
}
.tt-period-pick input {
  margin-right: 4px;
}
.tt-period-pick label:has(input:checked) {
  background: var(--tt-primary);
  color: #fff;
  border-color: var(--tt-primary);
}

/* 历史抽屉 */
.tt-history__empty {
  padding: 24px;
  text-align: center;
  color: var(--tt-muted);
  font-size: 13px;
}
.tt-history__login {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tt-history__btn {
  align-self: center;
  border: 1px solid var(--tt-primary);
  background: var(--tt-panel);
  color: var(--tt-primary);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}
.tt-history__btn--login {
  background: var(--tt-primary);
  color: #fff;
}
.tt-history__item {
  border-top: 1px solid var(--tt-line);
  padding: 10px 0;
}
.tt-history__title {
  font-weight: 600;
  font-size: 13px;
}
.tt-history__meta {
  font-size: 12px;
  color: var(--tt-muted);
  margin-top: 2px;
}
.tt-history__actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

/* 底栏 */
.tt-footer {
  display: flex;
  gap: 14px;
  padding: 8px 24px;
  border-top: 1px solid var(--tt-line);
  background: var(--tt-panel);
  font-size: 12px;
  color: var(--tt-muted);
  align-items: center;
}
.tt-footer__stat strong {
  color: var(--tt-ink);
  font-weight: 600;
  margin-left: 2px;
}
.tt-footer__status {
  margin-left: auto;
}
.tt-footer__status.success {
  color: var(--tt-success);
}
.tt-footer__status.error {
  color: var(--tt-danger);
}

@media (max-width: 720px) {
  .tt-list__row {
    grid-template-columns: 1fr 100px;
  }
  .tt-list__period,
  .tt-list__teacher {
    display: none;
  }
  .tt-period-cell {
    width: 80px;
  }
}
