/* RichEditor ทั้งระบบ (รอบ 4c ข้อ 5 — ยกจาก console.thevirus) · คู่กับ public/js/ms-rich-editor.js + App\Filament\Support\AppRichEditor
   ไม่ยกสีหัวข้อตามระดับ (h2 ส้ม / h3 ม่วง) ของ console: หน้า terms และระบบเดิมไม่ลงสีหัวข้อ → ใน editor ต้องเห็นเหมือนหน้าจริง */

/* สีข้อความ (span.color ของ Filament เก็บเป็นตัวแปร --color / --dark-color) */
.fi-fo-rich-editor-content span.color { color: var(--color); }
.dark .fi-fo-rich-editor-content span.color { color: var(--dark-color); }

/* ตารางในเนื้อหา: หัวตารางกลาง · ตัด margin ย่อหน้าในเซลล์/blockquote (TipTap ห่อเนื้อในเซลล์ด้วย <p>) */
.fi-fo-rich-editor-content th { text-align: center !important; }
.fi-fo-rich-editor-content td > p,
.fi-fo-rich-editor-content th > p { margin: 0; }
.fi-fo-rich-editor-content blockquote > :first-child { margin-top: 0; }
.fi-fo-rich-editor-content blockquote > :last-child { margin-bottom: 0; }

/* แถบเครื่องมือตรึงบนจอเวลาเลื่อนเอกสารยาว — พื้นทึบ (เนื้อหาที่เลื่อนผ่านไม่ทะลุ) · มุมบนโค้งตามกรอบ editor
   หน้าปกติ: ใต้แถบบนของแผง (64px, z-index 30) · ใน popup: ใต้หัว popup ที่ติดที่ (ms-rich-editor.js วัดความสูงหัว → --ms-editor-sticky-top) */
.fi-fo-rich-editor-toolbar {
    position: sticky;
    top: 64px;
    z-index: 10;
    background: #fff;
    border-top-left-radius: inherit;
    border-top-right-radius: inherit;
}
.fi-fo-rich-editor > .fi-input-wrp-content-ctn,
.fi-fo-rich-editor > .fi-input-wrp-content-ctn > div { border-radius: inherit; }
.dark .fi-fo-rich-editor-toolbar { background: color-mix(in oklab, var(--gray-900), #fff 5%); }
.fi-modal-window .fi-fo-rich-editor-toolbar { top: var(--ms-editor-sticky-top, 0px); }

/* เต็มจอ — กล่อง editor fixed เต็มจอ แถบเครื่องมือบนสุด เลื่อนเฉพาะเนื้อหา
   z-index 35: เหนือแถบบน/เมนูข้าง (30) แต่ต่ำกว่า popup ของ Filament (40) → popup แนบลิงก์/ไฟล์ขึ้นทับได้
   เนื้อหากว้างสุด 1100px กลางจอ */
.fi-fo-rich-editor.ms-editor-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 35;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: none;
}
.dark .fi-fo-rich-editor.ms-editor-fullscreen { background: var(--gray-900); }
.ms-editor-fullscreen > .fi-input-wrp-content-ctn,
.ms-editor-fullscreen > .fi-input-wrp-content-ctn > div {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.ms-editor-fullscreen .fi-fo-rich-editor-toolbar {
    position: static;
    flex: none;
    border-radius: 0;
    padding-inline: max(1rem, calc((100% - 1100px) / 2));
}
.ms-editor-fullscreen .fi-fo-rich-editor-main { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.ms-editor-fullscreen .fi-fo-rich-editor-content { max-width: 1100px; width: 100%; margin-inline: auto; }
/* จอแคบ Filament เรียง column-reverse + เนื้อหา flex-basis 0 → เนื้อหาถูกบีบแล้วล้น และเริ่มเลื่อนจากท้ายเอกสาร */
@container (max-width: 42rem) {
    .ms-editor-fullscreen .fi-fo-rich-editor-main { flex-direction: column; }
    .ms-editor-fullscreen .fi-fo-rich-editor-main > :not(.fi-fo-rich-editor-content) { order: -1; }
    .ms-editor-fullscreen .fi-fo-rich-editor-content { flex: 1 0 auto; }
}
.ms-editor-fullscreen [data-ms-editor-fullscreen] { background-color: var(--gray-50); color: var(--primary-600); }
.dark .ms-editor-fullscreen [data-ms-editor-fullscreen] { background-color: color-mix(in oklab, #fff 5%, transparent); color: var(--primary-400); }
html.ms-editor-fs-open { overflow: hidden; }
