/* 使用系统中文字体，避免 Google Fonts 在国内阻塞首屏 */

/* 对齐主站 kreata：紫系 #5f4bdb / #9b6dff，浅紫底 #f9f3ff→#eef0ff */
:root {
  --teach-ink: #2c2c3a;
  --teach-muted: #6b6685;
  --teach-faint: #9a94b0;
  --teach-line: #ddd6fe;
  --teach-line-soft: #efeaff;
  --teach-surface: rgba(255, 255, 255, 0.9);
  --teach-surface-solid: #ffffff;
  --teach-accent: #5f4bdb;
  --teach-accent-soft: #f0ebff;
  --teach-accent-mid: #9b6dff;
  --teach-accent-deep: #4c3bc4;
  --teach-warn: #e74c3c;
  --teach-ok: #2ecc71;
  --teach-radius: 16px;
  --teach-radius-sm: 12px;
  --teach-pad: 16px;
  --teach-gap: 16px;
  --teach-sidebar: 200px;
  --teach-shadow: 0 8px 24px rgba(95, 75, 219, 0.08);
  --teach-font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

.teach-body {
  margin: 0;
  min-height: 100vh;
  color: var(--teach-ink);
  font-family: var(--teach-font);
  background: linear-gradient(145deg, #f9f3ff 0%, #eef0ff 55%, #f5f3ff 100%);
  background-attachment: fixed;
}

.teach-app--console {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 40px;
  box-sizing: border-box;
}

/* —— Header —— */
.teach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--teach-gap);
  margin-bottom: var(--teach-gap);
  padding: 14px 18px;
  background: var(--teach-surface);
  border: 1px solid rgba(95, 75, 219, 0.14);
  border-radius: 20px;
  box-shadow: var(--teach-shadow);
  backdrop-filter: blur(10px);
}

.teach-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.teach-brand .logo-img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex-shrink: 0;
}

.teach-brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, #9b6dff, #5f4bdb);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.teach-brand p {
  margin: 4px 0 0;
  color: var(--teach-muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.teach-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  flex-shrink: 0;
  background: #f0ebff;
  padding: 6px 12px 6px 14px;
  border-radius: 40px;
}

.teach-role-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 40px;
  background: #5f4bdb;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
}

/* —— Login —— */
.teach-login {
  display: flex;
  justify-content: center;
  padding: 64px 12px;
}

.teach-card {
  width: min(400px, 100%);
  background: var(--teach-surface-solid);
  border: 1px solid rgba(95, 75, 219, 0.14);
  border-radius: 20px;
  padding: 28px 26px;
  box-shadow: var(--teach-shadow);
}

.teach-card h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: #3d3558;
}

.teach-login-btn {
  width: 100%;
  margin-top: 14px;
}

/* —— Fields —— */
.teach-field-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #5a5478;
}

.teach-card input,
.teach-panel input,
.teach-panel textarea,
.teach-mini-form input,
.teach-search {
  width: 100%;
  box-sizing: border-box;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #ddd6fe;
  border-radius: var(--teach-radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--teach-ink);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.teach-panel textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
  min-height: 96px;
}

.teach-card input:focus,
.teach-panel input:focus,
.teach-panel textarea:focus,
.teach-mini-form input:focus,
.teach-search:focus {
  outline: none;
  border-color: #c4b5fd;
  box-shadow: 0 0 0 3px rgba(95, 75, 219, 0.14);
}

.teach-hint {
  color: var(--teach-muted);
  font-size: 0.84rem;
  line-height: 1.5;
  margin: 0;
}

.teach-file-tip {
  margin: 6px 0 0;
  font-size: 0.76rem;
  color: var(--teach-faint);
}

.login-error {
  color: var(--teach-warn);
  font-size: 0.86rem;
  margin: 8px 0 0;
}

/* —— Console：标题全宽，侧栏与模块顶对齐 —— */
.teach-console {
  display: flex;
  flex-direction: column;
  gap: var(--teach-gap);
  min-height: calc(100vh - 140px);
}

.teach-console > .teach-view-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--teach-gap);
  min-height: 48px;
  padding: 0 2px;
}

