/* ===== Học quán Sơn Chu — giao diện "kiểu Facebook" cho các trang phụ (KHÔNG áp dụng trang chủ) =====
   Mọi quy tắc đặt dưới .fb-shell để không ảnh hưởng trang chủ (vẫn dùng sonchu.css gốc).
   Bố cục: thanh trên dính 3 vùng (logo+tìm kiếm | tab icon | nút tròn+tài khoản)
           + thân 3 cột (rail trái | nội dung thẻ trắng | rail phải). */

.fb-shell {
  /* ĐỒNG BỘ với sonchu.css + index.css — palette "tông logo Sơn Chu" */
  --fb-bg: #faf7f0;          /* kem ngà (nền chung toàn site) */
  --fb-card: #fffdf8;        /* thẻ ngà sáng */
  --fb-text: #241c16;        /* đen mực ấm (chữ chính) */
  --fb-text-2: #6a5b50;
  --fb-line: #e4dccb;        /* viền ngà ấm */
  --fb-hover: #f3eee2;
  --fb-hover-2: #ece3d2;
  /* Điểm nhấn = lục ngọc lấy từ logo (#007030/#008040) */
  --fb-blue: #007a37;
  --fb-blue-d: #005f2a;
  --fb-blue-soft: #e2f0e8;   /* nền nhạt cho mục đang chọn */
  --fb-gold: #a9762e;        /* đồng — điểm nhấn phụ */
  --fb-topbar-h: 56px;
  background: var(--fb-bg);
  color: var(--fb-text);
}

/* ---------- Thanh trên (top bar) ---------- */
.fb-top {
  position: sticky; top: 0; z-index: 50;
  background: var(--fb-card);
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 0 0 1px rgba(0,0,0,.04);
  height: var(--fb-topbar-h);
}
.fb-top-in {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; height: 100%;
  padding: 0 16px; gap: 8px;
}

/* Vùng trái: logo + ô tìm kiếm */
.fb-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fb-brand { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.fb-brand .mark { width: 40px; height: 40px; object-fit: contain; }
.fb-brand b { font-size: 15px; color: var(--fb-text); line-height: 1.05; white-space: nowrap; }
.fb-brand small { display: block; font-size: 10.5px; color: var(--fb-text-2); font-weight: 600; }
.fb-search {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--fb-hover-2); border-radius: 999px;
  padding: 0 14px; height: 40px; min-width: 0; width: 240px; max-width: 240px; flex: none;
  margin-left: 14px; /* tách icon tìm kiếm xa logo trái một chút */
  color: var(--fb-text-2); overflow: hidden;
  transition: width .22s ease, max-width .22s ease, padding .22s ease, background .15s;
}
/* Mặc định: chỉ hiện icon kính lúp (hình tròn). Bấm → mở rộng ô nhập. */
.fb-search.collapsed { width: 40px; max-width: 40px; padding: 0; justify-content: center; cursor: pointer; }
.fb-search.collapsed:hover { background: var(--fb-line); }
.fb-search.collapsed input { width: 0; opacity: 0; pointer-events: none; }
.fb-search.open { width: 264px; max-width: 264px; }

/* Nút theo dõi/like mạng xã hội (logo thương hiệu, nền tròn màu thương hiệu) */
.social-links { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.social-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%; color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
  transition: transform .12s ease, filter .15s, box-shadow .15s;
}
.social-ic svg { width: 38px; height: 38px; display: block; }
.social-ic:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 4px 12px rgba(0, 0, 0, .28); }
.fb-search-ic { display: inline-flex; flex: none; }
.fb-search svg { width: 18px; height: 18px; flex: none; }
.fb-search input {
  border: 0; background: none; outline: none; width: 100%;
  font: inherit; font-size: 15px; color: var(--fb-text);
}
.fb-search input::placeholder { color: var(--fb-text-2); }

