/* ============================================
   学生首页样式（课堂签到）
   大厂风格：深色渐变 Hero + 上浮白色卡片
   主色 #6366f1 → #8b5cf6，背景 #f5f7fb
   ============================================ */

/* ====== 基础重置 ====== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* 配色（与学生端 style.css 保持一致） */
  --bg: #f5f7fb;
  --bg-gradient: linear-gradient(180deg, #f5f7fb 0%, #e8ecf8 100%);
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --primary: #6366f1;
  --primary-dark: #5457e5;
  --primary-soft: #eef2ff;
  --primary-soft-2: #f5f3ff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --border-focus: #c7d2fe;
  --input-bg: #f9fafb;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --shadow-card: 0 4px 24px rgba(31, 41, 55, 0.06);
  --shadow-hover: 0 14px 40px rgba(31, 41, 55, 0.12);
  --shadow-btn: 0 8px 22px rgba(99, 102, 241, 0.34);
  --radius-card: 20px;
  --radius-btn: 14px;
  --radius-pill: 999px;

  /* Hero 深色渐变 */
  --hero-gradient: linear-gradient(150deg, #1e1b4b 0%, #4338ca 55%, #7c3aed 100%);
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* ====== 应用容器 ====== */
.app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--card-bg);
  box-shadow: 0 0 80px rgba(31, 41, 55, 0.06);
}

/* ============================================
   Hero 区
   ============================================ */
.hero {
  position: relative;
  background: var(--hero-gradient);
  padding: 56px 24px 72px;
  overflow: hidden;
  color: #fff;
}

/* 模糊光斑装饰 */
.hero__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
}

.hero__glow--1 {
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, #a78bfa 0%, transparent 70%);
  top: -80px;
  right: -60px;
}

.hero__glow--2 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, #818cf8 0%, transparent 70%);
  bottom: -70px;
  left: -50px;
}

/* 网格点装饰 */
.hero__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 75%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 75%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__badge {
  display: inline-block;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #e0e7ff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-pill);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  margin-bottom: 18px;
  animation: badgeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero__title {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 10px;
  animation: heroIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.05s;
}

.hero__subtitle {
  font-size: 1rem;
  font-weight: 400;
  color: rgba(224, 231, 255, 0.9);
  animation: heroIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.12s;
}

@keyframes badgeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   内容区（白色卡片上浮覆盖 Hero 底部）
   ============================================ */
.content {
  flex: 1;
  background: var(--card-bg);
  border-radius: 28px 28px 0 0;
  margin-top: -32px;
  padding: 28px 20px 8px;
  position: relative;
  z-index: 2;
  box-shadow: 0 -10px 40px rgba(30, 27, 75, 0.12);
}

/* ====== 视图切换 ====== */
.view {
  display: none;
  flex-direction: column;
  flex: 1;
}

.view.is-active {
  display: flex;
  animation: viewIn 0.36s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   状态卡片（加载 / 错误 / 空）
   ============================================ */
.state {
  display: none;
  text-align: center;
  padding: 48px 16px;
  animation: stateIn 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

.state.is-active {
  display: block;
}

@keyframes stateIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.state__icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  box-shadow: var(--shadow-card);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.state__icon--error { background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%); }
.state__icon--info  { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.6); }
  to   { opacity: 1; transform: scale(1); }
}

.state__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.state__text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ====== 加载动画 ====== */
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   班级网格
   ============================================ */
.classes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.class-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px;
  min-height: 96px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.class-card:nth-child(1) { animation-delay: 0.04s; }
.class-card:nth-child(2) { animation-delay: 0.10s; }
.class-card:nth-child(3) { animation-delay: 0.16s; }
.class-card:nth-child(4) { animation-delay: 0.22s; }
.class-card:nth-child(5) { animation-delay: 0.28s; }
.class-card:nth-child(6) { animation-delay: 0.34s; }
.class-card:nth-child(7) { animation-delay: 0.40s; }
.class-card:nth-child(8) { animation-delay: 0.46s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.class-card:active {
  transform: scale(0.97);
}

@media (hover: hover) {
  .class-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-focus);
  }
}

/* 选中态 */
.class-card.is-selected {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft) 0%, var(--primary-soft-2) 100%);
  box-shadow: 0 8px 26px rgba(99, 102, 241, 0.22);
}

.class-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.class-card__name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  word-break: break-word;
}

/* 选中勾选标记 */
.class-card__check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(99, 102, 241, 0.4);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.class-card.is-selected .class-card__check {
  display: flex;
}

/* ============================================
   进入签到按钮（底部固定条）
   ============================================ */
.enter-bar {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  padding: 16px 0 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, #ffffff 35%);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.enter-bar.is-show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   按钮通用
   ============================================ */
.btn {
  height: 52px;
  border: none;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, opacity 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  user-select: none;
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

.btn--primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: var(--shadow-btn);
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn--ghost {
  width: auto;
  min-width: 140px;
  height: 44px;
  margin-top: 18px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.btn--ghost:active {
  background: #e0e7ff;
}

.btn__arrow {
  transition: transform 0.18s ease;
}

.btn--primary:not(:disabled):active .btn__arrow {
  transform: translateX(3px);
}

/* ============================================
   会话列表视图：区头
   ============================================ */
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.back-btn {
  background: var(--primary-soft);
  border: none;
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.12s ease;
  flex-shrink: 0;
}

.back-btn:active {
  transform: scale(0.95);
  background: #e0e7ff;
}

.section-head__text {
  flex: 1;
  min-width: 0;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.section-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ============================================
   会话卡片列表
   ============================================ */
.sessions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  width: 100%;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.session-card:nth-child(1) { animation-delay: 0.04s; }
.session-card:nth-child(2) { animation-delay: 0.10s; }
.session-card:nth-child(3) { animation-delay: 0.16s; }
.session-card:nth-child(4) { animation-delay: 0.22s; }
.session-card:nth-child(5) { animation-delay: 0.28s; }
.session-card:nth-child(6) { animation-delay: 0.34s; }

.session-card:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .session-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-focus);
  }
  .session-card:hover .session-card__arrow {
    transform: translateX(3px);
    color: var(--primary);
  }
}

.session-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.session-card__body {
  flex: 1;
  min-width: 0;
}

.session-card__name {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  word-break: break-word;
  line-height: 1.3;
}

.session-card__time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.session-card__time-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: livePulse 1.8s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}

.session-card__arrow {
  font-size: 1.5rem;
  color: var(--text-tertiary);
  font-weight: 300;
  flex-shrink: 0;
  transition: transform 0.18s ease, color 0.18s ease;
}

/* 不同功能卡片图标颜色 */
.session-card__icon--orange {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.session-card__icon--gray {
  background: linear-gradient(135deg, #6b7280 0%, #9ca3af 100%);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.session-card__icon--blue {
  background: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* 未授课提示卡片 */
.tip-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  animation: cardIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.tip-card__icon {
  font-size: 1.8rem;
  flex-shrink: 0;
}

.tip-card__body {
  flex: 1;
  min-width: 0;
}

.tip-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.tip-card__text {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ============================================
   大屏适配
   ============================================ */
@media (min-width: 768px) {
  .hero {
    padding: 72px 32px 88px;
  }
  .hero__title {
    font-size: 2.5rem;
  }
  .hero__subtitle {
    font-size: 1.1rem;
  }
  .content {
    padding: 36px 28px 8px;
  }
  .classes {
    gap: 14px;
  }
  .class-card {
    min-height: 108px;
    padding: 22px 18px;
  }
  .state__title {
    font-size: 1.4rem;
  }
}