.teach-console > .teach-view-head > div:first-child {
  min-width: 0;
  flex: 1;
}

.teach-console > .teach-view-head h2 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 700;
  color: #3d3558;
  line-height: 1.25;
}

.teach-console > .teach-view-head .teach-hint {
  margin-top: 4px;
}

.teach-console-body {
  display: grid;
  grid-template-columns: var(--teach-sidebar) minmax(0, 1fr);
  gap: var(--teach-gap);
  align-items: stretch;
}

.teach-sidebar {
  background: var(--teach-surface-solid);
  border: 1px solid rgba(95, 75, 219, 0.14);
  border-radius: var(--teach-radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 16px;
  box-shadow: var(--teach-shadow);
  align-self: stretch;
  min-height: 100%;
  box-sizing: border-box;
}

.teach-nav {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-height: 42px;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0 12px;
  border-radius: 12px;
  cursor: pointer;
  color: #3d3a5c;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.teach-nav i {
  width: 22px;
  text-align: center;
  font-size: 0.92rem;
  opacity: 0.8;
}

.teach-nav:hover {
  background: rgba(155, 109, 255, 0.12);
  color: #5f4bdb;
}

.teach-nav.active {
  background: #5f4bdb;
  color: #fff;
  box-shadow: 0 8px 18px rgba(95, 75, 219, 0.28);
}

.teach-nav.active i {
  opacity: 1;
}

.teach-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--teach-gap);
  min-height: 100%;
  height: 100%;
}

.teach-view {
  display: flex;
  flex-direction: column;
  gap: var(--teach-gap);
  flex: 1;
  min-height: 0;
}

.teach-view#view-decks {
  min-height: 100%;
}

.teach-view#view-decks .teach-grid-2--decks {
  flex: 1;
}

/* —— Panels —— */
.teach-panel {
  background: var(--teach-surface-solid);
  border: 1px solid rgba(95, 75, 219, 0.12);
  border-radius: var(--teach-radius);
  padding: var(--teach-pad);
  box-shadow: var(--teach-shadow);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.teach-panel > h3,
.teach-panel-head h3,
.teach-panel form > h3 {
  margin: 0 0 12px;
  font-size: 0.98rem;
  font-weight: 700;
  color: #3d3558;
}

.teach-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  min-height: 32px;
}

.teach-panel-head h3 {
  margin: 0;
}

.teach-grid-2 {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: var(--teach-gap);
  align-items: stretch;
}

.teach-grid-2--decks {
  min-height: 460px;
}

.teach-grid-2 > .teach-panel,
.teach-panel--fill {
  height: 100%;
  min-height: 0;
}

.teach-fill-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.teach-fill-form .teach-btn-primary,
.teach-fill-form #deckImportBtn {
  margin-top: auto;
  width: 100%;
  justify-content: center;
}

.teach-table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 120px;
  border: 1px solid var(--teach-line-soft);
  border-radius: var(--teach-radius-sm);
  background: #fcfbff;
}

.teach-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.teach-table th,
.teach-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--teach-line-soft);
  text-align: left;
  vertical-align: middle;
}

.teach-table th {
  color: #6b6685;
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  background: #faf8ff;
  position: sticky;
  top: 0;
  z-index: 1;
}

.teach-table tbody tr:last-child td {
  border-bottom: 0;
}

.teach-table tr:hover td {
  background: #f8f6ff;
}

.teach-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.teach-search {
  width: 240px;
}

/* —— Config —— */
.teach-deck-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(70vh, 680px);
  overflow: auto;
  margin: 0 -2px;
  padding: 2px;
}

.teach-deck-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid #ede9fe;
  background: #faf8ff;
  border-radius: var(--teach-radius-sm);
  padding: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.teach-deck-item:hover {
  border-color: #c4b5fd;
  background: #f3f0ff;
}

.teach-deck-item.active {
  border-color: #a78bfa;
  background: #ede9fe;
}

.teach-deck-item strong {
  display: block;
  font-size: 0.9rem;
  color: var(--teach-ink);
}

.teach-deck-item span {
  display: block;
  margin-top: 4px;
  color: var(--teach-muted);
  font-size: 0.74rem;
}

