/* =========================================================
 * css/layout.css —— 骨架：Sidebar / Topbar / Page / 响应式
 * ========================================================= */

.app { position: relative; z-index: 1; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface-glass);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border-right: 1px solid var(--border);
  z-index: 80;
  transition: transform .32s cubic-bezier(.4, 0, .2, 1);
}
[data-theme="dark"] .sidebar { background: rgba(15, 21, 40, .74); }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 44px; height: 44px; flex: none;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 19px; color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-3));
  box-shadow: var(--sh-brand);
  position: relative;
  overflow: hidden;
}
.brand-mark::after {
  content: ""; position: absolute; inset: -40% -40% auto auto;
  width: 60px; height: 60px; border-radius: 50%;
  background: rgba(255, 255, 255, .22);
}
.brand-text strong { display: block; font-size: 15.5px; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--muted); display: block; line-height: 1.35; }

.side-scroll { flex: 1; overflow-y: auto; padding: 16px 12px 22px; }
.side-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: 1.3px; text-transform: uppercase;
  color: var(--muted); margin: 18px 12px 8px;
  display: flex; align-items: center; gap: 8px;
}
.side-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; margin-bottom: 3px;
  border-radius: 12px;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  transition: background .2s, color .2s, transform .2s, box-shadow .2s;
  position: relative;
}
.nav-item i:first-child { width: 18px; text-align: center; color: var(--muted); font-size: 14px; transition: color .2s; }
.nav-item .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; margin-top: -2px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(3px); }
.nav-item:hover i:first-child { color: var(--brand-1); }
.nav-item.active {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  color: #fff; box-shadow: var(--sh-brand);
}
.nav-item.active i:first-child, .nav-item.active .sub { color: rgba(255, 255, 255, .85); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 22px; border-radius: 0 4px 4px 0;
  background: var(--brand-3);
}
.nav-count {
  margin-left: auto; font-size: 10.5px; font-weight: 800;
  padding: 2px 7px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}
.nav-item.active .nav-count { background: rgba(255, 255, 255, .22); color: #fff; }

/* 侧栏可折叠大纲（15 课） */
.lesson-mini {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 14px; border-radius: 10px;
  font-size: 12.5px; color: var(--text-2);
  transition: background .18s, color .18s;
}
.lesson-mini:hover { background: var(--surface-2); color: var(--text); }
.lesson-mini .no {
  width: 20px; height: 20px; flex: none; border-radius: 6px;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
  background: var(--surface-2); color: var(--muted);
}
.lesson-mini.active { background: rgba(79, 70, 229, .12); color: var(--brand-1); font-weight: 700; }
.lesson-mini.active .no { background: var(--brand-1); color: #fff; }

.side-foot { padding: 14px 18px 18px; border-top: 1px solid var(--border); }
.side-foot .lbl { font-size: 12px; color: var(--text-2); font-weight: 600; display: flex; justify-content: space-between; }

/* ---------- 主区 ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: var(--surface-glass);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .topbar { background: rgba(15, 21, 40, .74); }
.hamburger {
  display: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface-2); color: var(--text-2); font-size: 15px;
}
.crumb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.crumb b { color: var(--text); font-weight: 600; }
.crumb .sep { opacity: .5; }

.searchbar { position: relative; max-width: 320px; flex: 1; }
.searchbar > i {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.searchbar input {
  width: 100%; height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 40px 0 36px;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.searchbar input:focus { border-color: var(--brand-1); box-shadow: 0 0 0 4px rgba(79, 70, 229, .14); }
.searchbar .kbd-hint {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  font-size: 10px; color: var(--muted); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; background: var(--surface-2);
}

.page { padding: 30px 34px 70px; width: 100%; max-width: 1240px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 28px; display: flex; align-items: center; gap: 12px; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.page-head .sub .vi-text { margin-left: 6px; }

.backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(11, 16, 32, .5);
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .page { padding: 26px 22px 70px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--sh-3); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: grid; place-items: center; }
  .crumb { display: none; }
  .topbar { padding: 0 16px; height: 64px; }
  .searchbar { max-width: none; }
  .page-head h1 { font-size: 23px; }
}
@media (max-width: 560px) {
  .page { padding: 20px 15px 60px; }
  .searchbar .kbd-hint { display: none; }
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main { margin: 0; }
}
