/* ============================================================================
 * blog-detail.css — Chi tiết bài viết (/{slug}) — UI/UX chuẩn chuyển đổi cao.
 * Tách riêng theo trang (CLAUDE.md 6.3), chỉ nạp ở trang chi tiết qua @section Styles.
 * Tái dùng token & khối CTA (.bl-cta) từ blog.css (6.5). Responsive đầy đủ (6.4).
 * ========================================================================== */

:root {
    --bd-accent: var(--aq-common-red, #e4002b);
    --bd-accent-dark: #c20025;
    --bd-ink: #16181c;
    --bd-muted: #6b7280;
    --bd-line: #ececf1;
    --bd-soft: #f6f7f9;
    --bd-radius: 18px;
}

/* Đồng bộ "vỏ trang" kiểu Cửa hàng: nền tông xám-xanh nhạt; breadcrumb nằm trong dải
   header gradient (.oe-page-head--slim). Bỏ padding dọc band để không cộng dồn. */
.bd-page { background: #f4f6f8; }
.bd-page .oe-page-head { padding-top: 8px; padding-bottom: 0; }

/* ---- Breadcrumb (top ~20px cho khớp các trang khác) ------------------- */
.bd-crumb { padding: 12px 0 4px; }
/* Một hàng, căn giữa theo trục dọc, không xuống dòng; mục cuối (tên bài) dài thì
   cắt "…" thay vì làm gãy layout. */
.bd-crumb .pd-breadcrumb-list {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    text-align: left;
    min-width: 0;
}
.bd-crumb .pd-breadcrumb-list span,
.bd-crumb .pd-breadcrumb-list a {
    font-size: 13px;
    line-height: 1.4;
    color: var(--bd-muted);
    white-space: nowrap;
    flex: 0 0 auto;
}
.bd-crumb a:hover { color: var(--bd-ink); }
.bd-crumb-current {
    color: var(--bd-ink) !important;
    font-weight: 600;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Bố cục 2 cột (bài + sidebar) -------------------------------------- */
.bd-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 40px;
    align-items: start;
    padding: 40px 0 0;   /* đáy do khối CTA/đáy trang lo, tránh cộng dồn khoảng cách */
}

/* Khối CTA cuối trang: cách bài viết 56px (đồng nhịp), đáy trang 72px.
   Ghi đè margin mặc định của .bl-cta (64px 0 20px) — chỉ áp ở trang chi tiết. */
.bd-page .bl-cta { margin: 56px 0 72px; }

/* Vùng bài viết = khung thẻ trắng nổi (đồng bộ kiểu Cửa hàng). */
.bd-article {
    background: #fff;
    border: 1px solid #e7eaee;
    border-radius: 20px;
    padding: 36px 40px;
    box-shadow: 0 10px 30px rgba(17, 17, 17, .05);
}
@media (max-width: 991px) { .bd-article { padding: 24px; border-radius: 16px; } }
@media (max-width: 575px) { .bd-article { padding: 18px 16px; } }

/* ---- Header bài viết --------------------------------------------------- */
.bd-head {
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--bd-line);
}

.bd-eyebrow {
    display: inline-block;
    margin-bottom: 16px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(228, 0, 43, .08);
    color: var(--bd-accent);
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.bd-title {
    margin: 0;
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.8px;
    color: var(--bd-ink);
}

/* ---- Nội dung thân bài (entry-content) — typography đọc tốt ----------- */
.bd-content {
    font-size: 17px;
    line-height: 1.8;
    color: #2b2f36;
    word-wrap: break-word;
}

.bd-content > *:first-child { margin-top: 0; }
.bd-content > *:last-child { margin-bottom: 0; }

.bd-content p { margin: 0 0 22px; }

.bd-content h2,
.bd-content h3,
.bd-content h4 {
    color: var(--bd-ink);
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -.4px;
    scroll-margin-top: 100px;
}

.bd-content h2 { font-size: clamp(22px, 2.6vw, 28px); margin: 42px 0 16px; }
.bd-content h3 { font-size: clamp(19px, 2.2vw, 23px); margin: 34px 0 14px; }
.bd-content h4 { font-size: 18px; margin: 28px 0 12px; }

.bd-content a {
    color: var(--bd-accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color .2s;
}
.bd-content a:hover { color: var(--bd-accent-dark); }

.bd-content img,
.bd-content video,
.bd-content iframe {
    max-width: 100%;
    height: auto;
    border-radius: 14px;
    display: block;
    margin: 28px auto;
}

.bd-content figure { margin: 28px 0; }
.bd-content figcaption {
    margin-top: 10px;
    text-align: center;
    font-size: 13.5px;
    color: var(--bd-muted);
    font-style: italic;
}

.bd-content ul,
.bd-content ol { margin: 0 0 22px; padding-left: 22px; }
.bd-content li { margin-bottom: 10px; padding-left: 4px; }
.bd-content ul li::marker { color: var(--bd-accent); }
.bd-content ol li::marker { color: var(--bd-accent); font-weight: 700; }

.bd-content blockquote {
    margin: 28px 0;
    padding: 18px 24px;
    border-left: 4px solid var(--bd-accent);
    background: var(--bd-soft);
    border-radius: 0 12px 12px 0;
    color: var(--bd-ink);
    font-size: 18px;
    font-style: italic;
}
.bd-content blockquote p:last-child { margin-bottom: 0; }

.bd-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 15px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--bd-line);
}
.bd-content th,
.bd-content td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bd-line);
    text-align: left;
}
.bd-content thead th {
    background: var(--bd-soft);
    color: var(--bd-ink);
    font-weight: 700;
}
.bd-content tbody tr:last-child td { border-bottom: none; }