.teach-config-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--teach-gap);
  align-items: start;
}

.teach-config-aside {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 40px);
}

.teach-config-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--teach-gap);
}

.teach-empty {
  background: var(--teach-surface-solid);
  border: 1px dashed #c4b5fd;
  border-radius: var(--teach-radius);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  color: var(--teach-muted);
  box-shadow: var(--teach-shadow);
}

.teach-empty--compact {
  min-height: 320px;
}

.teach-empty h3 {
  margin: 0 0 8px;
  color: #3d3558;
}

.teach-deck-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--teach-line-soft);
}

.teach-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  color: #5f4bdb;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.teach-sub {
  margin: 4px 0 0;
  color: var(--teach-muted);
  font-size: 0.82rem;
}

.teach-preview-frame-wrap {
  width: 100%;
  height: min(40vh, 400px);
  border: 1px solid #ddd6fe;
  border-radius: var(--teach-radius-sm);
  overflow: hidden;
  background: #faf8ff;
  margin-bottom: 0;
}

.teach-preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.teach-preview-fallback {
  padding: 14px;
  border: 1px dashed #c4b5fd;
  border-radius: var(--teach-radius-sm);
  background: #faf8ff;
  color: var(--teach-muted);
  font-size: 0.86rem;
}

.teach-preview-collapsed .teach-preview-frame-wrap,
.teach-preview-collapsed .teach-preview-fallback {
  display: none !important;
}

.teach-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: var(--teach-gap);
  align-items: stretch;
}

.teach-split--3 {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.15fr);
}

.teach-split > .teach-panel {
  height: 100%;
}

.teach-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
  flex: 1;
}

.teach-chapter-item {
  border: 1px solid #ede9fe;
  border-radius: var(--teach-radius-sm);
  padding: 12px;
  background: #faf8ff;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.teach-chapter-item:hover {
  border-color: #c4b5fd;
}

.teach-chapter-item.active {
  border-color: #a78bfa;
  background: #ede9fe;
}

.teach-chapter-item strong {
  display: block;
  font-size: 0.88rem;
}

.teach-chapter-item p {
  margin: 6px 0 0;
  color: var(--teach-muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.teach-form-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.teach-form-grow {
  min-width: 0;
}

.teach-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--teach-line-soft);
}

.teach-status {
  margin-top: 10px;
  font-size: 0.84rem;
  font-weight: 600;
}

.teach-status.ok {
  color: var(--teach-ok);
}

.teach-status.err {
  color: var(--teach-warn);
}

/* —— Course tabs —— */
.teach-tabs {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 4px;
  background: #fff;
  border: 1px solid rgba(95, 75, 219, 0.12);
  border-radius: 40px;
  width: fit-content;
  box-shadow: var(--teach-shadow);
}

.teach-tab {
  border: 0;
  background: transparent;
  border-radius: 40px;
  padding: 8px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  font-family: inherit;
  color: #3d3a5c;
  transition: background 0.2s ease, color 0.2s ease;
}

.teach-tab:hover {
  background: rgba(155, 109, 255, 0.12);
  color: #5f4bdb;
}

.teach-tab.active {
  background: #5f4bdb;
  color: #fff;
  box-shadow: 0 6px 14px rgba(95, 75, 219, 0.25);
}

.teach-mini-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--teach-line-soft);
  align-items: center;
}

.teach-mini-form button {
  grid-column: 1 / -1;
  justify-self: start;
  min-width: 140px;
}

/* —— Buttons —— */
.teach-act-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.teach-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: #f0ebff;
  color: #5f4bdb;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.teach-act i {
  font-size: 0.72rem;
  opacity: 0.9;
}

.teach-act:hover {
  background: #e4dbff;
  color: #4c3bc4;
  transform: translateY(-1px);
}

