/* ============================================================
   FIX NỘI DUNG CKEDITOR 5 TRONG THEME STYLE2025
   Thêm vào file: themes/style2025/css/custom.css
   ============================================================ */

/* ── Vùng nội dung bài viết ────────────────────────────────── */
#news-bodyhtml,
.bodytext,
.hometext {
    line-height: 1.8;
    font-size: 15px;
    color: #333;
    word-break: break-word;
}

/* ── Tiêu đề (h1–h6) ────────────────────────────────────────
   Theme reset toàn bộ → phải khai báo lại kích thước & khoảng cách
   ─────────────────────────────────────────────────────────── */
#news-bodyhtml h1,
#news-bodyhtml h2,
#news-bodyhtml h3,
#news-bodyhtml h4,
#news-bodyhtml h5,
#news-bodyhtml h6,
.bodytext h1,
.bodytext h2,
.bodytext h3,
.bodytext h4,
.bodytext h5,
.bodytext h6 {
    font-weight: 700;
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    line-height: 1.4;
    color: #111;
}
#news-bodyhtml h1, .bodytext h1 { font-size: 2em; }
#news-bodyhtml h2, .bodytext h2 { font-size: 1.6em; }
#news-bodyhtml h3, .bodytext h3 { font-size: 1.35em; }
#news-bodyhtml h4, .bodytext h4 { font-size: 1.15em; }
#news-bodyhtml h5, .bodytext h5 { font-size: 1em; }
#news-bodyhtml h6, .bodytext h6 { font-size: 0.9em; color: #555; }

/* ── Đoạn văn & khoảng cách ────────────────────────────────── */
#news-bodyhtml p,
.bodytext p {
    margin-bottom: 1em;
}

/* ── Danh sách (ul / ol) ────────────────────────────────────
   Theme reset list-style: none → phải khôi phục lại
   ─────────────────────────────────────────────────────────── */
#news-bodyhtml ul,
.bodytext ul {
    list-style: disc;
    padding-left: 1.8em;
    margin-bottom: 1em;
}
#news-bodyhtml ol,
.bodytext ol {
    list-style: decimal;
    padding-left: 1.8em;
    margin-bottom: 1em;
}
#news-bodyhtml ul li,
#news-bodyhtml ol li,
.bodytext ul li,
.bodytext ol li {
    list-style: inherit;
    padding: 0;
    margin: 0 0 0.3em 0;
    display: list-item;
}
/* Danh sách lồng nhau */
#news-bodyhtml ul ul,
.bodytext ul ul {
    list-style: circle;
    margin-bottom: 0;
}
#news-bodyhtml ul ul ul,
.bodytext ul ul ul {
    list-style: square;
}
#news-bodyhtml ol ol,
.bodytext ol ol {
    list-style: lower-alpha;
    margin-bottom: 0;
}

/* ── Hình ảnh ───────────────────────────────────────────────── */
#news-bodyhtml img,
.bodytext img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em auto;
    border-radius: 4px;
}
/* Hình inline (CKEditor thêm class này) */
#news-bodyhtml img.image-style-side,
.bodytext img.image-style-side {
    float: right;
    margin: 0.5em 0 1em 1.5em;
    max-width: 50%;
}
#news-bodyhtml .image,
.bodytext .image {
    text-align: center;
    margin: 1.5em 0;
}
#news-bodyhtml .image > figcaption,
.bodytext .image > figcaption {
    font-size: 13px;
    color: #777;
    text-align: center;
    margin-top: 0.4em;
    font-style: italic;
}

/* ── Blockquote ─────────────────────────────────────────────── */
#news-bodyhtml blockquote,
.bodytext blockquote {
    border-left: 4px solid #ff6700;
    margin: 1.5em 0;
    padding: 0.8em 1.2em;
    background: #fff8f5;
    color: #555;
    font-style: italic;
    border-radius: 0 4px 4px 0;
}
#news-bodyhtml blockquote p,
.bodytext blockquote p {
    margin-bottom: 0;
}

