/* ==========================================================================
   AWE 2026 — màn hình học bài (/khoa-hoc/<khoá>/bai-hoc/<bài>/).
   Nạp sau awe.css. Chỉ nạp ở màn hình này.

   Khác mọi trang khác của theme: đây là chỗ làm việc, không phải trang bán
   hàng. Không header marketing, không chân trang, không nút nổi — chỉ thanh
   trên cùng mỏng, danh sách bài bên trái và khung video chiếm phần còn lại.
   ========================================================================== */

.awe-learnbar *,
.awe-learn * { box-sizing: border-box; }

/* ------------------------------------------------------------- thanh trên */
.awe-learnbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 60px;
    padding: 0 20px;
    background: var(--awe-deep);
    color: #fff;
}
.awe-learnbar__logo {
    flex: none;
    display: flex;
    align-items: center;
}
.awe-learnbar__logo img {
    display: block;
    height: 30px;
    width: auto;
    /* Logo là bản mực trên nền sáng; ở đây nền là teal đậm. */
    filter: brightness(0) invert(1);
}
.awe-learnbar__course {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    color: #fff;
    text-decoration: none;
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, .18);
}
.awe-learnbar__label {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .55);
}
.awe-learnbar__name {
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46ch;
}
.awe-learnbar__course:hover .awe-learnbar__name { color: #7fd4d4; }

.awe-learnbar__progress {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.awe-learnbar__count { font-size: 13px; color: rgba(255, 255, 255, .8); white-space: nowrap; }
.awe-learnbar__count strong { color: #fff; font-weight: 700; }
.awe-learnbar__bar {
    display: block;
    width: 160px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    overflow: hidden;
}
.awe-learnbar__fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--awe-gold);
}

.awe-learnbar__exit {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, .8);
    text-decoration: none;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 3px;
}
.awe-learnbar__exit:hover { color: #fff; border-color: rgba(255, 255, 255, .6); }
/* Không có thanh tiến độ (khách xem bài học thử) thì nút thoát tự dạt sang phải. */
.awe-learnbar__progress + .awe-learnbar__exit { margin-left: 0; }
.awe-learnbar__course + .awe-learnbar__exit { margin-left: auto; }

/* ------------------------------------------------------------- khung */
.awe-learn {
    display: block;
    background: var(--awe-bg);
    min-height: calc(100vh - 60px);
}
.awe-learn__grid {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    align-items: start;
}

/* ------------------------------------------------------------- danh sách bài */
.awe-learn__side {
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    background: var(--awe-surface);
    border-right: 1px solid var(--awe-line);
    display: flex;
    flex-direction: column;
}
.awe-learn__list {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}
.awe-learn__listhead {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--awe-line-soft);
    font-size: 14px;
    font-weight: 700;
    list-style: none;
    /* Trên máy tính danh sách luôn mở: đóng lại chỉ để lại một cột trắng. */
    pointer-events: none;
}
.awe-learn__listhead::-webkit-details-marker { display: none; }
.awe-learn__listmeta { font-size: 12.5px; font-weight: 500; color: var(--awe-muted); white-space: nowrap; }

.awe-learn__nav {
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 20px;
}

.awe-lsec__title {
    margin: 0;
    padding: 13px 20px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--awe-muted);
    background: var(--awe-bg);
    border-bottom: 1px solid var(--awe-line-soft);
}
.awe-lsec__items { margin: 0; padding: 0; list-style: none; }

.awe-litem__link {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 18px 10px 16px;
    border-bottom: 1px solid var(--awe-line-soft);
    font-size: 14px;
    line-height: 1.45;
    color: var(--awe-ink);
    text-decoration: none;
}
a.awe-litem__link:hover { background: var(--awe-tint); }

/* Ô đầu dòng mang bốn trạng thái: vòng tròn rỗng (chưa học), dấu ✓ (đã học),
   ổ khoá (chưa mở), chấm đầy (đang xem). Cố ý KHÔNG đánh số thứ tự ở đây:
   phần lớn tên bài đã bắt đầu bằng "Bài 3." nên hai con số đá nhau. */
.awe-litem__mark {
    position: relative;
    flex: none;
    width: 15px;
    height: 15px;
    margin-top: .18em;
    border: 1.5px solid rgba(20, 32, 31, .28);
    border-radius: 50%;
}
.awe-litem__title { flex: 1; min-width: 0; }
.awe-litem__time,
.awe-litem__tag {
    flex: none;
    font-size: 11.5px;
    color: var(--awe-muted-2);
    white-space: nowrap;
}
.awe-litem__tag {
    font-weight: 600;
    color: var(--awe-primary);
    background: var(--awe-tint);
    padding: 2px 7px;
}

