/* ============================================================
   英语学习站 全局样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #2f9e77;
  --primary-dark: #1f7a58;
  --primary-light: #e6f5ef;
  --accent: #f5a623;
  --bg: #f4f7f6;
  --card: #ffffff;
  --text: #243b34;
  --text-light: #6b827a;
  --border: #dfe8e4;
  --danger: #d9534f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(36, 59, 52, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary-dark); text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-size: 20px; font-weight: 700; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
.brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--primary), #4cc9a0);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.topbar .user-area { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .user-name { color: var(--text-light); }
.topbar .nav-links { display: flex; gap: 16px; align-items: center; }
.topbar .nav-links a { font-size: 14px; font-weight: 600; color: var(--text); }
.topbar .nav-links a:hover { color: var(--primary-dark); }
.topbar .nav-links a.active { color: var(--primary-dark); border-bottom: 2px solid var(--primary); padding-bottom: 3px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 10px 20px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  background: var(--primary); color: #fff;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: scale(0.98); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--primary-dark); border: 1.5px solid var(--primary); }
.btn.ghost:hover { background: var(--primary-light); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b53e3a; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-control {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border);
  border-radius: 10px; font-size: 15px; background: #fff; color: var(--text);
  transition: border-color 0.15s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { appearance: auto; }

/* ---------- 登录页 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(160deg, #eef8f4 0%, #e3f2ec 50%, #f7efe0 100%);
}
.auth-card {
  background: #fff; border-radius: 20px; box-shadow: 0 10px 40px rgba(31, 122, 88, 0.15);
  padding: 36px 32px; width: 100%; max-width: 400px;
}
.auth-card .logo-big {
  width: 58px; height: 58px; border-radius: 15px; margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), #4cc9a0);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.auth-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; color: var(--text-light); font-size: 14px; margin-bottom: 24px; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 22px; }
.auth-tabs button {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text-light);
}
.auth-tabs button.active { background: #fff; color: var(--primary-dark); box-shadow: var(--shadow); }
.msg { min-height: 22px; font-size: 14px; margin-bottom: 12px; text-align: center; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--primary-dark); }

/* ---------- 页面容器 ---------- */
.container { max-width: 960px; margin: 0 auto; padding: 24px 16px 60px; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--text-light); font-size: 14px; margin-bottom: 20px; }

/* ---------- 分类 Tab ---------- */
.cats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.cat-pill {
  border: 1.5px solid var(--border); background: #fff; color: var(--text);
  border-radius: 999px; padding: 7px 16px; font-size: 14px; cursor: pointer; font-weight: 500;
  transition: all 0.15s;
}
.cat-pill:hover { border-color: var(--primary); color: var(--primary-dark); }
.cat-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- 课程卡片 ---------- */
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.lesson-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; cursor: pointer; transition: transform 0.12s, box-shadow 0.12s;
  border: 1px solid transparent;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(36, 59, 52, 0.14); }
.lesson-card .card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.type-badge {
  font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-dark); white-space: nowrap;
}
.type-badge.audio { background: #fdf3e3; color: #b97a0e; }
.type-badge.pdf { background: #fdeaea; color: #c0392b; }
.type-badge.image { background: #e8f0fd; color: #2c6cb0; }
.lesson-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.lesson-card p.desc {
  font-size: 13px; color: var(--text-light); margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lesson-card .card-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-light); }
.status-badge { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.status-badge.completed { background: var(--primary-light); color: var(--primary-dark); }
.status-badge.in_progress { background: #fdf3e3; color: #b97a0e; }
.status-badge.not_started { background: #eef1f0; color: var(--text-light); }
.empty-tip { text-align: center; color: var(--text-light); padding: 60px 0; font-size: 15px; }
.loading-tip { text-align: center; color: var(--text-light); padding: 40px 0; }

/* ---------- 学习页 ---------- */
.learn-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.learn-head { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.learn-head h1 { font-size: 22px; margin-bottom: 6px; }
.learn-head .meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.learn-body { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.learn-body audio { width: 100%; margin: 8px 0; }
.learn-body img { max-width: 100%; border-radius: 10px; }
.learn-body iframe { width: 100%; height: 75vh; border: 1px solid var(--border); border-radius: 10px; }
.text-content { white-space: pre-wrap; font-size: 16px; line-height: 1.9; }
.text-content .label { font-weight: 700; color: var(--primary-dark); }
.learn-actions { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.back-link { display: inline-block; margin-bottom: 14px; font-size: 14px; font-weight: 600; }

/* ---------- 管理页 ---------- */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel h2 { font-size: 18px; margin-bottom: 16px; }
.panel .hint { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }
.admin-list-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.admin-list-item:last-child { border-bottom: none; }
.admin-list-item .info { flex: 1; min-width: 0; }
.admin-list-item .info b { font-size: 15px; display: block; }
.admin-list-item .info span { font-size: 12px; color: var(--text-light); }

@media (max-width: 640px) {
  .container, .learn-wrap { padding: 16px 12px 50px; }
  .lessons { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; }
}