/* ── Bảng (table) ───────────────────────────────────────────── */
#news-bodyhtml table,
.bodytext table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 14px;
    overflow-x: auto;
    display: block;
}
#news-bodyhtml table th,
#news-bodyhtml table td,
.bodytext table th,
.bodytext table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}
#news-bodyhtml table th,
.bodytext table th {
    background: #f5f5f5;
    font-weight: 700;
    color: #333;
}
#news-bodyhtml table tr:hover,
.bodytext table tr:hover {
    background: #fafafa;
}

/* ── Code & Pre ─────────────────────────────────────────────── */
#news-bodyhtml pre,
.bodytext pre {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1em;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    margin: 1em 0;
}
#news-bodyhtml code,
.bodytext code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    color: #c7254e;
}
#news-bodyhtml pre code,
.bodytext pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ── Đường kẻ ngang (hr) ────────────────────────────────────── */
#news-bodyhtml hr,
.bodytext hr {
    border: none;
    border-top: 2px solid #eee;
    margin: 2em 0;
}

/* ── Link trong nội dung ────────────────────────────────────── */
#news-bodyhtml a,
.bodytext a {
    color: #ff6700;
    text-decoration: underline;
}
#news-bodyhtml a:hover,
.bodytext a:hover {
    color: #cc5200;
    text-decoration: none;
}

/* ── Strong / Em / Mark ─────────────────────────────────────── */
#news-bodyhtml strong, .bodytext strong { font-weight: 700; }
#news-bodyhtml em,     .bodytext em     { font-style: italic; }
#news-bodyhtml mark,   .bodytext mark   { background: #fff3cd; padding: 0 3px; border-radius: 2px; }
#news-bodyhtml u,      .bodytext u      { text-decoration: underline; }
#news-bodyhtml s,      .bodytext s      { text-decoration: line-through; }
#news-bodyhtml sub,    .bodytext sub    { vertical-align: sub; font-size: 0.8em; }
#news-bodyhtml sup,    .bodytext sup    { vertical-align: super; font-size: 0.8em; }

/* ── CKEditor 5 – class đặc trưng ───────────────────────────── */
/* Media embed (YouTube, v.v.) */
#news-bodyhtml .media,
.bodytext .media {
    margin: 1.5em 0;
}
#news-bodyhtml .media > div,
.bodytext .media > div {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
}
#news-bodyhtml .media iframe,
.bodytext .media iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* Căn chỉnh hình CKEditor */
#news-bodyhtml .image.image_resized,
.bodytext .image.image_resized {
    display: block;
    box-sizing: border-box;
}
#news-bodyhtml .image.image-style-align-left,
.bodytext .image.image-style-align-left {
    float: left;
    margin-right: 1.5em;
    margin-bottom: 0.5em;
}
#news-bodyhtml .image.image-style-align-right,
.bodytext .image.image-style-align-right {
    float: right;
    margin-left: 1.5em;
    margin-bottom: 0.5em;
}
#news-bodyhtml .image.image-style-align-center,
.bodytext .image.image-style-align-center {
    margin-left: auto;
    margin-right: auto;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 576px) {
    #news-bodyhtml,
    .bodytext {
        font-size: 14px;
    }
    #news-bodyhtml h1, .bodytext h1 { font-size: 1.6em; }
    #news-bodyhtml h2, .bodytext h2 { font-size: 1.35em; }
    #news-bodyhtml h3, .bodytext h3 { font-size: 1.15em; }
    #news-bodyhtml table,
    .bodytext table {
        font-size: 12px;
    }
    #news-bodyhtml table th,
    #news-bodyhtml table td,
    .bodytext table th,
    .bodytext table td {
        padding: 6px 8px;
    }
    #news-bodyhtml .image.image-style-align-left,
    #news-bodyhtml .image.image-style-align-right,
    .bodytext .image.image-style-align-left,
    .bodytext .image.image-style-align-right {
        float: none;
        margin-left: auto;
        margin-right: auto;
    }
}