/*
 * Khối dùng chung của các trang chi tiết (giải pháp, chuyên gia AI, lộ trình, dự án, bài viết).
 * HTML được dựng bằng các hàm trong js/main.js: checkList, tagList, processSteps, faqList, pager, richText.
 */

/* Phần tử có thuộc tính hidden luôn ẩn, kể cả khi class của nó đặt display (flex, grid...) */
[hidden] {
    display: none !important;
}

/* ---------- Dải thông tin nhanh (dưới tiêu đề / đầu nội dung) ---------- */
.fact-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 0;
}

.fact-strip div {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-light);
}

.fact-strip dt {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-light);
    margin-bottom: 4px;
}

.fact-strip dd {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.4;
}

/* Chip trên nền hero màu */
.hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.hero-chips span {
    background: rgba(255, 255, 255, 0.18);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

/* ---------- Danh sách có dấu tích ---------- */
.check-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 10px;
}

.check-list.cols-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px 24px;
}

.check-list li {
    position: relative;
    padding-left: 28px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
}

.check-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Nhãn công nghệ / công cụ ---------- */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-list span {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-light);
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 600;
}

/* ---------- Các bước quy trình ---------- */
.process-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.process-steps::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 19px;
    width: 2px;
    background: var(--border);
}

.process-steps li {
    position: relative;
    display: flex;
    gap: 18px;
    padding-bottom: 24px;
}

.process-steps li:last-child {
    padding-bottom: 0;
}

.process-num {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.process-body {
    flex: 1;
    min-width: 0;
    padding-top: 6px;
}

.process-body h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.process-time {
    padding: 2px 10px;
    border-radius: 12px;
    background: var(--bg-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.process-body p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-light);
}

/* ---------- Hỏi đáp ---------- */
.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.faq-item summary {
    position: relative;
    padding: 16px 52px 16px 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 22px;
    font-weight: 400;
    color: var(--primary-dark);
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    transform: translateY(-50%) rotate(45deg);
}

.faq-item summary:focus-visible {
    outline: 3px solid var(--primary-dark);
    outline-offset: 2px;
    border-radius: 12px;
}

.faq-item p {
    padding: 0 20px 18px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-light);
}

/* ---------- Khung nhấn mạnh ---------- */
.callout {
    padding: 20px 22px;
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
    background: var(--bg-light);
}

.callout h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.callout p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-dark);
}

.callout .btn {
    margin-top: 14px;
}

/* ---------- Văn bản dài (richText) ---------- */
.rich-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-dark);
}

.rich-text p {
    margin-bottom: 18px;
}

.rich-text h2 {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--primary-dark);
    margin: 36px 0 14px;
    scroll-margin-top: 90px;
}

.rich-text h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 26px 0 10px;
    scroll-margin-top: 90px;
}

.rich-text > :first-child {
    margin-top: 0;
}

.rich-text > :last-child {
    margin-bottom: 0;
}

.rich-text ul,
.rich-text ol {
    margin: 0 0 18px;
    padding-left: 24px;
}

.rich-text li {
    margin-bottom: 8px;
}

.rich-text li::marker {
    color: var(--primary-dark);
    font-weight: 700;
}

.rich-text code {
    padding: 2px 6px;
    border-radius: 5px;
    background: #f1f5f9;
    color: #0f172a;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    overflow-wrap: anywhere; /* đoạn mã dài không làm tràn ngang trên điện thoại */
}

/* ---------- Trước / sau ---------- */
.pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.pager-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pager-link:hover {
    border-color: var(--primary-light);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.12);
}

.pager-next {
    text-align: right;
}

.pager-caption {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--text-light);
}

.pager-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--primary-dark);
}

/* ---------- Thông tin nhanh ở sidebar ---------- */
.quick-facts {
    margin: 0;
}

.quick-facts div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.quick-facts div:last-child {
    border-bottom: none;
}

.quick-facts dt {
    color: var(--text-light);
    flex-shrink: 0;
}

.quick-facts dd {
    margin: 0;
    font-weight: 700;
    color: var(--text-dark);
    text-align: right;
}

/* ---------- Mục lục trong trang ---------- */
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc;
}

.toc-list li {
    counter-increment: toc;
    border-bottom: 1px solid var(--border);
}

.toc-list li:last-child {
    border-bottom: none;
}

.toc-list a {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-dark);
    text-decoration: none;
}

.toc-list a::before {
    content: counter(toc) ".";
    color: var(--primary-dark);
    font-weight: 800;
    flex-shrink: 0;
}

.toc-list a:hover {
    color: var(--primary-dark);
}

@media (max-width: 768px) {
    .check-list.cols-2 {
        grid-template-columns: 1fr;
    }

    .pager {
        grid-template-columns: 1fr;
    }

    .pager-next {
        text-align: left;
    }

    .pager-empty {
        display: none;
    }

    .rich-text h2 {
        font-size: 22px;
    }
}
