/* ============================================================
   MOIT Public CSS  —  ธีมราชการไทย  (Sarabun font)
   Primary : #2558A8  |  Accent : #C9A227  |  Green : #1A5C2A
   ============================================================ */

/* ---- Font ---- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ============================================================
   Global – apply Sarabun to the whole moit section
   (ยกเว้น .fa เพื่อไม่ให้ override Font Awesome)
   ============================================================ */
.moit-section {
    font-family: 'Sarabun', 'Tahoma', 'Arial', sans-serif;
}
.moit-section *:not(i):not([class*="fa"]) {
    font-family: 'Sarabun', 'Tahoma', 'Arial', sans-serif;
}
/* คืน font-family ให้ Font Awesome icons */
.moit-section .fa,
.moit-section i[class^="fa-"],
.moit-section i[class*=" fa-"] {
    font-family: FontAwesome !important;
}

/* ============================================================
   ยกเลิก plus-sign.png / minus-sign.png จาก accordion-caret
   ที่ custom-styles.css ใส่ไว้ — ใช้ chevron ของเราแทน
   ============================================================ */
.moit-section .accordion-caret .accordion-toggle::before,
.moit-section .accordion-caret .accordion-toggle:not(.collapsed)::before,
.moit-section .accordion-caret .accordion-toggle.collapsed::before {
    content: none !important;
    display: none !important;
}

/* ============================================================
   Wrapper
   ============================================================ */
.moit-section {
    padding: 0 0 48px;
    background: #f0f3f9;
}

/* ============================================================
   Section Header Banner
   ============================================================ */
.moit-section-title {
    background: linear-gradient(135deg, #1c4a9a 0%, #2558A8 50%, #2e65bb 100%);
    color: #fff;
    text-align: center;
    padding: 40px 24px 32px;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}
/* ลายน้ำรูปสี่เหลี่ยมจาง ๆ */
.moit-section-title::after {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 160px; height: 160px;
    border: 28px solid rgba(255,255,255,0.05);
    border-radius: 50%;
    pointer-events: none;
}
/* เส้นทองด้านล่าง */
.moit-section-title::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, #C9A227 20%, #e8c653 50%, #C9A227 80%, transparent);
}
.moit-section-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 6px;
    line-height: 1.4;
    text-shadow: none;
    letter-spacing: 0.4px;
}
.moit-section-title h2 {
    font-size: 14px;
    font-weight: 400;
    color: rgba(255,255,255,0.80);
    margin: 0 0 16px;
    letter-spacing: 0.5px;
}
.moit-year-badge {
    display: inline-block;
    background: linear-gradient(135deg, #b8891e, #C9A227 50%, #d4aa3a);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 6px 30px;
    border-radius: 20px;
    letter-spacing: 1px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.30);
}

/* ============================================================
   Year Navigation Bar
   ============================================================ */
