/* ═══════════════════════════════════════════════
   AK英语课堂 — Web 设计系统 v1
   Bold & Vibrant Education Platform
   ═══════════════════════════════════════════════ */

/* ── CSS 变量 ── */
:root {
  --brand-blue: #3B6FF5;
  --brand-blue-light: #6690FF;
  --brand-blue-dark: #2554D9;
  --brand-orange: #FF6B3D;
  --brand-teal: #10B9A0;
  --brand-purple: #7C5CF0;
  --brand-pink: #F06595;

  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;

  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-hint: #94A3B8;
  --border: #E2E8F0;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 40px rgba(59,111,245,0.15);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* ── 导航栏 ── */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.nav-brand {
  font-size: 20px; font-weight: 800;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; flex-shrink: 0; }
#nav-auth { display: contents; }
.nav-link {
  padding: 8px 18px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  transition: all 0.2s; border: none; background: none;
  white-space: nowrap; flex-shrink: 0;
}
.nav-link:hover { background: var(--gray-100); color: var(--text); }
.nav-link.active { background: var(--brand-blue); color: #fff; }
.nav-link.accent { background: var(--brand-orange); color: #fff; }
.nav-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 6px; border-radius: var(--radius-full);
  background: var(--gray-100); font-size: 14px; font-weight: 600;
  white-space: nowrap; max-width: 160px;
}
.nav-user span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700;
}

/* ── 页面容器 ── */
.page { display: none; padding-bottom: 80px; }
.page.active { display: block; animation: fadeSlideIn 0.4s ease; }

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

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Hero ── */
.hero {
  position: relative; overflow: hidden;
  padding: 80px 24px 60px;
  background: linear-gradient(160deg, #0F1B3D 0%, #1A3A6B 30%, #2554D9 70%, #5B4FCF 100%);
  text-align: center;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(102,144,255,0.3) 0%, transparent 60%),
              radial-gradient(ellipse at 80% 20%, rgba(124,92,240,0.2) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(255,107,61,0.15) 0%, transparent 50%);
}
.hero-content { position: relative; z-index: 1; }
.hero-badge {
  display: inline-block; padding: 6px 18px; border-radius: var(--radius-full);
  background: rgba(255,255,255,0.12); backdrop-filter: blur(10px);
  font-size: 13px; font-weight: 700; color: rgba(255,255,255,0.9);
  letter-spacing: 1px; margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(36px, 6vw, 64px); font-weight: 900;
  color: #fff; line-height: 1.1; margin-bottom: 16px;
  letter-spacing: -1px;
}
.hero-gradient {
  background: linear-gradient(135deg, #6690FF, #C084FC, #FF6B3D);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 18px; color: rgba(255,255,255,0.7); max-width: 500px;
  margin: 0 auto 40px; line-height: 1.6;
}
.hero-stats {
  display: flex; justify-content: center; gap: 48px;
}
.hero-stat-num {
  display: block; font-size: 36px; font-weight: 900; color: #fff;
}
.hero-stat-label {
  font-size: 13px; color: rgba(255,255,255,0.6); font-weight: 500;
}

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; border-radius: var(--radius-full);
  font-size: 15px; font-weight: 700; border: none;
  transition: all 0.2s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--brand-blue); color: #fff; }
.btn-primary:hover { background: var(--brand-blue-dark); }
.btn-accent { background: var(--brand-orange); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-lg { padding: 16px 36px; font-size: 17px; }
.btn-block { width: 100%; display: flex; }

/* ── 课程网格 ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin: 56px 0 28px;
}
.section-title { font-size: 28px; font-weight: 900; }
.section-count { font-size: 14px; color: var(--text-hint); }

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

/* 课程卡片 */
.course-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  cursor: pointer;
  border: 1px solid var(--border);
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  border-color: transparent;
}

