/* ==========================================================================
   content_style.css — intranet content pages
   ใช้ร่วมกับ W3.CSS (โหลด W3.CSS ก่อนไฟล์นี้)
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&display=swap");

:root {
    --brand: #A991DF;
    --brand-dark: #7648e2;
    --brand-soft: #f1ecfb;
    --ink: #1f2430;
    --ink-soft: #5b6270;
    --line: #e6e8ee;
    --page-bg: #f3f4f6;
    --card-bg: #ffffff;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(31, 36, 48, .05), 0 8px 24px rgba(31, 36, 48, .06);
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.contener-awl {
    margin-top: -34px;            /* ชดเชยความสูง header เดิม */
    padding: 34px clamp(16px, 4vw, 50px);
    background-color: var(--page-bg);
    font-family: "Sarabun", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
}

.content-awl {
    max-width: 1200px;
    min-height: 100vh;
    margin: 0 auto;
    padding: clamp(20px, 3vw, 40px);
    background-color: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 16px;
    line-height: 1.75;
}

/* --------------------------------------------------------------------------
   Typography ภายในเนื้อหา (รวมถึงเนื้อหาจาก Quill)
   -------------------------------------------------------------------------- */
.content-awl h1,
.content-awl h2,
.content-awl h3,
.content-awl h4 {
    margin: 1.6em 0 .6em;
    line-height: 1.35;
    font-weight: 700;
    color: var(--ink);
}
.content-awl > h1:first-child,
.content-awl > h2:first-child,
.content-awl > h3:first-child { margin-top: 0; }

.content-awl h1 { font-size: 1.9rem; }
.content-awl h2 { font-size: 1.55rem; }
.content-awl h3 {
    font-size: 1.3rem;
    padding-bottom: .4em;
    border-bottom: 2px solid var(--brand-soft);
}
.content-awl h4 { font-size: 1.1rem; }

.content-awl p { margin: 0 0 1em; }
.content-awl b,
.content-awl strong { font-weight: 600; }

.content-awl a {
    color: var(--brand-dark);
    text-underline-offset: 3px;
}
.content-awl a:hover { color: #5a33b8; }

.content-awl ul,
.content-awl ol { padding-left: 1.4em; margin: 0 0 1em; }
.content-awl li { margin-bottom: .3em; }
.content-awl li::marker { color: var(--brand); }

/* รูปจากโพสต์ (Quill) ให้เต็มความกว้างการ์ด
   !important เพื่อทับ width/height ที่ Quill เก็บมาใน HTML (เช่น width="500") */
.content-awl img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    margin: 1em auto;
    border-radius: 10px;
}

.content-awl blockquote {
    margin: 1.2em 0;
    padding: .8em 1.2em;
    border-left: 4px solid var(--brand);
    background: var(--brand-soft);
    border-radius: 0 10px 10px 0;
    color: var(--ink-soft);
}

.content-awl hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.6em 0;
}

/* --------------------------------------------------------------------------
   ตาราง
   หมายเหตุ: หลายหน้ามี inline style บน table/td จึงต้องใช้ !important
   ถ้าลบ inline style ออกจาก PHP แล้ว สามารถเอา !important ออกได้
   -------------------------------------------------------------------------- */