.bd-content hr {
    border: none;
    border-top: 1px solid var(--bd-line);
    margin: 36px 0;
}

.bd-content pre {
    background: #1e2128;
    color: #e6e6e6;
    padding: 18px 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 14px;
}
.bd-content code {
    background: var(--bd-soft);
    padding: 2px 6px;
    border-radius: 5px;
    font-size: .9em;
}
.bd-content pre code { background: none; padding: 0; }

/* ---- Footer bài: chia sẻ + quay lại ------------------------------------ */
.bd-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--bd-line);
}

.bd-share {
    display: flex;
    align-items: center;
    gap: 10px;
}
.bd-share-label { font-size: 14px; font-weight: 600; color: var(--bd-ink); margin-right: 2px; }

.bd-share-btn {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--bd-line);
    color: var(--bd-ink);
    background: #fff;
    cursor: pointer;
    transition: transform .15s, background .2s, color .2s, border-color .2s;
}
.bd-share-btn:hover {
    transform: translateY(-2px);
    background: var(--bd-accent);
    border-color: var(--bd-accent);
    color: #fff;
}
.bd-share-btn.is-copied {
    background: #15803d;
    border-color: #15803d;
    color: #fff;
}

.bd-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 22px;
    border-radius: 999px;
    border: 1px solid var(--bd-line);
    font-size: 14px;
    font-weight: 700;
    color: var(--bd-ink);
    background: #fff;
    transition: background .2s, border-color .2s, color .2s;
}
.bd-back:hover { background: var(--bd-ink); border-color: var(--bd-ink); color: #fff; }

/* ---- Sidebar ----------------------------------------------------------- */
.bd-sidebar { position: sticky; top: 96px; }

.bd-widget {
    border: 1px solid #e7eaee;
    border-radius: var(--bd-radius);
    padding: 24px 22px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(17, 17, 17, .05);
}

.bd-widget-title {
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.3px;
    color: var(--bd-ink);
    display: flex;
    align-items: center;
    gap: 10px;
}
.bd-widget-title::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 3px;
    background: var(--bd-accent);
}

.bd-rc-list { display: flex; flex-direction: column; gap: 6px; }

.bd-rc {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px;
    border-radius: 14px;
    transition: background .2s;
}
.bd-rc:hover { background: var(--bd-soft); }

/* Khối chữ bên phải thumbnail: tiêu đề + mô tả ngắn. min-width:0 để chữ tự xuống dòng, không tràn. */
.bd-rc-body { flex: 1; min-width: 0; }

.bd-rc-thumb {
    flex: none;
    width: 78px;
    height: 64px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bd-soft);
}
.bd-rc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s ease;
}
.bd-rc:hover .bd-rc-thumb img { transform: scale(1.06); }

.bd-rc-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.bd-rc-title a { color: var(--bd-ink); }
.bd-rc-title a:hover { color: var(--bd-accent); }

/* Mô tả ngắn bài viết khác: cắt gọn 2 dòng, màu nhạt. */
.bd-rc-excerpt {
    margin: 5px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--bd-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1199px) {
    .bd-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; }
}

@media (max-width: 991px) {
    .bd-layout { grid-template-columns: 1fr; gap: 36px; }
    .bd-sidebar { position: static; }
    .bd-widget { padding: 22px; }
}

@media (max-width: 575px) {
    .bd-content { font-size: 16px; }
    .bd-foot { flex-direction: column-reverse; align-items: stretch; }
    .bd-back { justify-content: center; }
    .bd-share { justify-content: center; }
}

/* ===== Tệp đính kèm (PDF/Excel/Word) chèn từ Thư viện Media — thẻ tải về dễ nhận biết ===== */
/* Mỗi file 1 thẻ riêng (link nằm trong <p>), icon loại file to bên trái, mũi tên tải về bên phải. */
.bd-content .oe-file-attach {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 560px;
    margin: 16px 0;
    padding: 18px 22px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-left: 5px solid #e11d2a;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, .06);
    color: #1e293b;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    word-break: break-word;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.bd-content .oe-file-attach:hover {
    background: #fff;
    border-color: #e11d2a;
    box-shadow: 0 8px 22px rgba(225, 29, 42, .14);
    transform: translateY(-1px);
}
.bd-content .oe-file-attach img {
    width: 48px !important;
    height: 48px !important;
    flex: 0 0 48px;
    margin: 0 !important;
}
/* Mũi tên tải về đẩy sang phải — gợi ý đây là file tải được */
.bd-content .oe-file-attach::after {
    content: "\f019"; /* fa-download */
    font-family: "Font Awesome 6 Pro", "Font Awesome 5 Pro", "Font Awesome 6 Free", "Font Awesome 5 Free", sans-serif;
    font-weight: 900;
    margin-left: auto;
    padding-left: 14px;
    font-size: 18px;
    color: #94a3b8;
}
.bd-content .oe-file-attach:hover::after { color: #e11d2a; }