.cc-cover-wrap {
  position: relative; width: 100%; height: 220px;
  overflow: hidden; background: var(--gray-100);
}
.cc-cover {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s ease;
}
.course-card:hover .cc-cover { transform: scale(1.05); }
.cc-overlay {
  position: absolute; bottom: 0; left: 0; right: 0; height: 120px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.6));
}
.cc-badge {
  position: absolute; top: 14px; left: 14px;
  padding: 5px 14px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 700; color: #fff;
  backdrop-filter: blur(8px);
}
.cc-badge.beginner { background: rgba(34,197,94,0.7); }
.cc-badge.intermediate { background: rgba(245,158,11,0.7); }
.cc-badge.advanced { background: rgba(124,92,240,0.7); }

.cc-body { padding: 20px; }
.cc-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.cc-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 14px; }
.cc-meta { display: flex; gap: 16px; font-size: 13px; color: var(--text-hint); }
.cc-meta-item { display: flex; align-items: center; gap: 4px; }

/* ── 课程详情页 ── */
.course-detail-hero {
  position: relative; height: 360px; overflow: hidden;
}
.course-detail-hero img {
  width: 100%; height: 100%; object-fit: cover;
}
.cdh-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.7) 100%);
}
.cdh-info {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 40px;
  max-width: 800px;
}
.cdh-title { font-size: 36px; font-weight: 900; color: #fff; margin-bottom: 8px; }
.cdh-subtitle { font-size: 16px; color: rgba(255,255,255,0.75); margin-bottom: 16px; }
.cdh-meta { display: flex; gap: 16px; font-size: 13px; color: rgba(255,255,255,0.65); }

.lesson-list { display: flex; flex-direction: column; gap: 2px; margin: 32px 0; }

.lesson-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; background: var(--bg-card);
  border-radius: var(--radius-sm);
  transition: all 0.15s; cursor: pointer;
  border: 1px solid transparent;
}
.lesson-row:hover { background: var(--gray-50); border-color: var(--border); }
.lesson-row.locked { opacity: 0.5; cursor: not-allowed; }
.lesson-row.locked:hover { background: var(--bg-card); border-color: transparent; transform: none; }

.lesson-index {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
}
.lesson-index.free { background: #DCFCE7; color: #166534; }
.lesson-index.open { background: #DBEAFE; color: #1E40AF; }
.lesson-index.locked { background: var(--gray-100); color: var(--gray-400); }

.lesson-body { flex: 1; min-width: 0; }
.lesson-title { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.lesson-meta { font-size: 12px; color: var(--text-hint); }

/* ── 视频播放器 ── */
.player-container {
  max-width: 1000px; margin: 0 auto; padding: 24px;
}
.video-wrapper {
  position: relative; width: 100%;
  background: #000; border-radius: var(--radius-lg); overflow: hidden;
}
.video-wrapper video {
  width: 100%; display: block; max-height: 70vh;
}

.player-info-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0; border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.player-lesson-title { font-size: 20px; font-weight: 800; }
.player-lesson-dur { font-size: 14px; color: var(--text-hint); }

.player-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 24px;
}

/* ── 我的课程 ── */
.my-course-card {
  display: flex; align-items: center; gap: 20px;
  padding: 16px; background: var(--bg-card);
  border-radius: var(--radius-md); border: 1px solid var(--border);
  transition: all 0.2s; cursor: pointer; margin-bottom: 12px;
}
.my-course-card:hover { box-shadow: var(--shadow-md); }

.mcc-img {
  width: 160px; height: 100px; border-radius: var(--radius-sm);
  object-fit: cover; flex-shrink: 0; background: var(--gray-100);
}
.mcc-body { flex: 1; min-width: 0; }
.mcc-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.mcc-progress-bar {
  height: 8px; background: var(--gray-200); border-radius: var(--radius-full);
  overflow: hidden; margin-bottom: 6px;
}
.mcc-progress-fill {
  height: 100%; border-radius: var(--radius-full);
  transition: width 0.5s ease;
}
.mcc-progress-text { font-size: 12px; color: var(--text-hint); }

/* ── 认证页 ── */
.auth-container {
  min-height: 80vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 40px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
}
.auth-title { font-size: 28px; font-weight: 900; text-align: center; margin-bottom: 8px; }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 32px; }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: var(--radius-md); font-size: 15px;
  transition: border-color 0.2s; background: var(--bg);
}
.form-input:focus { outline: none; border-color: var(--brand-blue); }
.form-error { font-size: 13px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 13px; color: var(--text-hint); text-align: center; margin-top: 20px; }
.form-hint a { color: var(--brand-blue); font-weight: 700; cursor: pointer; }

