/* =====================================================
   BLOG POST CONTENT – CKEDITOR 4
   (NO .item – SCOPE ONLY postbox-details-wrap)
   ===================================================== */

/* ================= WRAPPER ================= */
.postbox-details-wrap{
    margin: 0 auto;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* =====================================================
   PARAGRAPH
   ===================================================== */
.postbox-details-wrap p,
.primary-content p
{
    margin: 0 0 20px;
    overflow: hidden; /* FIX text dính ảnh float */
    font-size: 16px;
    line-height: 1.6;
    text-align: justify;
}

/* =====================================================
   HEADINGS
   ===================================================== */
.postbox-details-wrap h2,
.primary-content h2
{
    font-size: 1.5rem;
    line-height: 2.1rem;
    margin-bottom: 20px;    
    font-weight: 800;
}
.postbox-details-wrap h4,
.postbox-details-wrap h3,
.primary-content h3,
.primary-content h4
{
    margin: 0px 0 20px;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.7;
}

/* =====================================================
   LISTS
   ===================================================== */
.postbox-details-wrap ul,
.postbox-details-wrap ol,
.primary-content ul,
.primary-content ol
{
    margin: 20px 0 20px;
    padding-left: 1.4rem;
    display: block;
}

.postbox-details-wrap li,
.primary-content li
{    
    font-size: 1rem;
}

.postbox-details-wrap li::marker,
.primary-content li::marker
{
    font-weight: 600;
}

/* =====================================================
   BLOCKQUOTE
   ===================================================== */
.postbox-details-wrap blockquote,
.primary-content blockquote
{
    margin: 36px 0;
    padding: 20px 28px;
    background: #f8fafc;
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    color: #374151;
    font-style: italic;
}

/* =====================================================
   IMAGE / FIGURE – CKEDITOR 4
   ===================================================== */
.postbox-details-wrap figure,
.primary-content figure
{
    display: block;
    margin: 36px auto;
    max-width: 100%;
    background: #f8fafc;
    border: 1px solid #fafafa;
    overflow: hidden;
    text-align: center; /* ảnh nhỏ auto center */
}

.postbox-details-wrap figure img,
.primary-content figure img 
{
    display: inline-block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.postbox-details-wrap figure figcaption,
.primary-content figure figcaption
{
    padding: .7em .5em;
    background: #fafafa;
    border-top: 1px solid #fafafa;
    font-size: 13px;
    color: #475569;
    text-align: center;
}
.postbox-details-wrap img,
.primary-content img
{
    height: auto !important;
}
/* ===== FLOAT INLINE (CKEDITOR 4) ===== */
.postbox-details-wrap figure[style*="float:left"],
.primary-content figure[style*="float:left"],
.postbox-details-wrap img[style*="float:left"],
.primary-content img[style*="float:left"]
{
    float: left;
    max-width: 50%;
    margin: 16px 24px 16px 0 !important;
    text-align: left;
}

.postbox-details-wrap figure[style*="float:right"],
.primary-content figure[style*="float:right"],
.postbox-details-wrap img[style*="float:right"],
.primary-content img[style*="float:right"]
{
    float: right;
    max-width: 50%;
    margin: 16px 0 16px 24px !important;
    text-align: right;
}

/* clear float */
.postbox-details-wrap::after,
.primary-content::after
{
    content: "";
    display: block;
    clear: both;
}

/* =====================================================
   LINKS
   ===================================================== */
.postbox-details-wrap a,
.primary-content a
{
    color: #2563eb;
    text-decoration: underline;
}

.postbox-details-wrap a:hover,
.primary-content a:hover
{
    color: #1d4ed8;
}

/* =====================================================
   CODE
   ===================================================== */
.postbox-details-wrap code,
.primary-content code
{
    padding: 3px 6px;
    background: #f1f5f9;
    border-radius: 4px;
    font-size: 14px;
}

.postbox-details-wrap pre,
.primary-content pre
{
    margin: 28px 0;
    padding: 18px;
    background: #0f172a;
    color: #e5e7eb;
    border-radius: 8px;
    overflow-x: auto;
}

/* =====================================================
   TABLE – OVERRIDE CKEDITOR
   ===================================================== */
.postbox-details-wrap table,
.primary-content table
{
    width: 100%;
    margin: 25px 0;
    border-collapse: collapse;
    border-spacing: 0 !important;
    background: #ffffff;
    border: 1px solid #bfbfbf;
    border-radius: 10px;
    font-size: 14px;
}

/* ===== CELLS ===== */
.postbox-details-wrap th
.primary-content th,
.postbox-details-wrap td,
.primary-content td
{
    padding: .4em;
    border-right: 1px solid #bfbfbf;
    border-bottom: 1px solid #bfbfbf;
    vertical-align: middle;
    text-align: left;
    line-height: 1.6;
}

/* remove last borders */
.postbox-details-wrap tr th:last-child,
.primary-content tr th:last-child,
.postbox-details-wrap tr td:last-child,
.primary-content tr td:last-child
{
    border-right: none;
}

.postbox-details-wrap tbody tr:last-child td,
.primary-content tbody tr:last-child td
{
    border-bottom: none;
}

/* ===== HEADER ===== */
.postbox-details-wrap thead th,
.primary-content thead th
{
    background: #f8fafc;
    font-weight: 600;
    color: #111827;
    text-transform: none;
}

/* nếu không có thead → hàng đầu coi như header */
.postbox-details-wrap table > tbody > tr:first-child td,
.primary-content table > tbody > tr:first-child td
{
    background: #f8fafc;
    font-weight: 600;
}

/* ===== ZEBRA ===== */
.postbox-details-wrap tbody tr:nth-child(even),
.primary-content tbody tr:nth-child(even)
{
    background: #f9fafb;
}

/* ===== HOVER ===== */
.postbox-details-wrap tbody tr:hover,
.primary-content tbody tr:hover
{
    background: #eef2ff;
}

/* ===== EMPTY CELL ===== */
.postbox-details-wrap td:empty::before,
.primary-content td:empty::before
{
    content: "—";
    color: #9ca3af;
}

/* ===== MOBILE ===== */
@media (max-width: 768px){
    .postbox-details-wrap table,
    .primary-content table
    {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}


/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px){
    .postbox-details-wrap,
    .primary-content
    {
        font-size: 15px;
    }

    /* reset float */
    .postbox-details-wrap figure[style*="float"],
    .primary-content figure[style*="float"],
    .postbox-details-wrap img[style*="float"],
    .primary-content img[style*="float"]
    {
        float: none !important;
        max-width: 100%;
        margin: 28px auto !important;
        text-align: center;
    }

    /* table scroll */
    .postbox-details-wrap table,
    .primary-content table
    {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
