/* ==========================================================================
   TASH — phần riêng của CMS: tài khoản, video khóa, tài liệu, pop-up, Góc học viên.
   Dùng biến màu của style.css. Hộp thoại và biểu mẫu nền trắng, chữ tối (giống form của demo).
   ========================================================================== */

/* Thuộc tính hidden luôn ẩn phần tử (class có display riêng không được đè lên) */
[hidden]:not([hidden="until-found" i]) { display: none !important; }

/* Ô bẫy bot: ẩn khỏi người xem và trình đọc màn hình */
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; opacity: 0; }

.muted { color: var(--ink-mute); }
.small { font-size: 14px; }

/* ---------- Nút bổ sung (tên class của template) ---------- */
.btn--sm { font-size: 15px; padding: 9px 18px; min-height: 44px; border-radius: 999px; }
.btn--block { width: 100%; }
.btn-outline-dark { border: 2px solid var(--dark); color: var(--dark); background: transparent; }
.btn-outline-dark:hover { color: var(--dark); background: #f3efff; }
.btn--soft { background: #eee9ff; color: var(--dark); }
.btn--soft:hover { color: var(--dark); background: #e2dbff; }

/* ---------- Trang tự do, bài viết, đầu trang con ---------- */
.phero { padding-bottom: 8px; display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.phero .lead { margin-top: 4px; }
.back { display: inline-flex; gap: 6px; font-weight: 700; color: var(--ink-mute); text-decoration: none; }
.back:hover { color: var(--lime); }
.article { max-width: 860px; display: flex; flex-direction: column; gap: 16px; }
.article__meta { color: var(--ink-faint); font-weight: 700; font-size: 15px; }
.article__cover { border-radius: 26px; overflow: hidden; border: 2px solid var(--line-2); }
.article__cover img { width: 100%; }
.prose img { border-radius: 18px; margin: 1.4em 0; }
.prose a { color: var(--cyan); }
.prose h3 { font-size: 24px; margin: 26px 0 10px; }
.facts-inline { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0; }
.facts-inline dt { font-size: 13px; font-weight: 800; color: var(--tone-text); }
.facts-inline dd { margin: 0; font-weight: 700; }
.cta-block p { margin-top: 4px; }

/* Ảnh chờ (chưa có ảnh) */
.ph { position: relative; display: grid; place-items: center; gap: 8px; width: 100%; height: 100%; min-height: 160px; aspect-ratio: 4 / 3; background: repeating-linear-gradient(135deg, var(--panel) 0 14px, var(--panel-2) 14px 28px); color: var(--ink-faint); text-align: center; }
.ph__seed { width: 36px; height: 36px; color: var(--purple); }
.ph__label { font-size: 13px; font-weight: 700; }

/* Bộ ảnh trên trang tự do */
.gal__h { margin-bottom: 18px; }
.gal__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.gal__item { display: block; border-radius: 18px; overflow: hidden; border: 2px solid var(--line-2); aspect-ratio: 4 / 3; }
.gal__item img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.gal__item:hover img { transform: scale(1.04); }

/* Thẻ trang (khóa học, bài viết) */
.pcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; margin-top: 28px; }
.pcard { display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--tone, var(--line-2)); border-radius: 24px; overflow: hidden; text-decoration: none; color: var(--ink-soft); transition: transform .15s ease; }
.pcard:hover { transform: translateY(-3px); color: var(--ink-soft); }
.pcard__media img, .pcard__media .ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.pcard__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pcard__body h3 { font-size: 24px; line-height: 1.1; color: var(--ink); }
.pcard__meta { font-size: 13px; font-weight: 800; color: var(--tone-text, var(--cyan)); font-family: var(--font-mono); }
.pcard__more { margin-top: auto; font-weight: 800; color: var(--tone-text, var(--cyan)); }
.pcard__ok, .pcard__lock { align-self: flex-start; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.pcard__ok { background: var(--lime); color: var(--dark); }
.pcard__lock { border: 1.5px solid var(--yellow); color: var(--yellow); }

/* ---------- Góc học viên ---------- */
.lib-status { margin-top: 18px; }
.lib-join { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; justify-content: space-between; background: var(--panel); border: 2px dashed var(--purple); border-radius: 26px; padding: clamp(20px, 3vw, 32px); }
.lib-join > div:first-child { flex: 1 1 380px; }
.lib-join p { color: var(--ink-soft); margin-top: 8px; }
.lib-join .btn-row { flex: 1 1 320px; }

/* ---------- Video ---------- */
.vids__title { margin-bottom: 8px; }
.vids__list { display: grid; gap: clamp(24px, 3.5vw, 40px); margin-top: 24px; }
.vid { display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(18px, 3vw, 36px); align-items: center; scroll-margin-top: 20px; }
.vid__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 22px; overflow: hidden; background: var(--bg-deep); border: 2px solid var(--line-2); }
.vid__media { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.vid__body h3 { font-size: clamp(22px, 2.2vw, 28px); line-height: 1.1; margin-bottom: 8px; }
.vid__body p:not(.vid__badge) { color: var(--ink-soft); font-size: 16px; }
.vid__badge { display: inline-block; margin-bottom: 10px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--lime); color: var(--dark); }
.vid__badge--lock { background: var(--yellow); }
.vid__lock { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--ink); background: radial-gradient(circle at 50% 30%, var(--panel-2), var(--bg-deep)); }
.vid__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .25; filter: blur(2px); }
.vid__lock-in { position: relative; padding: 18px; display: grid; justify-items: center; gap: 8px; max-width: 460px; }
.vid__lock-ic { width: 42px; height: 42px; color: var(--yellow); }
.vid__lock-t { font-family: var(--font-display); font-weight: 800; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.15; }
.vid__lock-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 4px; }
.vid__lock-s { font-size: 14px; color: var(--ink-mute); }
.vid__lock-s a { color: var(--cyan); }
@media (max-width: 860px) { .vid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .vid__lock-in { padding: 10px; gap: 6px; } .vid__lock-ic { width: 30px; height: 30px; } .vid__lock-s { font-size: 13px; } }
.vbar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; margin-top: 16px; padding: 12px 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line-2); color: var(--ink-soft); font-size: 15px; }
.vbar form { margin: 0; }
.vbar__btn { border: 0; background: none; padding: 0; cursor: pointer; font-weight: 800; color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; font-size: 15px; }