/* Vùng giữa: tab icon lớn + gạch dưới khi active */
.fb-tabs { display: flex; align-items: stretch; gap: 4px; height: 100%; }
.fb-tab {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 96px; max-width: 14vw; border-radius: 8px; margin: 6px 0;
  color: var(--fb-text-2); transition: background .15s;
}
.fb-tab svg { width: 26px; height: 26px; }
.fb-tab:hover { background: var(--fb-hover); color: var(--fb-text-2); }
.fb-tab.active { color: var(--fb-blue); }
.fb-tab.active::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: -6px;
  height: 3px; border-radius: 3px 3px 0 0; background: var(--fb-blue);
}
.fb-tab .fb-tip {
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: #404040; color: #fff; font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 7px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 60;
}
.fb-tab:hover .fb-tip { opacity: 1; }

/* Vùng phải: nút tròn + tài khoản */
.fb-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.fb-icon-btn {
  position: relative;
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border-radius: 999px; background: var(--fb-hover-2); color: var(--fb-text);
  border: 0; cursor: pointer; transition: background .15s; flex: none;
}
/* Badge số chưa đọc (đỏ, góc trên-phải) — kiểu Facebook */
.fb-badge {
  position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 999px; background: #e0384f; color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  border: 2px solid var(--fb-card); box-sizing: content-box;
}
.fb-icon-btn:hover { background: var(--fb-line); color: var(--fb-text); }
.fb-icon-btn svg { width: 20px; height: 20px; }