.moit-year-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 16px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
}
.moit-year-nav-label {
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-right: 4px;
}
.moit-year-btn {
    display: inline-block;
    padding: 5px 18px;
    border-radius: 20px;
    border: 2px solid #C9A227;
    color: #C9A227;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}
.moit-year-btn:hover {
    background: #C9A227;
    color: #fff;
    text-decoration: none;
}
.moit-year-btn.active {
    background: #C9A227;
    color: #fff;
    pointer-events: none;
}
.moit-year-current-mark {
    font-size: 10px;
    vertical-align: middle;
    opacity: 0.8;
}
@media (max-width: 600px) {
    .moit-year-nav { padding: 10px 12px 12px; gap: 6px; }
    .moit-year-btn { font-size: 13px; padding: 4px 14px; }
}

/* ============================================================
   Two-column layout container
   ============================================================ */
.moit-col-wrap {
    padding: 0 12px;
}

/* ============================================================
   Category / Group Header  (ตัวชี้วัดที่ N)
   ============================================================ */
.moit-category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(90deg, #1f4d9a 0%, #2558A8 100%);
    color: #fff;
    padding: 10px 16px;
    border-radius: 4px;
    margin: 22px 0 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border-left: 5px solid #C9A227;
    box-shadow: 0 2px 8px rgba(27,58,107,0.22);
}
.moit-category-header:first-child { margin-top: 0; }
.moit-category-header i {
    color: #ffd96a;
    font-size: 13px;
    flex-shrink: 0;
}

/* ============================================================
   Accordion Panel
   ============================================================ */
.moit-panel {
    background: #fff;
    border: 1px solid #dce4f0;
    border-radius: 5px;
    margin-bottom: 5px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(27,58,107,0.07);
    transition: box-shadow 0.2s, border-color 0.2s;
}
.moit-panel:hover {
    box-shadow: 0 3px 14px rgba(27,58,107,0.13);
    border-color: #c0cce8;
}

/* Heading */
.moit-panel-heading {
    background: #f8fafd;
    border-bottom: 1px solid transparent;
}
.moit-panel.open > .moit-panel-heading {
    background: linear-gradient(90deg, #e8eefb, #edf2fc);
    border-bottom-color: #c5d0e8;
}

/* ============================================================
   Toggle link — flexbox ดันปุ่มไปขวา ไม่ทับข้อความ
   ============================================================ */
.moit-section .moit-accordion-toggle {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 11px 14px !important;
    color: #1e4d9a !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    line-height: 1.5 !important;
    border-left: 3px solid transparent !important;
    background: transparent !important;
    transition: background 0.15s, border-color 0.15s !important;
}
.moit-section .moit-accordion-toggle:hover,
.moit-section .moit-accordion-toggle:focus {
    color: #1e4d9a !important;
    text-decoration: none !important;
    background: #e4ecf8 !important;
    border-left-color: #C9A227 !important;
}
.moit-section .moit-accordion-toggle:not(.collapsed) {
    border-left-color: #C9A227 !important;
    color: #1a3f8a !important;
    background: linear-gradient(90deg, #e2eaf9, #edf2fc) !important;
}

/* ข้อความใน toggle — flex:1 เพื่อดันปุ่มไปชิดขวา */
.moit-section .moit-toggle-text {
    flex: 1;
}

/* --- วงกลม chevron (สีม่วงหม่น) --- */
.moit-section .moit-caret {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #ede8f5;
    border: 1px solid #b8a8d8;
    transition: background 0.25s, border-color 0.25s;
}
.moit-section .moit-caret i {
    color: #6448a8;
    font-size: 11px;
    font-family: FontAwesome !important;
    transition: transform 0.28s ease, color 0.2s;
}
/* เมื่อเปิด — หมุน chevron + เปลี่ยนสี */
.moit-section .moit-accordion-toggle:not(.collapsed) .moit-caret {
    background: #6448a8;
    border-color: #503a90;
}
.moit-section .moit-accordion-toggle:not(.collapsed) .moit-caret i {
    color: #fff;
    transform: rotate(-180deg);
}

/* Panel body */
.moit-panel-body {
    padding: 14px 18px 18px;
    background: #fff;
    font-size: 14px;
    line-height: 1.8;
    color: #2c2c2c;
    border-top: 2px solid #e8eef8;
}

/* ============================================================
   Item rows
   ============================================================ */
.moit-item {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    padding: 5px 2px;
    gap: 0;
    border-bottom: 1px solid #f0f3f9;
}
.moit-item:last-child {
    border-bottom: none;
}

/* Indent */
.moit-item.indent-0 { margin-left: 0; }
.moit-item.indent-1 { margin-left: 20px; }
.moit-item.indent-2 { margin-left: 40px; }

/* Icon per level */
.moit-item-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 7px;
    margin-top: 3px;
}

/* indent-0: bookmark-o — น้ำเงิน */
.moit-item.indent-0 .moit-item-icon {
    color: #2558A8;
    font-size: 12px;
    width: 16px;
}

/* indent-1: chevron-right — น้ำเงินอ่อน */
.moit-item.indent-1 .moit-item-icon {
    color: #6b92cc;
    font-size: 11px;
    width: 14px;
}

/* indent-2: angle-right — เทาอ่อน */
.moit-item.indent-2 .moit-item-icon {
    color: #a8bbda;
    font-size: 11px;
    width: 12px;
}

/* Header item (is_header) — bookmark เต็ม สีเขียว */
.moit-item.item-is-header {
    margin-top: 10px;
    padding: 6px 8px;
    border-bottom: 1px dashed #b8dbbf;
    background: #f5fbf6;
    border-radius: 3px;
}
.moit-item.item-is-header .moit-item-text {
    font-weight: 700;
    color: #1A5C2A;
    font-size: 13.5px;
}
.moit-item.item-is-header .moit-item-icon {
    color: #2E7D32;
    font-size: 13px;
    width: 16px;
}

/* Label */
.moit-item-label {
    font-weight: 700;
    color: #2558A8;
    margin-right: 5px;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 28px;
}

/* Text */
.moit-item-text {
    flex: 1;
    color: #333;
    min-width: 0;
    font-size: 13.5px;
}

/* File links area */
.moit-item-files {
    width: 100%;
    margin-left: 23px;
    margin-top: 5px;
    margin-bottom: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ============================================================
   File link button
   ============================================================ */
.moit-file-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f4f7fd;
    color: #2558A8;
    border: 1px solid #b8cae4;
    border-radius: 3px;
    padding: 4px 12px 4px 10px;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(27,58,107,0.07);
}
.moit-file-link:hover,
.moit-file-link:focus {
    background: #2558A8;
    color: #fff;
    border-color: #1f4d9a;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(27,58,107,0.2);
    transform: translateY(-1px);
}
.moit-file-link:hover .fa,
.moit-file-link:focus .fa {
    color: #ffd96a;
}
.moit-file-link .fa {
    color: #d0392b;
    font-size: 13px;
    flex-shrink: 0;
    transition: color 0.18s;
}

/* ============================================================
   Image file display
   ============================================================ */
.moit-file-image-link {
    display: inline-block;
    border: 2px solid #b8cae4;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
    line-height: 0;
}
.moit-file-image-link:hover {
    border-color: #2558A8;
    box-shadow: 0 4px 14px rgba(37,88,168,0.25);
    transform: translateY(-2px);
}
.moit-file-image {
    max-width: 220px;
    max-height: 180px;
    width: auto;
    height: auto;
    display: block;
}
@media (max-width: 600px) {
    .moit-file-image { max-width: 160px; max-height: 130px; }
}

/* ============================================================
   No data
   ============================================================ */
.moit-no-data {
    text-align: center;
    padding: 48px 20px;
    color: #aaa;
    font-size: 15px;
}
.moit-no-data i {
    display: block;
    font-size: 40px;
    margin-bottom: 14px;
    opacity: 0.35;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 767px) {
    .moit-section-title { padding: 28px 16px 24px; }
    .moit-section-title h1 { font-size: 17px; }
    .moit-section-title h2 { font-size: 12px; }
    .moit-year-badge { font-size: 13px; padding: 5px 20px; }
    .moit-category-header { font-size: 13px; padding: 9px 12px; }
    .moit-accordion-toggle { font-size: 13px; padding: 10px 40px 10px 12px; }
    .moit-panel-body { padding: 12px 12px 14px; font-size: 13px; }
    .moit-item.indent-1 { margin-left: 12px; }
    .moit-item.indent-2 { margin-left: 24px; }
    .moit-file-link { font-size: 12px; padding: 3px 10px 3px 8px; }
}
@media (max-width: 480px) {
    .moit-item-files { flex-direction: column; gap: 4px; }
    .moit-section-title h1 { font-size: 15px; }
    .moit-col-wrap { padding: 0 6px; }
}
