/* ============================================================
   NovaRead AI语文 — 共享样式
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700;900&family=Noto+Sans+SC:wght@300;400;500;600;700&family=Ma+Shan+Zheng&display=swap');

:root {
  /* 主色：水墨绿 / 月色蓝 */
  --color-primary: #10b981;
  --color-primary-dark: #059669;
  --color-primary-light: #d1fae5;
  --color-primary-soft: #ecfdf5;

  --color-accent: #6366f1;
  --color-accent-soft: #eef2ff;

  --color-purple: #a78bfa;
  --color-purple-soft: #f5f3ff;

  --color-blue: #3b82f6;
  --color-blue-soft: #eff6ff;

  /* 侧边栏深色 */
  --sidebar-bg: #0a1628;
  --sidebar-bg-2: #0f1e36;
  --sidebar-text: #cbd5e1;
  --sidebar-text-muted: #64748b;
  --sidebar-active: rgba(16, 185, 129, 0.15);
  --sidebar-border: rgba(148, 163, 184, 0.08);

  /* 主内容区 */
  --bg-page: #f4f6fa;
  --bg-card: #ffffff;
  --bg-card-soft: #f8fafc;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border-light: #e2e8f0;
  --border-soft: #f1f5f9;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  --font-display: 'Noto Serif SC', serif;
  --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-brush: 'Ma Shan Zheng', 'Noto Serif SC', serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   主布局
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.app > .sidebar {
  grid-column: 1;
}

.app > .main {
  grid-column: 2;
}

/* ============================================================
   侧边栏
   ============================================================ */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--sidebar-border);
}

.brand {
  padding: 22px 24px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-logo {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-logo svg { width: 100%; height: 100%; }

.brand-text {
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.3px;
}

.brand-text small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--sidebar-text-muted);
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
}

.nav-item:hover {
  background: rgba(148, 163, 184, 0.06);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--color-primary);
  border-radius: 0 3px 3px 0;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-divider {
  height: 1px;
  background: var(--sidebar-border);
  margin: 12px 14px;
}

.sidebar-footer {
  padding: 16px 20px 22px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 12px;
  color: var(--sidebar-text-muted);
  position: relative;
  overflow: hidden;
}

.sidebar-footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.sidebar-footer-brand svg { width: 14px; height: 14px; }

.sidebar-footer-title {
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.sidebar-footer-tagline {
  color: var(--sidebar-text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-bamboo {
  position: absolute;
  bottom: -8px;
  right: -4px;
  opacity: 0.18;
  font-size: 28px;
}

/* ============================================================
   顶栏
   ============================================================ */
.topbar {
  background: var(--sidebar-bg);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px 0 0;
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--sidebar-border);
}

.topbar-product {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 32px;
  height: 100%;
  border-right: 1px solid var(--sidebar-border);
  padding-right: 32px;
}

.topbar-product-logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-product-name {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  font-family: var(--font-display);
  letter-spacing: 0.5px;
}

.topbar-product-name span {
  color: var(--color-primary);
  margin-left: 4px;
  font-weight: 500;
  font-size: 14px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.topbar-vip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.08));
  color: #fbbf24;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid rgba(251, 191, 36, 0.2);
  white-space: nowrap;
}

.topbar-vip span { white-space: nowrap; }

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  cursor: pointer;
  position: relative;
  transition: all 0.2s;
}

.topbar-icon-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }

.topbar-icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--sidebar-bg);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.topbar-user:hover { background: rgba(255,255,255,0.04); }

.topbar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #9d174d;
  font-weight: 600;
  border: 2px solid rgba(255,255,255,0.1);
  overflow: hidden;
}

.topbar-user-name {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.topbar-user-chevron {
  color: #64748b;
  width: 14px;
  height: 14px;
}

/* ============================================================
   主内容容器
   ============================================================ */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-page);
}

.content {
  padding: 28px 36px 48px;
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
}

.course-learning-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.course-learning-body {
  min-width: 0;
}

.course-subnav {
  position: sticky;
  top: 84px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.course-subnav-head {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(99, 102, 241, 0.08)),
    #fff;
}

.course-subnav-kicker {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.course-subnav-title {
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--text-primary);
}

.course-subnav-list {
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 4px;
}

.course-subnav-item,
.course-subnav-back {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.course-subnav-item:hover,
.course-subnav-back:hover {
  background: var(--bg-card-soft);
  color: var(--text-primary);
}

.course-subnav-item.active {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.course-subnav-item svg,
.course-subnav-back svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.course-subnav-item span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.course-subnav-item strong {
  font-size: 13px;
  line-height: 1.25;
  font-weight: 700;
}

.course-subnav-item small {
  font-size: 11px;
  line-height: 1.25;
  color: var(--text-muted);
}

.course-subnav-back {
  margin: 0 10px 12px;
  border-top: 1px solid var(--border-soft);
  border-radius: 0;
  padding-top: 13px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   通用卡片
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-pad {
  padding: 24px 28px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.card-title svg { width: 18px; height: 18px; color: var(--color-primary); }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.btn-ghost {
  background: rgba(255,255,255,0.08);
  color: #fff;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.18);
}

.btn-ghost:hover { background: rgba(255,255,255,0.15); }

.btn-outline {
  background: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ============================================================
   页面标题
   ============================================================ */
.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.page-title .accent {
  color: var(--color-primary);
  margin: 0 6px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 24px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.breadcrumb a:hover { color: var(--color-primary); }

.breadcrumb svg { width: 14px; height: 14px; opacity: 0.6; }

/* ============================================================
   动画
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.animate-in {
  animation: fadeInUp 0.5s ease-out backwards;
}

/* ============================================================
   响应式（基础适配）
   ============================================================ */
@media (max-width: 1100px) {
  .app { grid-template-columns: 200px 1fr; }
  .content { padding: 20px 24px 40px; }
  .course-learning-layout {
    grid-template-columns: 1fr;
  }
  .course-subnav {
    position: static;
  }
  .course-subnav-head {
    padding: 14px 16px 12px;
  }
  .course-subnav-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 12px;
  }
  .course-subnav-item {
    min-width: 142px;
  }
  .course-subnav-back {
    display: none;
  }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .app > .main { grid-column: 1; }
}

/* 自定义滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.5); background-clip: padding-box; }
