/* 绿领巾公考知识库 - 基础样式
   响应式：一套代码适配 PC 和手机
   品牌色：#43a047（绿）
*/

:root {
  --brand: #43a047;
  --brand-dark: #2e7d32;
  --brand-light: #e8f5e9;
  --text: #1f2933;
  --text-secondary: #6b7280;
  --bg: #f7f9fa;
  --border: #e5e7eb;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- 顶部 ---------- */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-dark);
  margin: 0;
}
.logo::before {
  content: '绿';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(67,160,71,.3);
}
.user-box {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

/* ☰ 菜单按钮：只在手机端出现（见下面 640px 那段） */
.ub-toggle { display: none; }

/* 顶栏里常驻在 ☰ 左边的元素（预览页的「⤓ 下载」），整组靠右 */
.head-dl { margin-left: auto; }

/* ---------- 按钮 ---------- */
.btn-primary {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 14px;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { background: var(--brand-dark); }

.btn-link {
  color: var(--brand-dark);
  text-decoration: none;
  font-size: 14px;
}
.btn-link:hover { text-decoration: underline; }

/* ---------- 提示条 ---------- */
.notice {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 20px 0;
  font-size: 14px;
}

/* ---------- 首页欢迎区 ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  border-radius: 14px;
  padding: 30px 30px 26px;
  margin: 24px 0 8px;
  box-shadow: 0 6px 18px rgba(46,125,50,.18);
}
.hero h2 {
  margin: 0 0 8px;
  font-size: 23px;
  font-weight: 700;
}
.hero p {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.7;
  opacity: .94;
}
.hero .hero-sub {
  margin-top: 12px;
  font-size: 17px;
  opacity: .95;
}
.hero .hero-sub strong {
  font-size: 23px;
  font-weight: 700;
  margin: 0 3px;
}

.section-title {
  font-size: 20px;
  margin: 28px 0 16px;
}

/* ---------- 课程包卡片 ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .2s, transform .2s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  transform: translateY(-2px);
}
.product-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}
.product-card .desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 12px;
}

/* 课程分类标签（卡片顶部色块，与状态标签并排） */
.product-card .tag {
  display: inline-block;
  font-size: 12px;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 20px;
  color: #fff;
  background: var(--brand);
  font-weight: 500;
}

/* 卡片顶部一行：分类标签 + 状态标签 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

/* 已开通 / 未开通状态标签 */
.product-card .status {
  font-size: 12px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.product-card .status-on {
  background: var(--brand-light);
  color: var(--brand-dark);
  border: 1px solid #c8e6c9;
}
.product-card .status-off {
  background: #f3f4f6;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.product-card.locked { background: #fafafa; }
.product-card.locked:hover { background: #fff; }

/* 卡片底部：有效期 + 进入 */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: auto;
}
.validity {
  font-size: 12px;
  color: var(--text-secondary);
}
.validity .warn {
  color: #e65100;
  font-style: normal;
}
.go {
  font-size: 13px;
  color: var(--brand-dark);
  white-space: nowrap;
}

/* 空态：没买任何课程 */
.empty-state {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  margin-bottom: 40px;
}
.empty-title {
  font-size: 17px;
  margin: 0 0 6px;
}
.empty-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 20px;
}

/* 空态里的引导按钮组（kk 2026-09-09：注册后引导兑换；按钮上下排，主按钮在上） */
.empty-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.btn-outline {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--brand);
  color: var(--brand);
  border-radius: var(--radius);
  font-size: 14px;
  text-decoration: none;
}
.btn-outline:hover { background: var(--brand-light); }
/* 已有课程后，底部继续兑换的入口 */
.more-redeem {
  margin: 28px 0 40px;
  padding: 20px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
}
.more-redeem span { margin-right: 12px; }

.add-more {
  margin: -16px 0 40px;
  font-size: 14px;
  color: var(--text-secondary);
}
.add-more a { color: var(--brand-dark); }

/* ---------- 底部 ---------- */
.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 20px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------- 首页左侧菜单 ---------- */
.home-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
  margin-top: 24px;
  margin-bottom: 40px;
}
.home-sidebar {
  position: sticky;
  top: 84px;
}
.side-title {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 0 12px 8px;
  letter-spacing: .5px;
}
.side-menu {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.side-item:hover { background: var(--brand-light); }
.side-item.on {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 600;
}
.home-main { min-width: 0; }

/* 浅色 hero（子页面用） */
.hero-soft {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.hero-soft h2 { color: var(--brand-dark); }
.hero-soft p { opacity: 1; color: var(--text-secondary); }

/* 信息面板（个人中心 / 帮助） */
.panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
}
.panel-title {
  margin: 0 0 14px;
  font-size: 16px;
  color: var(--brand-dark);
}
.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.info-list li {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-list li:last-child { border-bottom: none; }
.info-list li span { color: var(--text-secondary); }

.faq-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.faq-item:last-child { border-bottom: none; }
.faq-item .q { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.faq-item .a { margin: 0; font-size: 14px; color: var(--text-secondary); line-height: 1.7; }

/* ---------- 404 ---------- */
.notfound {
  text-align: center;
  padding: 80px 16px;
}
.notfound h1 {
  font-size: 64px;
  color: var(--border);
  margin: 0;
}

/* ---------- 手机端适配 ---------- */
@media (max-width: 640px) {
  .site-header .container { height: 54px; }
  .logo { font-size: 16px; }
  .product-grid { grid-template-columns: 1fr; }
  .section-title { font-size: 18px; }
  .home-layout { grid-template-columns: 1fr; margin-top: 16px; }
  .home-sidebar { position: static; }

  /* 5 个入口排成整齐的两列，最后一个占满整行（kk 2026-09-10） */
  .side-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .side-item { text-align: center; }
  .side-item:last-child:nth-child(odd) { grid-column: 1 / -1; }

  /* 顶栏右侧收进 ☰ 抽屉 */
  .ub-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 20px;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    flex: none;
  }
  /* ⚠️ 抽屉只能用 #ubBox 选择器，不能用 .user-box —— index/courses 未登录时
     那个「登录 / 注册」也带 .user-box，写成 .user-box 会把它一起隐藏掉。 */
  #ubBox {
    /* .site-header 是 sticky（已定位），所以这里以它为基准往下挂 */
    position: absolute;
    top: 100%;
    right: 12px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 152px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    z-index: 200;
  }
  #ubBox.open { display: flex; }
  #ubBox a,
  #ubBox .ub-phone {
    padding: 10px 12px;
    border-radius: 6px;
    text-align: left;
  }
  #ubBox a:hover { background: var(--brand-light); }
  #ubBox .ub-phone {
    color: var(--text-secondary);
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
  }
}

/* ---------- 页脚备案号 ---------- */
.site-footer .beian {
  margin-top: 6px;
  font-size: 12px;
  opacity: 0.8;
}
.site-footer .beian a {
  color: inherit;
  text-decoration: none;
}
.site-footer .beian a:hover { color: var(--brand); }

/* 公安备案图标（官方要求：图标在编号左侧，建议 16×17 px） */
img.beian-icon {
  width: 16px;
  height: 17px;
  vertical-align: -2px;
  margin-right: 3px;
  border: 0;
}
.beian-sep { margin: 0 6px; opacity: 0.6; }

/* ---------- 个人中心：修改密码 ---------- */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-ok { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-err { background: #fdecea; color: #c62828; border: 1px solid #f5c6c3; }

.pwd-form {
  max-width: 360px;
}
.pwd-form label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin: 14px 0 6px;
}
.pwd-form label:first-of-type { margin-top: 0; }
.pwd-form input {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.pwd-form input:focus {
  outline: none;
  border-color: var(--brand);
}
.pwd-form button {
  margin-top: 18px;
  width: 100%;
}