.content-awl table {
    width: auto;
    max-width: 100%;
    border-collapse: separate !important;
    border-spacing: 0;
    border: 1px solid var(--line) !important;
    border-radius: 10px;
    overflow: hidden;
    margin: 12px 0 !important;
    font-size: .95rem;
}
.content-awl th,
.content-awl td {
    padding: 10px 24px !important;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    text-align: center;
}
.content-awl tr:last-child td { border-bottom: 0 !important; }
.content-awl th {
    background: var(--brand-soft);
    color: var(--ink);
    font-weight: 600;
}
.content-awl tbody tr:nth-child(even) td { background: #fafafc; }
.content-awl tbody tr:hover td { background: var(--brand-soft); }

/* ตารางที่กว้างเกินจอให้เลื่อนในตัวเอง */
@media (max-width: 640px) {
    .content-awl table { display: block; overflow-x: auto; }
}

/* --------------------------------------------------------------------------
   หน้า "ปรัชญา / วิสัยทัศน์ / พันธกิจ / นโยบายคุณภาพ"
   -------------------------------------------------------------------------- */
.content-awl .title {
    margin: 0 0 .35em;
    padding-left: 12px;
    border-left: 4px solid var(--brand);
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
}
.content-awl .subtitle {
    margin: 1.4em 0 .6em;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--brand-dark);
}
.content-awl .desc {
    max-width: 75ch;
    margin: 0 0 .5em;
    color: var(--ink-soft);
}
.content-awl .line {
    max-width: 85ch;
    margin: 0 0 .35em;
}

/* วัตถุประสงค์คุณภาพ: 3 ระดับหัวข้อ */
.content-awl .dept {
    display: inline-block;
    margin: 1.4em 0 .6em;
    padding: 2px 14px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    border-radius: 999px;
    font-weight: 600;
    font-size: .95rem;
}
.content-awl .l1 { margin-top: .6em; font-weight: 600; }
.content-awl .l2 { padding-left: 1.5em; color: var(--ink); }
.content-awl .l3 { padding-left: 3em; color: var(--ink-soft); font-size: .95rem; }

.content-awl .sep {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1.8em 0;
}

/* --------------------------------------------------------------------------
   หน้า "กฎระเบียบ"
   -------------------------------------------------------------------------- */
.content-awl select {
    padding: 6px 12px !important;
    border: 1px solid var(--line);
    border-radius: 999px !important;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: .95rem;
    max-width: 100%;
    cursor: pointer;
}
.content-awl select:hover { border-color: var(--brand); }
.content-awl select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* กล่องเนื้อหากฎระเบียบ (เดิมใช้ inline #F7F7F7) */
.content-awl .w3-panel[style*="F7F7F7"] {
    background-color: #fafafc !important;
    border: 1px solid var(--line);
    border-radius: var(--radius) !important;
}
.content-awl .w3-panel { margin-top: 0; margin-bottom: 0; }
.content-awl .w3-margin-left { margin-left: 24px !important; }

/* แจ้งเตือนมุมขวาบน */
#noti .w3-panel {
    background-color: #fff !important;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(31, 36, 48, .12);
    color: var(--ink);
    text-align: left !important;
    animation: noti-in .25s ease-out;
}
@keyframes noti-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.w3-modal {
    background-color: rgba(31, 36, 48, .45);
    backdrop-filter: blur(2px);
}
.w3-modal-content {
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(31, 36, 48, .25);
    overflow: hidden;
}
.w3-modal-content .w3-button.w3-display-topright:hover {
    background-color: var(--brand-soft) !important;
    color: var(--brand-dark) !important;
}

/* --------------------------------------------------------------------------
   ปุ่ม
   -------------------------------------------------------------------------- */
.post-create-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background-color: var(--brand);
    border-radius: 50%;
    box-shadow: 0 6px 16px rgba(118, 72, 226, .3);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.post-create-btn img { filter: brightness(0) invert(1); } /* ไอคอนเป็นสีขาว */
.post-create-btn:hover {
    background-color: var(--brand-dark);
    box-shadow: 0 8px 20px rgba(118, 72, 226, .4);
    transform: translateY(-2px);
}
.post-create-btn:focus-visible {
    outline: 3px solid var(--brand-soft);
    outline-offset: 2px;
}

.post-btn,
.post-btn-reset {
    border: 0;
    border-radius: 8px;
    padding: 8px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .15s ease, transform .1s ease;
}
.post-btn:active,
.post-btn-reset:active { transform: translateY(1px); }

