/* 微课教学平台 — 全局变量与基础样式 (优化版) */
/* 设计方向：学术·精炼·现代，以蓝色知识感为主轴，三端主色各具调性 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700&display=swap');

:root {
  /* ── 主色体系 ── */
  --primary:        #2563EB;          /* 比原色更鲜亮，现代蓝 */
  --primary-dark:   #1E40AF;
  --primary-light:  #DBEAFE;
  --primary-glow:   rgba(37, 99, 235, 0.18);

  --interactive:      #2563EB;
  --interactive-hover:#1D4ED8;

  /* Ant Design 兼容色（组件层引用） */
  --ant-primary:    #2563EB;
  --ant-primary-h:  #1D4ED8;
  --ant-primary-l:  #60A5FA;

  /* ── 语义色 ── */
  --accent:  #16A34A;   /* 成功/通过 */
  --warning: #D97706;   /* 警告 */
  --danger:  #DC2626;   /* 危险/错误 */
  --info:    #0284C7;   /* 信息 */

  /* ── 三端主色 ── */
  --student-color:      #2563EB;
  --student-color-bg:   #EFF6FF;
  --student-color-soft: rgba(37,99,235,0.08);

  --teacher-color:      #16A34A;
  --teacher-color-bg:   #F0FDF4;
  --teacher-color-soft: rgba(22,163,74,0.08);

  --admin-color:        #7C3AED;
  --admin-color-bg:     #F5F3FF;
  --admin-color-soft:   rgba(124,58,237,0.08);

  /* ── 文字 ── */
  --text-primary:   rgba(0,0,0,0.88);
  --text-secondary: rgba(0,0,0,0.60);
  --text-muted:     rgba(0,0,0,0.38);
  --text-inverse:   #ffffff;

  /* ── 边框 / 背景 ── */
  --border:          #E2E8F0;
  --border-light:    #F1F5F9;
  --border-focus:    var(--ant-primary);
  --bg-page:         #F4F6FA;
  --bg-card:         #ffffff;
  --bg-hover:        #F8FAFC;
  --bg-subtle:       #F1F5F9;

  /* ── 间距 ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* ── 圆角 ── */
  --radius-xs: 2px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ── 阴影（分层） ── */
  --shadow-xs:         0 1px 2px rgba(0,0,0,0.04);
  --shadow-card:       0 1px 3px rgba(0,0,0,0.06), 0 1px 8px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-modal:      0 20px 60px rgba(0,0,0,0.15), 0 4px 12px rgba(0,0,0,0.08);
  --shadow-nav:        0 1px 0 var(--border-light), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-sider:      2px 0 12px rgba(0,21,41,0.12);

  /* ── 过渡 ── */
  --transition-fast:   0.15s ease;
  --transition-base:   0.22s ease;
  --transition-slow:   0.35s ease;

  /* ── 字体 ── */
  --font-body: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'SFMono-Regular', monospace;
  --font-display: 'Noto Sans SC', 'PingFang SC', sans-serif;

  /* ── 布局 ── */
  --nav-height:   52px;
  --sider-width:  240px;
  --content-max:  1280px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--interactive);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--interactive-hover); }

img { max-width: 100%; height: auto; vertical-align: middle; }
h1,h2,h3,h4 { margin: 0 0 var(--space-sm); font-weight: 600; line-height: 1.35; }

/* ── 仅屏幕阅读器可见 ── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── 登录页：全屏背景图 + 居中卡片（顶栏深红 + 白底表单 + 绿色登录键） ── */
.login-page--splash-card {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  box-sizing: border-box;
}

.login-page--splash-card::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: #3d4f5f;
  background-image: url('../images/a9603480438eb529ede66376c863b147.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-splash-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
}

.login-splash-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22), 0 2px 12px rgba(0, 0, 0, 0.12);
}

.login-splash-card__header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 24px;
  background: linear-gradient(180deg, #8b2232 0%, #6d1524 100%);
}

.login-splash-card__brand {
  display: block;
  width: auto;
  max-width: min(100%, 320px);
  max-height: 80px;
  height: auto;
  object-fit: contain;
}

.login-splash-card__body {
  padding: 28px 26px 22px;
  background: #fff;
}

.login-splash-field {
  display: flex;
  align-items: center;
  height: 44px;
  margin-bottom: 16px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

.login-splash-field--password {
  position: relative;
  padding-right: 38px;
}

.login-splash-field__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  color: #999;
}

.login-splash-field__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  font-size: 14px;
  font-family: inherit;
  color: rgba(0, 0, 0, 0.85);
  background: transparent;
}

.login-splash-field__input::placeholder {
  color: #bfbfbf;
}

.login-splash-field__toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: #999;
  cursor: pointer;
  border-radius: 6px;
}

.login-splash-field__toggle[aria-pressed='true'] {
  color: #2d9d5c;
}

.login-splash-field__toggle:hover {
  color: #666;
  background: rgba(0, 0, 0, 0.04);
}

.login-splash-field__toggle[aria-pressed='true']:hover {
  color: #258a52;
}

.login-splash-field__toggle:focus-visible {
  outline: 2px solid rgba(139, 34, 50, 0.45);
  outline-offset: 1px;
}

.login-splash-field__toggle svg {
  display: block;
}

.login-splash-submit {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(180deg, #3fb878 0%, #2d9d5c 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  transition: filter 0.15s ease, transform 0.1s ease;
}

.login-splash-submit:hover:not(:disabled) {
  filter: brightness(1.05);
}

.login-splash-submit:active:not(:disabled) {
  transform: translateY(1px);
}

.login-splash-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
}

.login-hint--splash {
  margin-top: 16px;
}

@media (max-width: 480px) {
  .login-splash-card__header {
    padding: 16px;
  }
  .login-splash-card__brand {
    max-height: 64px;
  }
  .login-splash-card__body {
    padding: 22px 16px 18px;
  }
}

.login-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  text-align: center;
}

/* ── 顶部导航 ── */
.top-nav {
  height: var(--nav-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  gap: var(--space-md);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-nav);
}
.nav-logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.03em;
  color: var(--text-primary);
  margin-right: var(--space-md);
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
}
.nav-links a {
  color: var(--text-secondary);
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 450;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-links a:hover {
  color: var(--interactive);
  background: var(--primary-glow);
  text-decoration: none;
}
.nav-links a.active {
  color: var(--interactive);
  background: var(--primary-glow);
  font-weight: 600;
  text-decoration: none;
}
.nav-user {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ── 内容区 ── */
.main-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-lg);
  min-height: calc(100vh - var(--nav-height) - 48px);
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 var(--space-lg);
  color: var(--text-primary);
  line-height: 1.4;
  letter-spacing: 0.01em;
}

/* ── 工具栏 ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}
.toolbar-spacer { flex: 1; min-width: 8px; }

/* ── 网格 ── */
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}
@media (max-width: 1080px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .grid-4 { grid-template-columns: 1fr; } }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ── 骨架屏（与 utils.js skeletonCards 配套） ── */
@keyframes pulse {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 1; }
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-card .skeleton-block {
  background: #e2e8f0;
  border-radius: var(--radius-sm);
  animation: pulse 1.15s ease-in-out infinite;
}

.skeleton-card .skeleton-block--thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  margin-bottom: var(--space-sm);
}

.skeleton-card .skeleton-block--line {
  height: 14px;
  width: 85%;
  margin-bottom: 8px;
}

.skeleton-card .skeleton-block--line-narrow {
  width: 55%;
  margin-bottom: 0;
}
