/* =====================================================
   小课学堂 - 知识付费站点样式
   ===================================================== */
:root {
  --primary: #ff4d4f;
  --primary-dark: #e63946;
  --accent: #ff9f43;
  --text: #26303a;
  --text-light: #7a8694;
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e8ecf1;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(20, 30, 50, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block; padding: 8px 18px; border-radius: 20px;
  font-size: 14px; cursor: pointer; border: 1px solid transparent;
  transition: all .2s; line-height: 1.5; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-outline:hover { background: #fff1f0; }
.btn-ghost { color: var(--text); }
.btn-ghost:hover { color: var(--primary); }
.btn-lg { padding: 12px 40px; font-size: 16px; border-radius: 26px; }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- 顶部导航 ---------- */
.site-header {
  background: #fff; box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: #2b3440; color: #fff; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.logo-img { height: 38px; max-width: 180px; width: auto; display: block; }
.logo-text { font-size: 20px; font-weight: 700; }
.main-nav { display: flex; gap: 4px; flex: 1; }
.main-nav a { padding: 6px 12px; border-radius: 8px; color: var(--text); font-size: 15px; }
.main-nav a:hover { color: var(--primary); background: #fff1f0; }
.search-box { display: flex; align-items: center; }
.search-box input {
  width: 180px; padding: 7px 14px; border: 2px solid var(--border);
  border-right: none; border-radius: 18px 0 0 18px; outline: none; font-size: 13px;
}
.search-box input:focus { border-color: var(--primary); }
.search-box button {
  padding: 7px 16px; border: 2px solid var(--primary); background: var(--primary);
  color: #fff; border-radius: 0 18px 18px 0; cursor: pointer; font-size: 13px;
}
.user-area { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- 闪存消息 ---------- */
.flash-wrap { margin-top: 12px; }
.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #f0f9eb; color: #529b2e; border: 1px solid #e1f3d8; }
.flash-error { background: #fef0f0; color: #c45656; border: 1px solid #fde2e2; }
.flash-warning { background: #fdf6ec; color: #b88230; border: 1px solid #faecd8; }

/* ---------- 首页 Banner ---------- */
.hero {
  margin: 24px 0; border-radius: 16px; overflow: hidden;
  background: #2b3440; color: #fff; padding: 48px 56px; position: relative;
}
.hero.hero-with-img {
  background-size: cover; background-position: center;
}
.hero.hero-with-img::before {
  content: ""; position: absolute; inset: 0;
  background: rgba(24, 31, 42, .58);
}
.hero.hero-with-img > * { position: relative; }
.hero h1 { font-size: 34px; margin-bottom: 12px; font-weight: 700; }
.hero p { font-size: 16px; opacity: .92; margin-bottom: 24px; }
.hero .btn { background: #fff; color: #2b3440; font-weight: 600; }

/* ---------- 版块标题 ---------- */
.section { margin: 32px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; }
.section-head h2 .bar {
  display: inline-block; width: 5px; height: 20px; background: var(--primary);
  border-radius: 3px; margin-right: 10px; vertical-align: -2px;
}
.section-head a { color: var(--text-light); font-size: 13px; }
.section-head a:hover { color: var(--primary); }

/* ---------- 课程卡片 ---------- */
.course-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.course-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  display: flex; flex-direction: column;
}
.course-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(20,30,50,.12); }
.course-cover {
  height: 120px; position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #3a4452;
}
.course-cover .cover-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.course-cover .cover-fallback {
  width: 100%; height: 100%; background: #3a4452;
  display: flex; align-items: center; justify-content: center;
}
.course-cover .cover-fallback span {
  color: #fff; font-weight: 600; font-size: 14px; letter-spacing: 1px;
  padding: 0 16px; text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-cover .tag {
  position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,.92);
  color: var(--primary); font-size: 12px; padding: 2px 10px; border-radius: 12px; font-weight: 600;
}
.course-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.course-body h3 {
  font-size: 15px; line-height: 1.45; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.course-body h3 a:hover { color: var(--primary); }
.course-meta { font-size: 12px; color: var(--text-light); display: flex; gap: 10px; flex-wrap: wrap; }
.course-meta .teacher { color: #5a8def; }
.course-foot {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 1px dashed var(--border); padding-top: 10px; margin-top: auto;
}
.price { color: var(--primary); font-weight: 700; font-size: 17px; }
.price .free { color: #3fb42f; }
.price .orig {
  font-size: 12px; color: #c0c7d0; font-weight: 400; margin-left: 6px; text-decoration: line-through;
}
.student-num { font-size: 12px; color: var(--text-light); }

/* ---------- 热门横排 ---------- */
.hot-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.hot-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; gap: 14px; align-items: center; transition: transform .2s;
}
.hot-card:hover { transform: translateY(-3px); }
.hot-badge {
  flex-shrink: 0; width: 54px; height: 54px; border-radius: 14px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600;
  background: #3a4452; overflow: hidden;
}
.hot-thumb {
  width: 54px; height: 54px; border-radius: 14px; object-fit: cover; display: block;
  flex-shrink: 0; background: #3a4452;
}
.hot-card .info h3 { font-size: 14px; margin-bottom: 4px; line-height: 1.4; }
.hot-card .info p { font-size: 12px; color: var(--text-light); }
.hot-card .buy {
  margin-left: auto; flex-shrink: 0; font-size: 13px; padding: 6px 14px;
}

/* ---------- 页面小标题 ---------- */
.page-title { font-size: 24px; margin: 28px 0 20px; }
.page-title small { font-size: 13px; color: var(--text-light); margin-left: 10px; }

/* ---------- 课程列表筛选 ---------- */
.filter-bar {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 20px; margin-bottom: 20px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.filter-bar a {
  padding: 5px 16px; border-radius: 16px; color: var(--text-light); font-size: 14px;
}
.filter-bar a.active, .filter-bar a:hover { background: var(--primary); color: #fff; }

/* ---------- 详情页 ---------- */
.course-detail { display: grid; grid-template-columns: 1fr 340px; gap: 24px; margin: 28px 0 48px; }
.detail-main { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.detail-hero { padding: 28px 32px; color: #fff; }
.detail-hero h1 { font-size: 24px; margin-bottom: 10px; }
.detail-hero .sub { opacity: .9; font-size: 14px; margin-bottom: 14px; }
.detail-hero .stats { display: flex; gap: 22px; font-size: 13px; opacity: .95; }
.detail-desc { padding: 24px 32px; }
.detail-desc h2 { font-size: 18px; margin-bottom: 14px; }
.detail-desc p { color: var(--text-light); white-space: pre-wrap; }

/* 章节课时 */
.chapter-list { padding: 0 32px 32px; }
.chapter { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; overflow: hidden; }
.chapter-title {
  background: #f8fafc; padding: 12px 18px; font-weight: 600; font-size: 15px;
  display: flex; justify-content: space-between; align-items: center;
}
.chapter-title .cnt { font-size: 12px; color: var(--text-light); font-weight: 400; }
.lesson { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-top: 1px solid #f0f3f6; }
.lesson .icon { color: var(--primary); }
.lesson .name { flex: 1; font-size: 14px; }
.lesson .dur { font-size: 12px; color: var(--text-light); }
.lesson .preview-badge {
  font-size: 11px; color: #3fb42f; border: 1px solid #3fb42f; border-radius: 4px; padding: 0 6px;
}
.lesson.locked { color: var(--text-light); }
.lesson a { color: var(--primary); font-size: 13px; }

/* 侧栏购买卡 */
.buy-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; position: sticky; top: 84px; height: fit-content;
}
.buy-card .price-line { margin-bottom: 6px; }
.buy-card .price-line .price { font-size: 30px; }
.buy-card .meta-list { margin: 14px 0 18px; }
.buy-card .meta-list li {
  display: flex; justify-content: space-between; padding: 7px 0;
  border-bottom: 1px dashed var(--border); font-size: 13px; color: var(--text-light);
}
.buy-card .meta-list li span:last-child { color: var(--text); }
.buy-card .actions { display: flex; flex-direction: column; gap: 10px; }
.owner-note { font-size: 12px; color: #3fb42f; text-align: center; padding: 8px; background: #f0f9eb; border-radius: 8px; }

/* ---------- 表单 ---------- */
.auth-wrap { max-width: 440px; margin: 48px auto 64px; }
.auth-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 36px 40px;
}
.auth-card h1 { font-size: 22px; margin-bottom: 24px; text-align: center; }
.form-item { margin-bottom: 18px; }
.form-item label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; outline: none; transition: border .2s; background: #fff;
}
.form-item input:focus, .form-item textarea:focus, .form-item select:focus { border-color: var(--primary); }
.form-item .input-group { display: flex; gap: 10px; }
.form-item .input-group input { flex: 1; }
.form-item .hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-error { color: #c45656; font-size: 13px; margin-bottom: 14px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--text-light); margin-top: 18px; }
.auth-foot a { color: var(--primary); }
.code-tip {
  background: #fdf6ec; border: 1px solid #faecd8; color: #b88230;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px;
}
.code-tip b { font-size: 18px; letter-spacing: 4px; }

/* ---------- 个人中心 ---------- */
.user-layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; margin: 28px 0 48px; }
.side-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.side-card .profile { padding: 24px 16px; text-align: center; border-bottom: 1px solid var(--border); }
.avatar {
  width: 60px; height: 60px; border-radius: 50%; margin: 0 auto 10px;
  background: #3a4452; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 600;
}
.profile .email { font-size: 12px; color: var(--text-light); word-break: break-all; }
.side-nav a {
  display: block; padding: 13px 22px; font-size: 14px; color: var(--text);
  border-left: 3px solid transparent;
}
.side-nav a.active { color: var(--primary); background: #fff1f0; border-left-color: var(--primary); font-weight: 600; }
.panel-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 30px;
}
.panel-card h2 { font-size: 18px; margin-bottom: 20px; }
.panel-card + .panel-card { margin-top: 20px; }

/* 表格 */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.data-table th { color: var(--text-light); font-weight: 500; background: #fafbfc; }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px;
}
.badge-paid { background: #f0f9eb; color: #529b2e; }
.badge-pending { background: #fdf6ec; color: #b88230; }
.badge-cancelled { background: #f4f4f5; color: #909399; }
.badge-free { background: #f0f9eb; color: #3fb42f; }
.badge-charge { background: #fff1f0; color: #e63946; }
.badge-admin { background: #ecf5ff; color: #409eff; }
.badge-user { background: #f4f4f5; color: #909399; }
.badge-on { background: #f0f9eb; color: #529b2e; }
.badge-off { background: #fde2e2; color: #c45656; }

/* 我的课程网格 */
.my-course-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.my-course {
  display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
}
.my-course .mini-cover {
  width: 86px; height: 58px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #3a4452; color: #fff; font-size: 12px; text-align: center; padding: 4px;
  overflow: hidden;
}
.my-course .mini-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 学习页 ---------- */
.learn-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; margin: 24px 0 48px; }
.player-card {
  background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.player-card video { width: 100%; display: block; aspect-ratio: 16/9; background: #000; }
.player-info { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; margin-top: 18px; }
.player-info h1 { font-size: 18px; margin-bottom: 8px; }
.player-info p { font-size: 13px; color: var(--text-light); }
.lesson-menu { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; max-height: 640px; overflow-y: auto; }
.lesson-menu h3 { font-size: 15px; margin-bottom: 12px; padding-left: 4px; }
.lesson-menu .chapter { border: none; margin-bottom: 6px; }
.lesson-menu .chapter-title { background: transparent; padding: 8px 6px; font-size: 14px; }
.lesson-menu .lesson { padding: 8px 8px; font-size: 13px; }
.lesson-menu .lesson.current { background: #fff1f0; border-radius: 8px; color: var(--primary); }

/* ---------- 支付页 ---------- */
.pay-wrap { max-width: 560px; margin: 40px auto 60px; }
.pay-amount { text-align: center; margin: 18px 0 6px; }
.pay-amount .num { font-size: 40px; color: var(--primary); font-weight: 700; }
.pay-methods { display: flex; gap: 12px; margin: 20px 0; }
.pay-method {
  flex: 1; border: 2px solid var(--border); border-radius: 10px; padding: 14px;
  text-align: center; cursor: pointer; transition: border .2s; font-size: 14px;
}
.pay-method.selected { border-color: var(--primary); background: #fff1f0; }
.pay-method .ico { font-size: 24px; display: block; margin-bottom: 4px; }

/* ---------- 后台 ---------- */
.admin-layout { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.admin-side { background: #1f2733; color: #cfd8e3; padding: 20px 0; }
.admin-side .brand { color: #fff; font-size: 17px; font-weight: 700; padding: 0 22px 18px; border-bottom: 1px solid #303c4d; }
.admin-side nav a {
  display: block; padding: 12px 22px; color: #cfd8e3; font-size: 14px; border-left: 3px solid transparent;
}
.admin-side nav a:hover { color: #fff; background: #28323f; }
.admin-side nav a.active { color: #fff; border-left-color: var(--primary); background: #28323f; }
.admin-main { padding: 24px 28px; background: #f5f6f8; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-topbar h1 { font-size: 20px; }
.admin-card { background: #fff; border-radius: 10px; padding: 20px 24px; box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
  background: #fff; border-radius: 10px; padding: 18px 22px; box-shadow: var(--shadow);
}
.stat .num { font-size: 26px; font-weight: 700; }
.stat .label { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.table-actions { display: flex; gap: 8px; }
.table-actions a, .table-actions button {
  font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer; border: 1px solid var(--border);
  background: #fff; color: var(--text-light);
}
.table-actions .danger { color: #c45656; border-color: #fde2e2; }

/* ---------- 安装向导 ---------- */
.install-wrap { max-width: 640px; margin: 40px auto; }
.step-indicator { display: flex; gap: 8px; margin-bottom: 24px; }
.step-indicator span {
  flex: 1; text-align: center; padding: 8px; border-radius: 8px; font-size: 13px;
  background: #f0f2f5; color: var(--text-light);
}
.step-indicator span.on { background: var(--primary); color: #fff; }
.step-indicator span.done { background: #f0f9eb; color: #529b2e; }

/* ---------- 页脚 ---------- */
.site-footer { background: #fff; border-top: 1px solid var(--border); margin-top: 48px; padding: 32px 0; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: space-between; }
.footer-logo { font-size: 18px; font-weight: 700; }
.footer-slogan { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.footer-links { display: flex; gap: 20px; font-size: 13px; color: var(--text-light); }
.footer-links a:hover { color: var(--primary); }
.footer-copy { font-size: 12px; color: #b6bec9; width: 100%; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .course-grid { grid-template-columns: repeat(3, 1fr); }
  .hot-strip { grid-template-columns: 1fr; }
  .course-detail, .learn-layout, .user-layout { grid-template-columns: 1fr; }
  .search-box input { width: 120px; }
}
@media (max-width: 720px) {
  .course-grid, .my-course-grid, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .main-nav { display: none; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side nav { display: flex; flex-wrap: wrap; }
}