.awe-litem.is-done .awe-litem__mark {
    border-color: var(--awe-primary);
    background: var(--awe-primary);
}
.awe-litem.is-done .awe-litem__mark::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    -webkit-mask: var(--awe-check) center / 10px 10px no-repeat;
    mask: var(--awe-check) center / 10px 10px no-repeat;
}
.awe-litem.is-done .awe-litem__title { color: var(--awe-muted); }

.awe-litem.is-locked .awe-litem__link { color: var(--awe-muted-2); }
.awe-litem.is-locked .awe-litem__mark { border-color: transparent; }
.awe-litem.is-locked .awe-litem__mark::after {
    content: "";
    position: absolute;
    inset: -1px;
    background: rgba(20, 32, 31, .3);
    -webkit-mask: var(--awe-lock) center / 14px 14px no-repeat;
    mask: var(--awe-lock) center / 14px 14px no-repeat;
}

.awe-litem.is-current .awe-litem__link {
    background: var(--awe-tint);
    box-shadow: inset 3px 0 0 var(--awe-primary);
    font-weight: 600;
}
.awe-litem.is-current .awe-litem__title { color: var(--awe-primary-deep); }
/* Bài đang xem nhưng chưa học xong: chấm đầy, không phải dấu ✓ */
.awe-litem.is-current:not(.is-done) .awe-litem__mark {
    border-color: var(--awe-primary);
    box-shadow: inset 0 0 0 3px var(--awe-primary);
}
/* …trừ khi nó đang bị khoá: khách mở thẳng URL một bài chưa mua vẫn thấy nó là
   "bài đang xem", và lúc đó ổ khoá mới là thứ giải thích được màn hình. */
.awe-litem.is-current.is-locked .awe-litem__mark {
    border-color: transparent;
    box-shadow: none;
}

/* ------------------------------------------------------------- nội dung */
.awe-learn__main {
    max-width: 980px;
    padding: 26px 34px 60px;
}
.awe-learn__where {
    margin: 0 0 6px;
    font-size: 13px;
    color: var(--awe-muted);
}
.awe-learn__free { color: var(--awe-primary); font-weight: 600; }
.awe-learn__title {
    margin: 0 0 18px;
    font-size: 27px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: var(--awe-ink);
    text-wrap: balance;
}

/* Video: nội dung bài do biên tập viên nhập, có bài bọc sẵn khung 16:9 bằng
   style inline, có bài chỉ là URL YouTube được oembed thành <iframe> cứng
   kích thước. Ép cả hai về cùng một khung. */
.awe-learn__video {
    background: #000;
    border-radius: var(--awe-radius);
    overflow: hidden;
}
.awe-learn__video iframe,
.awe-learn__video video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}
.awe-learn__video > div[style] {
    /* Khung tự chế trong post_content (padding-top: 56.25%) — aspect-ratio ở
       trên đã lo tỷ lệ, để nguyên padding thì thừa ra một dải đen. */
    padding-top: 0 !important;
    position: static !important;
}
.awe-learn__video > div[style] iframe { position: static !important; }
.awe-learn__video p { margin: 0; }

.awe-learn__empty {
    padding: 22px;
    background: var(--awe-surface);
    border: 1px dashed var(--awe-line);
    border-radius: var(--awe-radius);
    color: var(--awe-muted);
}

.awe-learn__h2 {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 700;
}

/* ------------------------------------------------------------- tài liệu */
.awe-learn__files {
    margin-top: 24px;
    padding: 18px 20px;
    background: var(--awe-surface);
    border: 1px solid var(--awe-line);
    border-radius: var(--awe-radius);
}
.awe-learn__files ul { margin: 0; padding: 0; list-style: none; }
.awe-learn__files li + li { margin-top: 6px; }
.awe-learn__files a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 14.5px;
    font-weight: 500;
    color: var(--awe-primary);
    text-decoration: none;
}
.awe-learn__files a:hover { color: var(--awe-primary-dark); text-decoration: underline; }