/* ---------- Tài liệu & ebook ---------- */
.ebooks__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 20px; margin-top: 24px; }
.ebook { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 20px; align-items: start; padding: 20px; background: var(--panel); border: 2px solid var(--line-2); border-radius: 24px; scroll-margin-top: 20px; }
.ebook__cover { aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--panel-2); }
.ebook__cover > * { width: 100%; height: 100%; object-fit: cover; min-height: 0; aspect-ratio: auto; }
.ebook__body { display: flex; flex-direction: column; min-width: 0; gap: 6px; }
.ebook__title { font-size: 24px; line-height: 1.1; }
.ebook__price { align-self: flex-start; padding: 3px 12px; border-radius: 999px; background: var(--yellow); color: var(--dark); font-weight: 800; font-size: 13px; }
.ebook__price span { font-weight: 600; opacity: .8; }
.ebook__price--free { background: var(--cyan); }
.ebook__author { color: var(--ink-mute); font-weight: 700; font-size: 14px; }
.ebook__desc { color: var(--ink-soft); font-size: 15px; }
.ebook__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 8px; }
.ebook__fmt, .ebook__closed { font-size: 13px; color: var(--ink-mute); }
.ebook__closed { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--yellow); }
.ebook__closed::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.ebook__hint { margin-top: 6px; font-size: 14px; color: var(--ink-mute); }
.ebook__hint a { color: var(--cyan); font-weight: 700; }
.ebook__code { margin-top: 6px; font-size: 14px; }
.ebook__code summary { cursor: pointer; color: var(--cyan); font-weight: 700; width: max-content; }
.ebook__code form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ebook__code input { flex: 1; min-width: 150px; padding: 9px 12px; border: 2px solid var(--line-2); border-radius: 12px; background: var(--bg-deep); color: var(--ink); }
.ebook__code .btn-outline { color: var(--ink); }
.ebook .note { margin: 6px 0; }
@media (max-width: 480px) { .ebook { grid-template-columns: 92px 1fr; gap: 14px; padding: 16px; } .ebook__title { font-size: 20px; } }