.post-btn {
    background-color: var(--brand-dark);
    color: #fff;
}
.post-btn:hover { background-color: #5a33b8; }

.post-btn-reset {
    background-color: #eceef3;
    color: var(--ink);
}
.post-btn-reset:hover { background-color: #dde0e8; }

.post-btn:focus-visible,
.post-btn-reset:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Quill: การจัดตำแหน่ง / ย่อหน้า
   -------------------------------------------------------------------------- */
.ql-align-center  { text-align: center; }
.ql-align-right   { text-align: right; }
.ql-align-justify { text-align: justify; }

.ql-indent-1 { padding-left: 3em; }
.ql-indent-2 { padding-left: 6em; }
.ql-indent-3 { padding-left: 9em; }

/* --------------------------------------------------------------------------
   Responsive / Accessibility / Print
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .content-awl { font-size: 15px; }
    .content-awl .w3-margin-left { margin-left: 14px !important; }
    .content-awl .l2 { padding-left: 1em; }
    .content-awl .l3 { padding-left: 2em; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

@media print {
    .contener-awl { background: #fff; padding: 0; margin-top: 0; }
    .content-awl { box-shadow: none; padding: 0; }
    .post-create-btn, #noti, .w3-modal { display: none !important; }
}


/* ==========================================================================
   หน้านโยบาย / เอกสารประกาศ (anti-corruption.php)
   ========================================================================== */
.policy-head {
    text-align: center;
    margin-bottom: 1.8em;
    padding-bottom: 1.4em;
    border-bottom: 1px solid var(--line);
}
.policy-head h2 { margin: 0 0 .15em; }
.policy-head p  { margin: 0; font-size: 1.1rem; color: var(--ink-soft); }

.policy-section { margin-top: 2.4em; }
.policy-section > h3 { margin-top: 0; }
.policy-section h4 {
    margin: 1.6em 0 .4em;
    padding-left: 10px;
    border-left: 3px solid var(--brand);
    font-size: 1.05rem;
}
.policy-section h4:first-of-type { margin-top: 1em; }

/* รายการนิยาม: คำศัพท์ซ้าย คำอธิบายขวา ไม่มีกรอบ มีเส้นคั่นบางๆ */
.def-list {
    display: grid;
    grid-template-columns: minmax(140px, 240px) 1fr;
    margin: 0;
}
.def-list dt,
.def-list dd {
    margin: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.def-list dt {
    padding-right: 28px;
    font-weight: 600;
    color: var(--brand-dark);
}
.def-list dd { color: var(--ink); }
.def-list dt:last-of-type,
.def-list dd:last-of-type { border-bottom: 0; }

@media (max-width: 640px) {
    .def-list { grid-template-columns: 1fr; }
    .def-list dt { padding: 14px 0 2px; border-bottom: 0; }
    .def-list dd { padding: 0 0 14px; }
}

/* นโยบายแบบเรียงข้อ */
.policy-list { padding-left: 1.6em; }
.policy-list li { padding-left: .3em; margin-bottom: .9em; }
.policy-list li::marker { font-weight: 600; }

/* ช่องทางติดต่อ */
.contact-list {
    display: grid;
    gap: 12px;
    margin: 1em 0 0;
}
.contact-item {
    padding: 14px 18px;
    background: #fafafc;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.contact-item > b { display: block; margin-bottom: .2em; }
.contact-item p { margin: 0 0 .4em; color: var(--ink-soft); }
.contact-item p:last-child { margin-bottom: 0; }
.contact-item address {
    font-style: normal;
    color: var(--ink);
}

/* ท้ายประกาศ */
.policy-note {
    margin-top: 2.6em;
    padding: 1.2em;
    text-align: center;
    background: var(--brand-soft);
    border-radius: 12px;
    font-weight: 600;
}
.policy-note p { margin: 0 0 .3em; }
.policy-note p:last-child { margin-bottom: 0; }