/* ---------- Dropdown xem nhanh Tin nhắn / Thông báo ---------- */
.fb-dd { position: relative; display: inline-flex; }
.fb-dd-pop {
  position: absolute; right: 0; top: calc(100% + 10px); width: 360px; max-width: 92vw;
  background: var(--fb-card); border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0,0,0,.2), 0 2px 4px rgba(0,0,0,.1);
  z-index: 70; overflow: hidden;
}
.fb-dd-head { padding: 12px 16px 8px; font-size: 19px; font-weight: 800; color: var(--fb-text); }
.fb-dd-list { max-height: 64vh; overflow-y: auto; padding: 4px 6px; }
.fb-dd-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--fb-text);
}
.fb-dd-item:hover { background: var(--fb-hover); color: var(--fb-text); }
.fb-dd-item.unread { background: var(--fb-blue-soft); }
.fb-dd-av, .fb-dd-ic {
  width: 40px; height: 40px; border-radius: 999px; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--fb-hover-2); color: var(--fb-blue); font-weight: 700;
}
.fb-dd-av img { width: 100%; height: 100%; object-fit: cover; }
.fb-dd-ic svg { width: 20px; height: 20px; }
.fb-dd-tx { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.fb-dd-tx b { font-size: 13.5px; font-weight: 600; line-height: 1.25; color: var(--fb-text); }
.fb-dd-tx span { font-size: 12.5px; color: var(--fb-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-dd-time { flex: none; font-size: 11.5px; color: var(--fb-text-2); white-space: nowrap; padding-top: 2px; }
.fb-dd-empty { padding: 28px 16px; text-align: center; color: var(--fb-text-2); font-size: 13.5px; }
.fb-dd-all {
  display: block; text-align: center; padding: 11px; border-top: 1px solid var(--fb-line);
  color: var(--fb-blue); font-weight: 700; font-size: 13.5px;
}
.fb-dd-all:hover { background: var(--fb-hover); color: var(--fb-blue-d); }

.fb-account { position: relative; }
.fb-account > summary, .fb-account-btn {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
}
.fb-account > summary::-webkit-details-marker { display: none; }
.fb-avatar {
  width: 40px; height: 40px; border-radius: 999px; flex: none;
  background: var(--fb-blue); color: #fff;
  display: grid; place-items: center; font-weight: 700; overflow: hidden;
}
.fb-avatar svg { width: 22px; height: 22px; }
.fb-avatar.avatar-img, .fb-avatar img { width: 40px; height: 40px; object-fit: cover; }
.fb-login {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--fb-blue); color: #fff; font-weight: 700; font-size: 15px;
  padding: 8px 16px; border-radius: 8px; white-space: nowrap;
}
.fb-login:hover { background: var(--fb-blue-d); color: #fff; }
.fb-pop {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 240px;
  background: var(--fb-card); border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.2), 0 2px 4px rgba(0,0,0,.1);
  padding: 8px; z-index: 70; display: flex; flex-direction: column; gap: 2px;
}
.fb-pop a, .fb-pop button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 10px 10px; border-radius: 8px; font-size: 15px; font-weight: 600;
  color: var(--fb-text); background: none; border: 0; cursor: pointer; font-family: inherit;
}
.fb-pop a:hover, .fb-pop button:hover { background: var(--fb-hover); }
.fb-pop .fb-ic { width: 36px; height: 36px; border-radius: 999px; background: var(--fb-hover-2); display: grid; place-items: center; flex: none; }
.fb-pop .fb-ic svg { width: 18px; height: 18px; }
.fb-pop .fb-logout { color: #d33; }

/* ---------- Thân: 3 cột ---------- */
.fb-body {
  display: grid; grid-template-columns: 76px minmax(0,1fr) 288px;
  gap: 16px; align-items: start;
  max-width: 1280px; margin: 0 auto; padding: 16px;
}
/* Trang không có mục lục (ít hơn 2 phần) → bỏ cột icon trái. */
.fb-body.no-toc { grid-template-columns: minmax(0,1fr) 288px; }
.fb-body.no-toc .fb-left-rail { display: none; }
.fb-rail { position: sticky; top: calc(var(--fb-topbar-h) + 16px); }

/* ---------- Mục lục trang (cột icon trái, kiểu app launcher) ---------- */
.fb-toc { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.fb-toc-item {
  position: relative; width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center; flex: none;
  background: var(--fb-card); border: 1px solid var(--fb-line);
  color: var(--fb-text-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.fb-toc-item:hover { background: var(--fb-hover-2); color: var(--fb-text); }
.fb-toc-item.active { background: var(--fb-blue); border-color: var(--fb-blue); color: #fff; }
.fb-toc-item svg { width: 22px; height: 22px; }
.fb-toc-item .fb-toc-num { font-weight: 700; font-size: 15px; }
/* Nhãn hiện khi rê chuột (tooltip bên phải) */
.fb-toc-item .fb-toc-tip {
  position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  background: #2b2620; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1.2;
  padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 40;
}
.fb-toc-item:hover .fb-toc-tip { opacity: 1; }
/* Bù chiều cao topbar khi nhảy tới section */
.fb-panel [id] { scroll-margin-top: calc(var(--fb-topbar-h) + 16px); }

/* ---------- Box "Ủng hộ tác giả" (đáy rail phải) ---------- */

/* Rail trái — danh sách shortcut */
.fb-shortcuts { display: flex; flex-direction: column; gap: 2px; }
.fb-shortcut {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 8px; font-weight: 600; font-size: 14px;
  color: var(--fb-text);
}
.fb-shortcut:hover { background: var(--fb-hover-2); color: var(--fb-text); }
.fb-shortcut.active { background: var(--fb-blue-soft); color: var(--fb-blue); }
.fb-shortcut .fb-ic {
  width: 32px; height: 32px; border-radius: 999px; flex: none;
  background: var(--fb-hover-2); display: grid; place-items: center; color: var(--fb-blue);
}
.fb-shortcut.active .fb-ic { background: var(--fb-blue); color: #fff; }
.fb-shortcut .fb-ic svg { width: 18px; height: 18px; }
.fb-rail-sep { height: 1px; background: var(--fb-line); margin: 8px 4px; }
.fb-rail-h { font-size: 17px; font-weight: 700; color: var(--fb-text-2); padding: 4px 8px; }

/* Cột giữa — nội dung trong thẻ trắng */
.fb-center { min-width: 0; }
.fb-panel {
  background: var(--fb-card); border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
/* Trung hòa .wrap của sonchu.css để nội dung vừa khít cột giữa */
.fb-center .wrap { max-width: 100% !important; padding-left: 28px; padding-right: 28px; }

/* Rail phải — thẻ phụ */
.fb-card2 {
  background: var(--fb-card); border-radius: 12px; padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.1); margin-bottom: 16px;
}
.fb-card2 h4 { margin: 0 0 10px; font-size: 16px; color: var(--fb-text); }
.fb-card2 .fb-row {
  display: flex; align-items: center; gap: 12px; padding: 8px;
  border-radius: 8px; color: var(--fb-text); font-weight: 600; font-size: 15px;
}
.fb-card2 .fb-row:hover { background: var(--fb-hover); color: var(--fb-text); }
.fb-card2 .fb-row .fb-ic { width: 36px; height: 36px; border-radius: 999px; background: var(--fb-hover-2); display: grid; place-items: center; color: var(--fb-blue); flex: none; }
.fb-card2 .fb-row .fb-ic svg { width: 19px; height: 19px; }
.fb-cta {
  display: block; text-align: center; background: var(--fb-blue); color: #fff;
  font-weight: 700; padding: 10px; border-radius: 8px; margin-top: 6px;
}
.fb-cta:hover { background: var(--fb-blue-d); color: #fff; }

/* ---------- Box "Ủng hộ tác giả" (đáy rail phải) ---------- */
.fb-donate {
  background: var(--fb-card); border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.1); border: 1px solid var(--fb-blue-soft);
}
.fb-donate-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; color: #fff;
  background: linear-gradient(135deg, var(--fb-blue), var(--fb-blue-d));
}
.fb-donate-ic {
  flex: none; width: 34px; height: 34px; border-radius: 999px;
  background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 17px;
}
.fb-donate-ttl b { display: block; font-size: 15px; line-height: 1.15; }
.fb-donate-ttl small { font-size: 11px; color: rgba(255,255,255,.85); }
.fb-donate-body { padding: 14px; text-align: center; }
.fb-donate-note { margin: 0 0 12px; font-size: 13px; line-height: 1.55; color: var(--fb-text-2); }
.fb-donate-qr {
  width: fit-content; margin: 0 auto; padding: 8px; background: #fff;
  border-radius: 12px; border: 1px solid var(--fb-line);
}
.fb-donate-qr img { width: 160px; height: 160px; object-fit: cover; border-radius: 8px; display: block; }
.fb-donate-acc {
  margin: 12px 0 0; padding: 8px 12px; white-space: pre-line;
  background: var(--fb-blue-soft); border-radius: 10px;
  font-size: 13px; font-weight: 600; color: var(--fb-text);
}
.fb-donate-foot { margin: 12px 0 0; font-size: 11px; color: var(--fb-text-2); }
.fb-donate-foot::first-letter { color: var(--fb-blue); }

/* ---------- Chân trang gọn ---------- */
.fb-foot { color: var(--fb-text-2); font-size: 13px; text-align: center; padding: 8px 16px 28px; }
.fb-foot a { color: var(--fb-text-2); }

/* nút mở menu trên di động */
.fb-burger { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .fb-body { grid-template-columns: minmax(0,1fr) 300px; }
  .fb-left-rail { display: none; }
}
@media (max-width: 900px) {
  .fb-body { grid-template-columns: minmax(0,1fr); }
  .fb-right-rail { display: none; }
  .fb-tabs { display: none; }
  .fb-search { max-width: none; }
}
@media (max-width: 640px) {
  .fb-brand b, .fb-brand small { display: none; }
  .fb-top-in { grid-template-columns: auto 1fr auto; }
  .fb-login span.fb-login-t { display: none; }
}