/* ---------- Thông báo ---------- */
.note { margin: 0 0 16px; padding: 12px 16px; border-radius: 12px; font-size: 15px; line-height: 1.55; background: #f3efff; color: var(--dark); }
.note--error { background: #ffe3ea; color: #8a0020; }
.note--success { background: #e8ffd1; color: #23500a; }
.note--info { background: #e9fbff; color: #0b3a44; }

/* ---------- Biểu mẫu của template (đăng nhập, đăng ký, nhập mã, mua tài liệu) ---------- */
.cf { display: grid; gap: 14px; }
.cf__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.cf .field, .auth__card .field { color: var(--dark); }
.field > span { display: block; }
.field small { font-weight: 500; color: var(--paper-mute); }
.cf input:not([type=checkbox]):not([type=radio]), .cf textarea, .auth__card input:not([type=checkbox]):not([type=radio]) {
  font-size: 16px; padding: 12px 14px; border: 2px solid #ddd5f3; border-radius: 12px; background: var(--paper); color: var(--dark); width: 100%;
}
.cf input:focus, .cf textarea:focus { border-color: var(--dark); outline: none; box-shadow: 0 0 0 3px rgba(155, 108, 255, 0.35); }
.cf input:disabled, .auth__card input:disabled { background: #f4f2fb; color: var(--paper-mute); }
.cf__status { min-height: 1.2em; font-size: 14px; font-weight: 700; color: #8a0020; }
.cf__status:empty { display: none; }
.cf__done { text-align: center; padding: 18px 6px; display: grid; gap: 12px; justify-items: center; color: var(--dark); }
.cf__done h3 { font-size: 30px; color: #c2006a; }
.code-input { text-transform: uppercase; letter-spacing: .18em; font-family: var(--font-mono) !important; font-weight: 800; text-align: center; font-size: 20px !important; }
.captcha__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.captcha__img { border-radius: 12px; border: 2px solid #ddd5f3; width: 180px; height: 60px; }
.captcha__re { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #ddd5f3; background: var(--paper); color: var(--dark); font-size: 20px; cursor: pointer; }
.captcha__row input { flex: 1; min-width: 140px; text-transform: uppercase; letter-spacing: .2em; }
.cf-turnstile { min-height: 65px; }
.choices .choice-row { margin-top: 6px; }

/* ---------- Trang đăng ký / đăng nhập / nhập mã / hồ sơ ---------- */
.auth { padding: clamp(32px, 6vw, 80px) 0 110px; }
.auth__card { max-width: 600px; margin: 0 auto; padding: clamp(22px, 4vw, 40px); background: var(--paper); color: var(--dark); border-radius: 26px; box-shadow: 10px 10px 0 var(--purple); color-scheme: light; }
.auth__card a { color: #5b2bd6; font-weight: 700; }
.auth__title { font-size: clamp(28px, 3.6vw, 38px); line-height: 1.05; color: inherit; }
.auth__alt { margin-top: 20px; text-align: center; font-size: 15px; color: var(--paper-mute); line-height: 1.9; }
.modal__head { margin-bottom: 18px; color: var(--dark); }
.modal__head h2 { font-size: clamp(26px, 3vw, 32px); line-height: 1.05; margin-bottom: 6px; }
.modal__head p { color: var(--paper-mute); }
.modal__head .modal__portal { margin-top: 8px; font-size: 14.5px; }
.modal__portal a { color: #5a2fd0; font-weight: 700; }

.profile { max-width: 1040px; }
.profile__head { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.profile__head .pill { margin-bottom: 6px; }
.profile__head .muted { color: var(--ink-mute); }
.profile__head .auth__title { color: var(--ink); }
.profile__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.profile__grid .auth__card { max-width: none; margin: 0; box-shadow: 6px 6px 0 var(--purple); }
.profile__h { font-size: 22px; margin-bottom: 14px; }
.profile__h--sp { margin-top: 24px; }
.profile__books { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.profile__books li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 2px solid #ece7fb; border-radius: 12px; }
.profile__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.profile__actions form { margin: 0; }
.profile .muted a { color: #5b2bd6; }
.auth__card .muted { color: var(--paper-mute); }
@media (max-width: 760px) { .profile__grid { grid-template-columns: 1fr; } }

/* ---------- Tài khoản trên thanh tiêu đề ---------- */
.nav__login { font-weight: 700; font-size: 15px; color: var(--ink-soft); text-decoration: none; padding: 6px 4px; }
.nav__login:hover { color: var(--lime); }
.umenu { position: relative; }
.umenu__btn { gap: 8px; padding-left: 6px; }
.umenu__avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--yellow); color: var(--dark); font-family: var(--font-display); font-weight: 800; font-size: 15px; flex: none; }
.umenu__avatar--lg { width: 64px; height: 64px; font-size: 30px; box-shadow: 4px 4px 0 var(--pink); }
.umenu__name { max-width: 10em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.umenu__caret { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.umenu.is-open .umenu__caret { transform: translateY(2px) rotate(-135deg); }
.umenu__list {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 250px; padding: 8px; display: grid; gap: 2px;
  background: var(--paper); color: var(--dark); border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}
.umenu.is-open .umenu__list { opacity: 1; visibility: visible; transform: none; transition: opacity .2s ease, transform .2s ease; }
.umenu__who { margin: 0 0 6px; padding: 8px 12px 10px; border-bottom: 1px solid #ece7fb; display: grid; line-height: 1.4; }
.umenu__who span { font-size: 13px; color: var(--paper-mute); overflow: hidden; text-overflow: ellipsis; }
.umenu__list a, .umenu__list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 10px; background: none; cursor: pointer; font-weight: 700; font-size: 15px; color: var(--dark); text-decoration: none; }
.umenu__list a:hover, .umenu__list button:hover { background: #f3efff; color: var(--dark); }
.umenu__list form { margin: 0; }
@media (max-width: 1180px) {
  .nav__login { font-size: 18px; flex-basis: 100%; }
  .umenu { flex-basis: 100%; }
  .umenu__btn { display: none; }
  .umenu__list { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; min-width: 0; }
}

/* ---------- Hộp thoại (đăng nhập, mua tài liệu, pop-up quà tặng) ---------- */
.modal, .promo { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 26px; background: var(--paper); color: var(--dark); box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .7); overflow: auto; overscroll-behavior: contain; color-scheme: light; }
.modal::backdrop, .promo::backdrop { background: rgba(5, 2, 15, .7); backdrop-filter: blur(4px); }
.modal__box, .promo__box { position: relative; padding: clamp(24px, 5vw, 40px) clamp(18px, 4vw, 36px) clamp(22px, 4vw, 32px); }
.modal__x { position: absolute; right: 12px; top: 12px; z-index: 1; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #f3efff; color: var(--dark); font-size: 26px; line-height: 1; cursor: pointer; }
.modal__x:hover { background: #e2dbff; }
body.modal-open { overflow: hidden; }
.atabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 20px; border-radius: 999px; background: #f3efff; }
.atabs button { min-height: 42px; border: 0; border-radius: 999px; background: none; cursor: pointer; font-weight: 800; font-size: 15px; color: var(--paper-mute); }
.atabs button[aria-selected="true"] { background: var(--dark); color: var(--yellow); }
.auth-modal__loading { text-align: center; color: var(--paper-mute); padding: 28px 0; }
.promo__step[data-step="1"] { text-align: center; }
.promo__ic { width: 80px; height: 80px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--yellow); color: var(--dark); box-shadow: 4px 4px 0 var(--pink); }
.promo__ic svg { width: 40px; height: 40px; }
.promo__title { font-size: clamp(26px, 4.6vw, 32px); margin-bottom: 10px; }
.promo__text { color: var(--paper-mute); font-size: 16.5px; max-width: 30em; margin: 0 auto 24px; }
.promo__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .promo__actions { grid-template-columns: 1fr; } }
.ebuy .promo__step[data-step="1"] { text-align: left; }
.ebuy__lead { margin-top: 6px; font-size: 15px; }

/* Xem ảnh phóng to */
.lb { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 2, 15, .92); }
.lb[open] { display: grid; place-items: center; }
.lb__fig { margin: 0; max-width: min(1200px, 94vw); }
.lb__fig img { max-height: 84vh; width: auto; margin: 0 auto; border-radius: 12px; }
.lb__cap { text-align: center; color: var(--ink-mute); margin-top: 10px; }
.lb__x { position: fixed; top: 16px; right: 16px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--dark); font-size: 28px; cursor: pointer; }

/* Thanh xem trước dành cho admin */
.preview-bar { position: sticky; top: 0; z-index: 70; padding: 8px 16px; background: var(--orange); color: var(--dark); font-size: 14px; font-weight: 700; text-align: center; }
.preview-bar a { color: var(--dark); text-decoration: underline; }

/* Email giấu khỏi bot */
.mail-rev { unicode-bidi: bidi-override; direction: rtl; }

/* Link trên nền trắng (hộp thoại, thẻ form): tím đậm thay cho xanh ngọc để đủ tương phản */
.modal a:not(.btn), .promo a:not(.btn), .auth__card a:not(.btn) { color: #5b2bd6; font-weight: 700; }
.profile__books li .btn { flex: none; white-space: nowrap; }

/* ---------- Song ngữ: nút VI / EN ở góc phải thanh tiêu đề (cạnh nút menu trên điện thoại) ---------- */
.site-header .bar-end { display: flex; align-items: center; gap: 10px; order: 3; flex-shrink: 0; }
.site-header .nav-wrap { order: 2; }
.lang-switch { display: inline-flex; border: 2px solid var(--line-2); border-radius: 999px; overflow: hidden; }
.lang-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 40px; padding: 0 10px;
  font-weight: 800; font-size: 14px; letter-spacing: .04em; color: var(--ink-soft); text-decoration: none; }
.lang-switch a:hover { color: var(--yellow); }
.lang-switch a[aria-current="true"] { background: var(--yellow); color: var(--bg); }
.lang-switch a:focus-visible { outline-offset: -3px; border-radius: 999px; }
@media (min-width: 1181px) { .site-header .nav-wrap { margin-left: auto; } }
/* Trang tiếng Anh chưa dịch / chỉ có bản tiếng Việt chính thức */
.lang-note { margin-top: 16px; margin-bottom: 0; padding: 12px 16px; border: 1px dashed var(--line-2); border-radius: 14px; color: var(--ink-soft); font-size: 15px; }
.lang-note a { color: var(--yellow); }
@media (min-width: 1181px) {
  .site-header .bar { gap: 16px; }
  .site-header .nav-wrap { flex: 1 1 auto; min-width: 0; justify-content: flex-end; gap: 16px; }
  .site-header nav ul { gap: 6px 16px; justify-content: flex-end; }
  .site-header .actions { flex-shrink: 0; }
  .site-header .actions .btn, .site-header .nav__login { white-space: nowrap; }
}
