/* Trang gioi thieu SimFX (trang chu, Tai lieu, bai viet): Bootstrap 5 + vai chinh sua cho gon */
:root {
  --paper: #f6f5f1;
  --ink: #17191e;
  --ink-2: #4a4e57;
  --mute: #80838b;
  --rule: #dddad2;
  --accent: #2962ff;
  --accent-ink: #1946c8;
  --up: #089981;
  --tg: #229ed9;

  --bs-body-bg: var(--paper);
  --bs-body-color: var(--ink);
  --bs-body-font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

body { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
main { flex: 1; }
h1, h2 { letter-spacing: -0.02em; font-weight: 600; }
.num, .preview, .time { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* buttons */
.btn { border-radius: 6px; font-weight: 500; padding: 0.5rem 1rem; }
.btn-lg-ish { padding: 0.7rem 1.4rem; }
.btn-ink { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-ink:hover { background: #000; color: #fff; }
.btn-accent { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.link-arrow { color: var(--ink-2); font-size: 0.9rem; font-weight: 500; text-decoration: none; }
.link-arrow:hover { color: var(--ink); }
.link-arrow::after { content: " →"; }

/* nav */
.site-nav { padding: 0.8rem 0; border-bottom: 1px solid var(--rule); background: rgba(246,245,241,.94); backdrop-filter: blur(8px); }
.site-nav .nav-link { color: var(--ink-2); font-weight: 500; padding: 0.5rem 0.85rem !important; }
.site-nav .nav-link:hover, .site-nav .nav-link.show { color: var(--ink); }
.navbar-toggler:focus { box-shadow: none; }
.burger, .burger::before, .burger::after { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; } .burger::after { top: 6px; }
.contact-menu { --bs-dropdown-border-color: var(--rule); --bs-dropdown-link-active-bg: var(--paper); --bs-dropdown-link-active-color: var(--ink);
  --bs-dropdown-link-hover-bg: var(--paper); border-radius: 10px; padding: 0.4rem; min-width: 250px; box-shadow: 0 14px 34px -16px rgba(0,0,0,.3); }
.contact-menu .dropdown-item { display: flex; flex-direction: column; border-radius: 6px; padding: 0.55rem 0.75rem; white-space: normal; }
.dm-t { font-weight: 500; font-size: 0.93rem; }
.dm-d { font-size: 0.8rem; color: var(--mute); }
@media (max-width: 767.98px) {
  .site-nav .navbar-nav { margin-top: 0.7rem; border-top: 1px solid var(--rule); padding-top: 0.3rem; }
  .site-nav .nav-link { padding: 0.7rem 0 !important; }
  .contact-menu { box-shadow: none; border: 0; padding: 0 0 0.5rem; background: transparent; }
  .contact-menu .dropdown-item { padding-left: 0.9rem; }
}
.btn-line { background: transparent; color: var(--ink); border: 1px solid #c9c6bd; }
.btn-line:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.backcom { border-left: 3px solid var(--up); background: #f1f8f5; padding: 0.7rem 0.9rem; border-radius: 0 6px 6px 0; margin-bottom: 1.2rem; font-size: 0.93rem; }
.backcom p { color: var(--ink) !important; }
.bc-label { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #067a66; margin-bottom: 0.15rem; }
#lessons, #join { scroll-margin-top: 90px; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand:hover { color: var(--ink); }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
.brand-mark i { display: block; width: 4px; border-radius: 1px; background: var(--ink); }
.brand-mark i:nth-child(1) { height: 9px; }
.brand-mark i:nth-child(2) { height: 17px; background: var(--up); }
.brand-mark i:nth-child(3) { height: 12px; }

/* hero */
.hero { padding: 4rem 0 3rem; }
.hero-title { font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem); line-height: 1.1; margin-bottom: 1rem; }
.lead-text { font-size: 1.08rem; color: var(--ink-2); line-height: 1.6; margin-bottom: 1.2rem; }

.preview { display: block; background: #131722; border-radius: 10px; overflow: hidden; color: #d1d4dc; font-size: 12px; text-decoration: none;
  box-shadow: 0 18px 40px -22px rgba(19, 23, 34, .55); transition: transform .2s; }
.preview:hover { color: #d1d4dc; transform: translateY(-2px); }
.preview-bar { display: flex; align-items: center; gap: 0.9rem; padding: 0.55rem 0.85rem; background: #0f0f0f; }
.preview-bar .sym { font-weight: 500; color: #fff; }
.preview-bar .tf { background: #2a2e39; padding: 1px 6px; border-radius: 3px; }
.preview-bar .dim { color: #787b86; }
.preview-chart { position: relative; height: 280px; }
.preview-chart svg { display: block; width: 100%; height: 100%; }
.pos-tag { position: absolute; left: 12px; top: 12px; background: rgba(8,153,129,.15); color: #3fd1b0; border: 1px solid rgba(8,153,129,.45); padding: 3px 8px; border-radius: 4px; }

/* bai hoc + san */
.section { padding: 1rem 0 5rem; }
.block { height: 100%; background: #fff; border: 1px solid var(--rule); border-radius: 10px; padding: 1.5rem 1.6rem; }
.block h2 { font-size: 1.3rem; margin: 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 0.8rem; }


.block-join { display: flex; flex-direction: column; align-items: flex-start; }
.block-join h2 { margin-bottom: 0.6rem; }
.block-join p { color: var(--ink-2); }

.disclaimer { font-size: 0.78rem; color: var(--mute) !important; margin: 1rem 0 0; line-height: 1.5; }

/* danh sach bai viet (trang chu + Tai lieu + Doc tiep) */
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li + li { border-top: 1px solid #e6e3db; }
.doc-list li[hidden] { display: none; }
.doc-list a { display: grid; grid-template-columns: 1fr auto; column-gap: 1.5rem; padding: 1.1rem 0; color: inherit; text-decoration: none; }
.doc-list a:hover .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.doc-list .t { grid-column: 1; font-weight: 600; font-size: 1.05rem; line-height: 1.35; }
.doc-list .d { grid-column: 1; color: var(--ink-2); font-size: 0.93rem; margin-top: 0.25rem; }
.doc-list .meta { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; white-space: nowrap; }
.doc-list .tag { font-size: 0.75rem; color: var(--ink-2); border: 1px solid var(--rule); padding: 1px 7px; border-radius: 4px; background: #fff; }
.doc-list .time { color: var(--mute); font-size: 0.78rem; }
.doc-list .empty { padding: 1rem 0; color: var(--mute); }
.doc-list-compact a { padding: 0.75rem 0; }
.doc-list-compact .t { font-weight: 500; font-size: 1rem; }
.doc-list-compact .d, .doc-list-compact .tag { display: none; }
.doc-list-compact .meta { grid-row: 1; }
@media (max-width: 575.98px) {
  .doc-list a { grid-template-columns: 1fr; }
  .doc-list .meta { grid-column: 1; grid-row: auto; flex-direction: row; align-items: center; margin-top: 0.45rem; }
  .doc-list-compact a { grid-template-columns: 1fr auto; }
  .doc-list-compact .meta { grid-column: 2; grid-row: 1; margin-top: 0; }
}

/* trang Tai lieu */
.page-head { padding: 3.5rem 0 2rem; }
.page-head h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); margin-bottom: 0.6rem; }
.page-head .lead-text { max-width: 38em; }
.doc-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--ink); }
.filters { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid #c9c6bd; background: transparent; color: var(--ink-2); padding: 0.35rem 0.85rem; border-radius: 999px; font-size: 0.88rem; font-weight: 500; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .count { opacity: .6; font-weight: 400; margin-left: 2px; }
.doc-search { width: 240px; max-width: 100%; border: 1px solid var(--rule); background: #fff; border-radius: 6px; padding: 0.45rem 0.75rem; font-size: 16px; outline: none; }
.doc-search:focus { border-color: var(--ink); }
.doc-empty { color: var(--mute); padding: 1.5rem 0; }
@media (max-width: 575.98px) { .doc-search { width: 100%; } .page-head { padding: 2.2rem 0 1.5rem; } }

/* trang bai viet */
.article .container, .narrow { max-width: 760px; }
.article { padding: 2.5rem 0 3rem; }
.crumbs { font-size: 0.88rem; color: var(--mute); margin-bottom: 1rem; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span { margin: 0 0.45rem; }
.article h1 { font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem); line-height: 1.15; margin-bottom: 0.7rem; }
.article-meta { color: var(--mute); font-size: 0.9rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule); margin-bottom: 2rem; }
.draft-note { background: #fff4d6; border: 1px solid #f0dc9c; padding: 0.5rem 0.8rem; border-radius: 6px; font-size: 0.88rem; }

.prose { font-size: 1.06rem; line-height: 1.75; color: #23262d; }
.prose > :first-child { margin-top: 0; }
.prose h2 { font-size: 1.45rem; margin: 2.4rem 0 0.8rem; }
.prose h3 { font-size: 1.15rem; font-weight: 600; margin: 1.8rem 0 0.6rem; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose figure { margin: 0 0 1.2rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: 0.3rem; }
.prose a { color: var(--accent-ink); }
.prose strong { font-weight: 600; color: var(--ink); }
.prose img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--rule); display: block; }
.prose blockquote { border-left: 3px solid var(--ink); padding: 0.1rem 0 0.1rem 1rem; color: var(--ink-2); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.88em; background: #ebe8e1; padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: #131722; color: #d1d4dc; padding: 1rem 1.1rem; border-radius: 8px; overflow-x: auto; font-size: 0.88rem; line-height: 1.55; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.2rem 0; opacity: 1; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 0.55rem 0.9rem 0.55rem 0; text-align: left; vertical-align: top; }
.prose th { font-weight: 600; border-bottom-color: var(--ink); white-space: nowrap; }

.article-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; margin-top: 2.5rem;
  padding: 1.2rem 1.3rem; background: #fff; border: 1px solid var(--rule); border-radius: 10px; }
.article-cta b { display: block; font-weight: 600; }
.article-cta span { color: var(--ink-2); font-size: 0.93rem; }
.related-title { font-size: 1.2rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--ink); margin: 0; }

/* footer */
.site-foot { padding: 1.4rem 0 calc(1.4rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); font-size: 0.82rem; color: var(--mute); }

/* nut noi */
.fabs { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 1040; display: flex; gap: 0.5rem; }
.fab { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; height: 46px; padding: 0 1.05rem;
  border: 0; border-radius: 999px; color: #fff; font-weight: 500; text-decoration: none; box-shadow: 0 8px 24px -8px rgba(0,0,0,.4); }
.fab-tg { background: var(--tg); }
.fab-tg:hover { background: #1b8bc0; color: #fff; }
.fab-chat { background: var(--ink); }
.fab-chat:hover { background: #000; }
body.chat-open .fabs { display: none; }
@media (max-width: 575.98px) {
  .fabs { right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); flex-direction: column-reverse; }
  .fab { width: 50px; height: 50px; padding: 0; }
}

/* chat */
.chat { position: fixed; right: 20px; bottom: 20px; z-index: 1050; width: 360px; height: min(520px, calc(100vh - 40px));
  display: flex; flex-direction: column; background: #fff; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.35); }
.chat[hidden] { display: none; }
.chat-head { display: flex; align-items: center; gap: 0.7rem; padding: 0.8rem 0.9rem; border-bottom: 1px solid var(--rule); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; flex: none; }
.chat-status { color: var(--mute); font-size: 0.78rem; }
.chat-x { border: 0; background: transparent; color: var(--ink-2); width: 34px; height: 34px; border-radius: 6px; display: grid; place-items: center; }
.chat-x:hover { background: var(--paper); }
.chat-body { flex: 1; overflow-y: auto; padding: 1rem 0.9rem; display: flex; flex-direction: column; gap: 0.45rem; background: #fbfaf8; }
.msg { max-width: 82%; padding: 0.55rem 0.8rem; border-radius: 14px; font-size: 0.93rem; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.them { align-self: flex-start; background: #fff; border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.msg-time { font-size: 0.7rem; color: var(--mute); align-self: flex-end; margin-top: -0.2rem; }
.msg-time.left { align-self: flex-start; }
.chat-input { display: flex; align-items: flex-end; gap: 0.5rem; padding: 0.7rem 0.9rem; border-top: 1px solid var(--rule); }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--rule); border-radius: 10px; padding: 0.55rem 0.75rem; font-size: 16px; line-height: 1.35; max-height: 120px; outline: none; }
.chat-input textarea:focus { border-color: var(--ink); }
.chat-input button { flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.chat-input button:disabled { background: #c9ccd6; }
@media (max-width: 575.98px) {
  .chat { inset: 0; width: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .chat-head { padding-top: calc(0.8rem + env(safe-area-inset-top)); }
  .chat-input { padding-bottom: calc(0.7rem + env(safe-area-inset-bottom)); }
  body.chat-open { overflow: hidden; }
}

@media (max-width: 767.98px) {
  .hero { padding: 2.2rem 0 2rem; }
  .preview-chart { height: 200px; }
  .section { padding-bottom: 6rem; }
  .block { padding: 1.25rem; }
}
.prose h2, .prose h3 { scroll-margin-top: 90px; }

/* danh sach co so thu tu (trang Tai lieu) */
.doc-list-numbered a { grid-template-columns: 2.6rem 1fr auto; }
.doc-list-numbered .num { grid-column: 1; grid-row: 1 / span 2; font-family: "JetBrains Mono", monospace; color: var(--mute); font-size: 0.85rem; padding-top: 0.2rem; }
.doc-list-numbered .t, .doc-list-numbered .d { grid-column: 2; }
.doc-list-numbered .meta { grid-column: 3; }
@media (max-width: 575.98px) {
  .doc-list-numbered a { grid-template-columns: 2.2rem 1fr; }
  .doc-list-numbered .num { grid-row: 1 / span 3; }
  .doc-list-numbered .meta { grid-column: 2; }
}

/* bai truoc / bai sau */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 2rem; }
.pager a { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.1rem; border: 1px solid var(--rule); border-radius: 10px; color: inherit; text-decoration: none; background: transparent; transition: border-color .15s, background .15s; }
.pager a:hover { border-color: var(--ink); background: #fff; }
.pager span { font-size: 0.8rem; color: var(--mute); }
.pager b { font-weight: 600; line-height: 1.35; }
.pager-next { grid-column: 2; text-align: right; }
@media (max-width: 575.98px) { .pager { grid-template-columns: 1fr; } .pager-next { grid-column: 1; } }

.admin-bar { font-size: 0.85rem; background: #fff4d6; border: 1px solid #f0dc9c; padding: 0.45rem 0.8rem; border-radius: 6px; margin-bottom: 1.2rem; }

/* chat: tin dang gui / loi / ghi chu, o ten, so tin chua doc tren nut */
.msg.pending { opacity: .6; }
.msg.failed { opacity: 1; background: #fdecec !important; color: #8c1d22 !important; }
.msg.note { align-self: center; max-width: 90%; background: transparent; color: var(--mute); font-size: 0.8rem; text-align: center; padding: 0.2rem 0.5rem; }
.chat-name { padding: 0.6rem 0.9rem 0; border-top: 1px solid var(--rule); }
.chat-name[hidden] { display: none; }
.chat-name input { width: 100%; border: 1px solid var(--rule); border-radius: 8px; padding: 0.4rem 0.65rem; font-size: 16px; outline: none; }
.chat-name input:focus { border-color: var(--ink); }
.chat-name + .chat-input { border-top: 0; }
.fab-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #e5484d; color: #fff; font-size: 0.75rem; font-weight: 600; line-height: 20px; text-align: center; }
.fab-badge[hidden] { display: none; }

/* ---- tai khoan */
.acc { max-width: 720px; }
.acc-err { margin-bottom: 1rem; padding: 0.7rem 1rem; border: 1px solid #f2c2c4; border-radius: 8px; background: #fdf0f0; color: #a3161d; }
.acc-user { display: flex; align-items: center; gap: 1rem; }
.acc-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.acc-status { margin-top: 1.2rem; padding: 0.8rem 1rem; border: 1px solid var(--rule); border-radius: 10px; background: #fff; }
.acc-status.on { border-color: #9fd8c8; background: #e9f7f2; }
.btn-google { display: inline-flex; align-items: center; gap: 0.6rem; padding: 0.6rem 1.1rem; border: 1px solid #c9c6bd; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 600; }
.btn-google:hover { background: #f3f2ee; color: var(--ink); }
.acc-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.acc-plan { padding: 1.1rem 1.2rem; border: 1px solid var(--rule); border-radius: 12px; background: #fff; }
.acc-plan-name { color: var(--ink-2); font-weight: 500; }
.acc-plan-price { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.01em; }
.acc-plan-save { color: var(--up); font-size: 0.85rem; font-weight: 500; }
.nav-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.pay-box .modal-body { padding-top: 0.5rem; }
.pay-qr { display: block; width: min(260px, 100%); margin: 0 auto 0.6rem; border-radius: 8px; border: 1px solid var(--rule); background: #fff; }
.pay-info { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; margin: 0 0 0.8rem; font-size: 0.92rem; }
.pay-info dt { color: var(--mute); font-weight: 400; }
.pay-info dd { margin: 0; }
.pay-code { font-family: "JetBrains Mono", monospace; letter-spacing: .04em; color: var(--accent-ink); }
.pay-copy { margin-left: 0.4rem; padding: 0 0.45rem; border: 1px solid var(--rule); border-radius: 5px; background: #fff; color: var(--ink-2); font-size: 0.75rem; }
.pay-note { padding: 0.55rem 0.75rem; border-radius: 8px; background: #fff7e6; color: #7a4b00; font-size: 0.85rem; }
.pay-status { display: flex; align-items: center; justify-content: center; gap: 0.5rem; color: var(--ink-2); font-size: 0.9rem; }
.pay-done { text-align: center; padding: 1rem 0 0.5rem; }
.pay-done-icon { width: 56px; height: 56px; margin: 0 auto 0.8rem; display: grid; place-items: center; border-radius: 50%; background: #e3f4ee; color: var(--up); font-size: 1.8rem; font-weight: 700; }