/* ------------------------------------------------------------- bài bị khoá */
.awe-learn__locked {
    padding: 34px 30px;
    background: var(--awe-surface);
    border: 1px solid var(--awe-line);
    border-radius: var(--awe-radius);
    text-align: center;
}
.awe-learn__lockicon {
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-bottom: 12px;
    background: var(--awe-primary);
    -webkit-mask: var(--awe-lock) center / 30px 30px no-repeat;
    mask: var(--awe-lock) center / 30px 30px no-repeat;
}
.awe-learn__locked p { margin: 0 auto 6px; max-width: 52ch; color: var(--awe-muted); }
.awe-learn__lockedbtns {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

/* ------------------------------------------------------------- hoàn thành */
.awe-learn__done { margin-top: 22px; }
.awe-learn__hint {
    /* Không dùng flex ở đây: câu này có link giữa dòng, mà flex biến mỗi
       text node thành một ô riêng — trên điện thoại nó vỡ thành ba cột. */
    display: block;
    margin: 0;
    padding: 13px 16px;
    background: var(--awe-surface);
    border: 1px solid var(--awe-line);
    border-left: 3px solid var(--awe-primary);
    border-radius: var(--awe-radius);
    font-size: 14.5px;
    color: var(--awe-muted);
}
.awe-learn__hint a { color: var(--awe-primary); font-weight: 600; }
.awe-learn__hint--ok {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--awe-primary-deep);
    border-left-color: var(--awe-primary);
}
.awe-learn__form { margin: 0; }

/* ------------------------------------------------------------- trước / tiếp */
.awe-learn__pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid var(--awe-line);
}
.awe-learn__prev,
.awe-learn__next {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 13px 16px;
    background: var(--awe-surface);
    border: 1px solid var(--awe-line);
    border-radius: var(--awe-radius);
    text-decoration: none;
    color: var(--awe-ink);
    min-width: 0;
}
.awe-learn__next { text-align: right; }
a.awe-learn__prev:hover,
a.awe-learn__next:hover { border-color: var(--awe-primary); }
.awe-learn__pagerlabel { font-size: 12px; font-weight: 600; color: var(--awe-primary); }
.awe-learn__pagername {
    font-size: 14.5px;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.awe-learn__prev.is-locked,
.awe-learn__next.is-locked { opacity: .55; cursor: not-allowed; }
.awe-learn__prev.is-locked .awe-learn__pagerlabel,
.awe-learn__next.is-locked .awe-learn__pagerlabel { color: var(--awe-muted-2); }

/* ------------------------------------------------------------- icon dùng chung */
.awe-litem__mark::after,
.awe-learn__lockicon {
    --awe-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='10.5' width='16' height='9.5' rx='2'/%3E%3Cpath d='M8 10.5V7a4 4 0 0 1 8 0v3.5'/%3E%3C/svg%3E");
    --awe-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------- máy tính bảng */
@media (max-width: 1100px) {
    .awe-learn__grid { grid-template-columns: 290px minmax(0, 1fr); }
    .awe-learn__main { padding: 22px 24px 50px; }
    .awe-learnbar__name { max-width: 28ch; }
    .awe-learnbar__bar { width: 110px; }
}

/* ------------------------------------------------------------- điện thoại */
@media (max-width: 860px) {
    .awe-learnbar { height: auto; padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
    .awe-learnbar__course { padding-left: 12px; flex: 1; min-width: 0; }
    /* Nhãn "KHOÁ HỌC" là thứ đầu tiên bỏ được: tên khoá tự nói nó là gì, còn
       một hàng thừa ở đây đẩy video xuống dưới màn hình đầu. */
    .awe-learnbar__label { display: none; }
    .awe-learnbar__name { max-width: none; font-size: 13.5px; }
    .awe-learnbar__progress { width: 100%; margin-left: 0; order: 3; }
    .awe-learnbar__bar { flex: 1; width: auto; }
    .awe-learnbar__exit { margin-left: auto; padding: 6px 10px; font-size: 13px; }

    .awe-learn { min-height: 0; }
    .awe-learn__grid { grid-template-columns: minmax(0, 1fr); }

    /* Danh sách bài xuống dưới video và gập lại: trên điện thoại nó dài hơn cả
       màn hình, để mở sẵn thì phải cuộn qua 34 dòng mới tới nội dung. */
    .awe-learn__side {
        position: static;
        height: auto;
        order: 2;
        border-right: 0;
        border-top: 1px solid var(--awe-line);
    }
    .awe-learn__main { order: 1; padding: 18px 16px 34px; }
    .awe-learn__title { font-size: 22px; }
    .awe-learn__list:not([open]) .awe-learn__listhead { border-bottom: 0; }
    .awe-learn__listhead { cursor: pointer; pointer-events: auto; }
    .awe-learn__listhead::after {
        content: "";
        width: 12px;
        height: 12px;
        flex: none;
        background: var(--awe-ink);
        -webkit-mask: var(--awe-caret) center / 12px 12px no-repeat;
        mask: var(--awe-caret) center / 12px 12px no-repeat;
        --awe-caret: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    }
    .awe-learn__list[open] .awe-learn__listhead::after { transform: rotate(180deg); }
    .awe-learn__nav { max-height: 60vh; }

    .awe-learn__pager { grid-template-columns: 1fr; }
    .awe-learn__next { text-align: left; }
}