.teach-act.is-primary {
  background: linear-gradient(135deg, #9b6dff 0%, #5f4bdb 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(95, 75, 219, 0.28);
}

.teach-act.is-primary:hover {
  background: linear-gradient(135deg, #8a5cf0 0%, #4c3bc4 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(95, 75, 219, 0.34);
}

.teach-act.is-outline {
  background: #fff;
  border-color: #c4b5fd;
  color: #5f4bdb;
}

.teach-act.is-outline:hover {
  background: #f5f3ff;
  border-color: #5f4bdb;
}

.teach-act.is-danger {
  background: #fff1f0;
  color: #e74c3c;
  border-color: transparent;
}

.teach-act.is-danger:hover {
  background: #ffe4e1;
  color: #c0392b;
}

.teach-app .btn,
.teach-app .teach-btn-primary,
.teach-app .btn-sm,
.teach-app .btn-sm-purple {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 22px !important;
  border: none !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #9b6dff 0%, #5f4bdb 100%) !important;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 20px rgba(95, 75, 219, 0.26) !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease !important;
}

.teach-app .btn:hover,
.teach-app .teach-btn-primary:hover,
.teach-app .btn-sm:hover,
.teach-app .btn-sm-purple:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
  box-shadow: 0 12px 26px rgba(95, 75, 219, 0.34) !important;
}

.teach-app .btn-sm {
  min-height: 34px !important;
  padding: 0 14px !important;
  font-size: 0.8rem !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 12px rgba(95, 75, 219, 0.22) !important;
}

.teach-app .btn-outline {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px !important;
  border-radius: 10px !important;
  border: 1.5px solid #c4b5fd !important;
  color: #5f4bdb !important;
  background: #fff !important;
  box-shadow: none !important;
  font-weight: 600;
}

.teach-app .btn-outline:hover {
  background: #f5f3ff !important;
  border-color: #5f4bdb !important;
  color: #4c3bc4 !important;
  transform: translateY(-1px);
}

.btn-outline.danger,
.btn-outline.danger:hover,
.teach-act.is-danger.danger {
  color: #e74c3c !important;
  border-color: #f5c6c2 !important;
  background: #fff5f4 !important;
}

.teach-login-btn {
  width: 100%;
  margin-top: 14px;
}

.teach-user .teach-act {
  height: 30px;
  background: #fff;
  border: 1px solid #ddd6fe;
}

/* —— Hidden —— */
.teach-login[hidden],
.teach-console[hidden],
.teach-user[hidden],
.teach-view[hidden],
.teach-panel[hidden],
#deckPreviewSection[hidden],
#configMainPanel[hidden],
#configMainEmpty[hidden],
#orgMembersPanel[hidden],
#courseTabLive[hidden],
#courseTabCamps[hidden],
#courseTabClasses[hidden],
#view-asks[hidden],
.teach-preview-fallback[hidden],
.teach-preview-frame-wrap[hidden],
#cfgPageDeleteBtn[hidden],
#cfgSegDeleteBtn[hidden],
.login-error[hidden],
.teach-status[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .teach-app--console {
    width: calc(100% - 24px);
    padding-top: 14px;
  }

  .teach-console-body,
  .teach-grid-2,
  .teach-config-layout,
  .teach-split,
  .teach-mini-form,
  .teach-form-row {
    grid-template-columns: 1fr;
  }

  .teach-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .teach-nav {
    width: auto;
    grid-template-columns: 18px auto;
    padding: 0 14px;
  }

  .teach-console > .teach-view-head {
    flex-direction: column;
    align-items: stretch;
  }

  .teach-search {
    width: 100%;
  }

  .teach-tabs {
    width: 100%;
    overflow-x: auto;
  }
}

.teach-site-footer {
  text-align: center;
  color: #7b78a2;
  margin: 28px 0 12px;
  padding: 0 12px 8px;
  font-size: 0.85rem;
  line-height: 1.7;
}

.teach-site-footer p {
  margin: 0;
}

.teach-site-footer-dev {
  margin-top: 4px;
}

.teach-site-footer-dev strong {
  font-weight: 600;
  color: #5f5c82;
}

.teach-site-footer-beian {
  margin-top: 2px;
}

.teach-site-footer-beian a {
  color: #7b78a2;
  text-decoration: none;
}

.teach-site-footer-beian a:hover {
  text-decoration: underline;
}

.teach-site-footer-contact {
  margin-top: 6px;
}

.teach-site-footer-link {
  color: #5f4bdb;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.teach-site-footer-link:hover {
  text-decoration: underline;
}
