/* MBU QA Curriculum — สไตล์การ์ดรายการ + หน้ารายละเอียดหลักสูตร */
/* Prefix .mbu-qa- ทุกคลาส เพื่อไม่ชนกับธีม WordPress ของหน่วยงานที่นำไปใช้ */

.mbu-qa-curriculum-wrap {
    max-width: 1100px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.6;
}

.mbu-qa-univ-title {
    margin-bottom: 1.25rem;
    color: var(--mbu-qa-heading-color, inherit);
}

/* ── กลุ่มระดับ super key: หน่วยงาน -> ระดับการศึกษา -> หลักสูตร (accordion) ── */
.mbu-qa-univ-group {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 3px double #ddd;
}

.mbu-qa-univ-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

summary.mbu-qa-univ-title {
    cursor: pointer;
    margin-bottom: 0;
    padding: .25rem 0;
    list-style-position: outside;
}

summary.mbu-qa-univ-title::-webkit-details-marker {
    color: var(--mbu-qa-sub-color, #999);
}

summary.mbu-qa-univ-title:hover {
    opacity: .8;
}

.mbu-qa-univ-group[open] > summary.mbu-qa-univ-title {
    margin-bottom: .75rem;
}

.mbu-qa-univ-body {
    padding-top: .25rem;
}

/* ── กลุ่มตามคณะ/หน่วยงาน (เมื่อมีมากกว่า 1 หน่วยงาน) ── */
.mbu-qa-fac-group {
    margin-bottom: 2rem;
}

.mbu-qa-fac-title {
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid #eee;
    color: var(--mbu-qa-heading-color, inherit);
}

.mbu-qa-fac-count {
    font-weight: 400;
    color: var(--mbu-qa-sub-color, #888);
    font-size: .85em;
}

/* ── รูปแบบการแสดงรายการ: grid / list / container ── */
.mbu-qa-items--grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.mbu-qa-items--list {
    display: flex;
    flex-direction: column;
}

.mbu-qa-container-box {
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.mbu-qa-items--container {
    display: flex;
    flex-direction: column;
}

/* แถวแบบย่อ ใช้กับ list และ container */
.mbu-qa-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .75rem 1rem;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid #eee;
}

.mbu-qa-items--list > .mbu-qa-row:first-child,
.mbu-qa-items--container > .mbu-qa-container-box > .mbu-qa-row:first-child {
    padding-top: 0;
}

.mbu-qa-items--list > .mbu-qa-row:last-child,
.mbu-qa-items--container > .mbu-qa-container-box > .mbu-qa-row:last-child {
    border-bottom: none;
}

.mbu-qa-items--container .mbu-qa-row {
    padding: .85rem 1.1rem;
}

.mbu-qa-row:hover,
.mbu-qa-row:focus {
    background: #f7f7f7;
    color: inherit;
}

.mbu-qa-row-main {
    display: flex;
    align-items: center;
    gap: .6rem;
    min-width: 0;
}

.mbu-qa-row-title {
    font-weight: 600;
    color: var(--mbu-qa-heading-color, inherit);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mbu-qa-row-meta {
    color: var(--mbu-qa-sub-color, #777);
    font-size: .85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.mbu-qa-card {
    display: block;
    border: 1px solid #dcdcdc;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    background: #fff;
    transition: box-shadow .15s ease, transform .15s ease;
}

.mbu-qa-card:hover,
.mbu-qa-card:focus {
    box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
    transform: translateY(-2px);
    color: inherit;
}

.mbu-qa-card-body {
    padding: 1.1rem 1.25rem;
}

.mbu-qa-badge {
    display: inline-block;
    font-size: .75rem;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: #e8f4ea;
    color: #2e7d32;
    margin-bottom: .5rem;
}

.mbu-qa-card-title {
    margin: 0 0 .25rem;
    font-size: 1.05rem;
    line-height: 1.4;
    color: var(--mbu-qa-heading-color, inherit);
}

.mbu-qa-card-sub {
    margin: 0 0 .75rem;
    color: var(--mbu-qa-sub-color, #666);
    font-size: .9rem;
}

.mbu-qa-card-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .15rem .5rem;
    font-size: .85rem;
    margin: 0;
}

.mbu-qa-card-meta dt {
    color: var(--mbu-qa-sub-color, #888);
    font-weight: 400;
}

.mbu-qa-card-meta dd {
    margin: 0;
    font-weight: 600;
}

/* ── หน้ารายละเอียด ── */
.mbu-qa-back-link {
    margin-bottom: 1rem;
}

.mbu-qa-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.mbu-qa-detail-header h2 {
    color: var(--mbu-qa-heading-color, inherit);
}

.mbu-qa-curr-name-en {
    color: var(--mbu-qa-sub-color, #666);
    margin: .25rem 0;
}

.mbu-qa-detail-sub {
    color: var(--mbu-qa-sub-color, #666);
    margin: .25rem 0 .75rem;
}

.mbu-qa-source-link,
.mbu-qa-source-link-footer a {
    display: inline-block;
    font-weight: 600;
    text-decoration: none;
}

.mbu-qa-source-link-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.mbu-qa-btn {
    display: inline-block;
    padding: .5rem 1rem;
    border-radius: 6px;
    background: #1565c0;
    color: #fff !important;
    text-decoration: none;
    font-size: .9rem;
}

.mbu-qa-section {
    margin: 1.75rem 0;
}

.mbu-qa-section h3 {
    margin-bottom: .75rem;
}

.mbu-qa-def-list {
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr;
    gap: .4rem 1rem;
    margin: 0;
}

.mbu-qa-def-list dt {
    color: var(--mbu-qa-sub-color, #666);
    font-weight: 400;
}

.mbu-qa-def-list dd {
    margin: 0;
    font-weight: 600;
}

/* ── บุคลากร ── */
.mbu-qa-people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    text-align: center;
}

.mbu-qa-person img,
.mbu-qa-person-placeholder {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto .5rem;
}

.mbu-qa-person-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ccc;
    font-size: 1.75rem;
}

.mbu-qa-person-name {
    font-size: .85rem;
    font-weight: 600;
}

.mbu-qa-person-position {
    font-size: .75rem;
    color: var(--mbu-qa-sub-color, #777);
}

/* ── PLO ── */
.mbu-qa-plo-list,
.mbu-qa-plo-sublist {
    padding-left: 1.25rem;
}

.mbu-qa-plo-sublist {
    margin-top: .35rem;
}

/* ── โครงสร้างหลักสูตร ── */
.mbu-qa-structure-tree {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.mbu-qa-structure-tree .mbu-qa-structure-tree {
    padding-left: 1.5rem;
}

.mbu-qa-structure-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .35rem 0;
    border-bottom: 1px dashed #eee;
}

.mbu-qa-structure-credit {
    white-space: nowrap;
    font-weight: 600;
}

.mbu-qa-structure-row--toggleable {
    cursor: pointer;
}

.mbu-qa-structure-row--toggleable .mbu-qa-structure-desc::before {
    content: '▾ ';
    display: inline-block;
}

.mbu-qa-structure-row--collapsed .mbu-qa-structure-desc::before {
    content: '▸ ';
}

.mbu-qa-muted {
    color: #999;
    font-weight: 400;
}

/* ── รายการทั่วไป / ประวัติ ── */
.mbu-qa-simple-list {
    padding-left: 1.25rem;
}

.mbu-qa-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mbu-qa-history-list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid #eee;
}

.mbu-qa-history-meta {
    color: var(--mbu-qa-sub-color, #777);
    font-size: .85rem;
    white-space: nowrap;
}

/* ── ตาราง PLO-CLO ── */
.mbu-qa-table-wrap {
    overflow-x: auto;
}

.mbu-qa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.mbu-qa-table th,
.mbu-qa-table td {
    border: 1px solid #e0e0e0;
    padding: .5rem .6rem;
    text-align: left;
    vertical-align: top;
}

.mbu-qa-table th {
    background: #f5f5f5;
}

/* ── สถานะพิเศษ ── */
.mbu-qa-empty,
.mbu-qa-error {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    background: #fdecea;
    color: #b71c1c;
}

.mbu-qa-empty {
    background: #f5f5f5;
    color: #666;
}
