/* ============================================================
   FILE: wwwroot/user/css/page/dynamic-page.css
   VIEW: Areas/User/Views/Page/DynamicPage.cshtml
   ============================================================ */

/* === Page wrapper =========================================== */
.dynamic-page-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

/* === Breadcrumb ============================================= */
.dp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #6b7280;
    margin-bottom: 28px;
}
.dp-breadcrumb a {
    color: #6b7280;
    text-decoration: none;
    transition: color 0.2s;
}
.dp-breadcrumb a:hover { color: #E91E8C; }
.dp-breadcrumb span   { color: #111827; font-weight: 600; }

/* === Page title ============================================= */
.dp-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 8px;
    line-height: 1.3;
}
.dp-updated {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-bottom: 32px;
    display: block;
}
.dp-divider {
    width: 48px;
    height: 3px;
    background: linear-gradient(90deg, #E91E8C, #2196F3);
    border-radius: 2px;
    margin-bottom: 32px;
}

/* =============================================================
   PROSE — Rich content tu TinyMCE
   Bao phu toan bo HTML ma TinyMCE co the sinh ra
   ============================================================= */
.dp-content {
    color: #374151;
    font-size: 0.95rem;
    line-height: 1.85;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* --- Doan van & xuong dong ---------------------------------- */
.dp-content p {
    margin: 0 0 1.1em;
}
/* TinyMCE sinh <p>&nbsp;</p> lam dong trong — giu khoang */
.dp-content p:empty,
.dp-content p > br:only-child {
    margin: 0;
    min-height: 1.2em;
}

/* --- Headings ----------------------------------------------- */
.dp-content h1,
.dp-content h2,
.dp-content h3,
.dp-content h4,
.dp-content h5,
.dp-content h6 {
    color: #111827;
    font-weight: 700;
    line-height: 1.35;
    margin: 1.8em 0 0.6em;
}
.dp-content h1 { font-size: 1.6rem;  border-bottom: 2px solid #f3f4f6; padding-bottom: 0.3em; }
.dp-content h2 { font-size: 1.35rem; border-bottom: 1px solid #f3f4f6; padding-bottom: 0.25em; }
.dp-content h3 { font-size: 1.15rem; }
.dp-content h4 { font-size: 1.0rem;  }
.dp-content h5 { font-size: 0.9rem;  }
.dp-content h6 { font-size: 0.85rem; color: #6b7280; }
.dp-content > h1:first-child,
.dp-content > h2:first-child,
.dp-content > h3:first-child { margin-top: 0; }

/* --- In dam / In nghiem / Gach chan / Gach ngang ----------- */
.dp-content strong,
.dp-content b {
    font-weight: 700;
    color: #111827;
}
.dp-content em,
.dp-content i {
    font-style: italic;
}
.dp-content u {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.dp-content s,
.dp-content del,
.dp-content strike {
    text-decoration: line-through;
    color: #9ca3af;
}
.dp-content strong em,
.dp-content em strong {
    font-weight: 700;
    font-style: italic;
}

/* --- Superscript / Subscript -------------------------------- */
.dp-content sup { vertical-align: super; font-size: 0.7em; }
.dp-content sub { vertical-align: sub;   font-size: 0.7em; }

/* --- Danh sach (ul / ol) ----------------------------------- */
.dp-content ul,
.dp-content ol {
    margin: 0.4em 0 1.1em 1.6em;
    padding: 0;
}
.dp-content ul { list-style-type: disc; }
.dp-content ol { list-style-type: decimal; }
.dp-content li {
    margin-bottom: 0.35em;
    padding-left: 0.2em;
    line-height: 1.75;
}
/* Long nhau cap 2 */
.dp-content ul ul,
.dp-content ol ol,
.dp-content ul ol,
.dp-content ol ul {
    margin: 0.25em 0 0.25em 1.4em;
    list-style-type: circle;
}
/* Long nhau cap 3 */
.dp-content ul ul ul,
.dp-content ol ol ol {
    list-style-type: square;
}
.dp-content li > p { margin-bottom: 0.2em; }

/* --- Link -------------------------------------------------- */
.dp-content a {
    color: #E91E8C;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s;
}
.dp-content a:hover { opacity: 0.75; }

/* --- Blockquote -------------------------------------------- */
.dp-content blockquote {
    border-left: 4px solid #E91E8C;
    margin: 1.4em 0;
    padding: 12px 18px;
    background: #fdf2f8;
    color: #4b5563;
    border-radius: 0 8px 8px 0;
    font-style: italic;
}
.dp-content blockquote p { margin: 0; }

/* --- Duong ke ngang (hr) ----------------------------------- */
.dp-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 2em 0;
}

/* --- Code inline & block ----------------------------------- */
.dp-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
    background: #f3f4f6;
    color: #e11d48;
    padding: 0.15em 0.5em;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}
.dp-content pre {
    background: #1f2937;
    color: #f3f4f6;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 16px 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 1.2em 0;
}
.dp-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* --- Bang (table) ------------------------------------------ */
.dp-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 1.4em 0;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.dp-content table th,
.dp-content table td {
    border: 1px solid #e5e7eb;
    padding: 10px 16px;
    text-align: left;
    vertical-align: top;
}
.dp-content table th {
    background: #f9fafb;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}
.dp-content table tr:nth-child(even) td { background: #fafafa; }
.dp-content table tr:hover td           { background: #fef9ff; }

/* --- Hinh anh --------------------------------------------- */
.dp-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
    display: block;
}
.dp-content figure      { margin: 1.2em 0; text-align: center; }
.dp-content figcaption  { font-size: 0.8rem; color: #9ca3af; margin-top: 6px; font-style: italic; }

/* --- Mau chu & mau nen (TinyMCE forecolor / hilitecolor) ---
   TinyMCE inject style="color:..." truc tiep vao <span>
   => inline style tu thang mac dinh, khong can override */
.dp-content span { font-family: inherit; }

/* --- Can chinh (align) ------------------------------------ */
.dp-content [style*="text-align: center"],
.dp-content [style*="text-align:center"]  { text-align: center; }
.dp-content [style*="text-align: right"],
.dp-content [style*="text-align:right"]   { text-align: right;  }
.dp-content [style*="text-align: justify"],
.dp-content [style*="text-align:justify"] { text-align: justify; }

/* --- Padding inline (TinyMCE indent) ---------------------- */
.dp-content [style*="padding-left"] { box-sizing: border-box; }

/* --- div container ---------------------------------------- */
.dp-content div { max-width: 100%; }

/* --- Empty state ------------------------------------------ */
.dp-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
    font-size: 0.9rem;
}

/* --- Responsive ------------------------------------------- */
@media (max-width: 640px) {
    .dynamic-page-wrap    { padding: 24px 16px 48px; }
    .dp-title             { font-size: 1.35rem; }
    .dp-content           { font-size: 0.9rem; }
    .dp-content h1        { font-size: 1.3rem; }
    .dp-content h2        { font-size: 1.1rem; }
    .dp-content h3        { font-size: 1rem;   }
    .dp-content ul,
    .dp-content ol        { margin-left: 1.2em; }
}