/* ── 兑换页 ── */
.redeem-container {
  max-width: 480px; margin: 60px auto; padding: 40px;
  background: var(--bg-card); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  text-align: center;
}
.redeem-icon {
  width: 80px; height: 80px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px;
  font-size: 36px; color: #fff;
}
.redeem-title { font-size: 24px; font-weight: 900; margin-bottom: 8px; }
.redeem-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; }
.redeem-input {
  width: 100%; padding: 16px; text-align: center; font-size: 24px;
  font-weight: 800; letter-spacing: 4px; font-family: var(--font-mono);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 16px;
}
.redeem-input:focus { outline: none; border-color: var(--brand-blue); }

/* ── 空状态 ── */
.empty-state {
  text-align: center; padding: 80px 24px;
}
.empty-icon {
  width: 100px; height: 100px; border-radius: 50%;
  background: var(--gray-100); display: flex; align-items: center; justify-content: center;
  margin: 0 auto 24px; font-size: 40px;
}
.empty-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.empty-desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; }

/* ── Toast ── */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  padding: 14px 24px; border-radius: var(--radius-md);
  color: #fff; font-weight: 700; font-size: 14px;
  animation: slideInRight 0.3s ease;
  box-shadow: var(--shadow-lg);
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(100px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── 模态弹窗 ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-box {
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 32px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg); animation: scaleIn 0.2s ease;
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 20px; }

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ── 兑换弹窗 ── */
.redeem-modal-box {
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 36px 32px 28px; max-width: 420px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalPop 0.25s cubic-bezier(0.4,0,0.2,1);
}

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

.rm-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-purple));
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px; font-weight: 900; color: #fff;
}

.rm-title { font-size: 22px; font-weight: 900; text-align: center; margin-bottom: 6px; }
.rm-subtitle { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }

.rm-input {
  width: 100%; padding: 14px 16px; text-align: center;
  font-size: 22px; font-weight: 800; letter-spacing: 3px;
  font-family: var(--font-mono);
  border: 2px solid var(--border); border-radius: var(--radius-md);
  background: var(--bg); margin-bottom: 8px;
}
.rm-input:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 4px rgba(59,111,245,0.1); }

.rm-error {
  text-align: center; padding: 8px 12px; margin-bottom: 8px;
  background: #FEF2F2; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--danger); font-weight: 600;
}

.rm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.rm-spinner {
  width: 40px; height: 40px; border: 3px solid var(--border);
  border-top-color: var(--brand-blue); border-radius: 50%;
  margin: 0 auto;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.rm-success-circle {
  width: 80px; height: 80px; border-radius: 50%;
  background: #DCFCE7; display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px; font-weight: 900; color: #16A34A;
}

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%; animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 页脚 ── */
.site-footer {
  text-align: center; padding: 32px 24px;
  font-size: 13px; color: var(--text-hint);
  border-top: 1px solid var(--border);
  margin-top: 60px;
}

/* ── 响应式 ── */
@media (max-width: 768px) {
  .course-grid { grid-template-columns: 1fr; }
  .hero { padding: 60px 16px 40px; }
  .hero-stats { gap: 24px; }
  .cdh-info { padding: 24px; }
  .cdh-title { font-size: 24px; }
  .course-detail-hero { height: 240px; }
  .nav { padding: 0 16px; }
  .nav-brand { font-size: 16px; }
  .nav-link { padding: 6px 12px; font-size: 13px; }
  .nav-user { max-width: 120px; font-size: 13px; }
  .nav-user span { max-width: 60px; }
  .container { padding: 0 16px; }
}
