/* ==========================================================
   assets/css/style.css 
   CMAT Modern Website (Merged & Cleaned)
   ========================================================== */

:root {
    /* โทนสีหลักของ CMAT */
    --primary-blue: #0A3D73;    
    --primary-hover: #072b52;
    --accent-gold: #E5A822;     
    --accent-hover: #c9931b;
    --cmat-primary: #0A3D73; 
    --cmat-accent: #E5A822;
    
    /* สีพื้นหลังและข้อความ */
    --light-gray: #F4F7F6;
    --dark-text: #2C3E50;
    --muted-text: #6c757d;
    
    /* เอฟเฟกต์ */
    --soft-shadow: 0 5px 15px rgba(0,0,0,0.05);
    --hover-shadow: 0 15px 35px rgba(10, 61, 115, 0.1);
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body { 
    font-family: 'Prompt', sans-serif; 
    color: var(--dark-text); 
    background-color: #ffffff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================
   1. Navigation & Brand (Header Styles)
   ========================================================== */
.navbar-custom {
    background-color: var(--cmat-primary) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1050;
}
.nav-logo-custom {
    width: auto;
    object-fit: contain;
    transition: transform 0.3s;
}
.navbar-brand:hover .nav-logo-custom { transform: scale(1.05); }

.site-title-text {
    line-height: 1.1;
    font-weight: 700;
}
.site-desc-text {
    margin-top: 0 !important;
    white-space: pre-line;
    line-height: 1.1;
}

.navbar-custom .nav-link {
    font-weight: 600;
    transition: color 0.3s;
}
.navbar-custom .nav-link:hover, .navbar-custom .nav-link.active {
    color: var(--cmat-accent) !important;
}

/* ควบคุม Dropdown แบบ Hover สำหรับหน้าจอคอมพิวเตอร์ */
@media (min-width: 992px) {
    .navbar .dropdown:hover .dropdown-menu { display: block; margin-top: 0; }
    .navbar .dropdown .dropdown-menu { display: none; }
}

.dropdown-menu {
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    border-radius: 12px;
    padding: 10px 0;
}

.dropdown-item {
    font-weight: 400;
    padding: 12px 25px;
    transition: all 0.3s ease;
    position: relative;
    background-color: transparent !important;
    color: #444;
}
.dropdown-item:hover {
    background-color: transparent !important;
    color: var(--cmat-primary) !important;
    transform: scale(1.02) translateX(5px);
}
.dropdown-item::after {
    content: ''; position: absolute; bottom: 8px; left: 25px; width: 0; height: 2px;
    background-color: var(--cmat-accent); transition: width 0.3s ease;
}
.dropdown-item:hover::after { width: 50px; }

/* 🔴 ปรับจูนพิเศษสำหรับมือถือ (โลโก้ซ้าย + ข้อความข้างๆ) */
@media (max-width: 991.98px) {
    .navbar-brand {
        display: flex !important;
        align-items: center;
        max-width: 80%;
        position: static !important;
        transform: none !important;
        left: auto !important;
    }
    
    .nav-logo-custom {
        height: 42px !important;
        margin-right: 10px !important;
    }

    .site-title-text {
        font-size: 13px !important;
        margin-bottom: 0px !important;
    }

    .site-desc-text {
        font-size: 9px !important;
        line-height: 1 !important;
        opacity: 0.9;
    }

    .navbar-toggler {
        position: absolute;
        right: 12px;
        padding: 6px 10px;
    }

    .offcanvas { max-width: 280px; }
    .offcanvas-body { padding: 10px 15px; }
    .navbar-custom .offcanvas-body .nav-link {
        color: var(--cmat-primary) !important;
        border-bottom: 1px dashed #eee;
        padding: 12px 5px !important;
    }
}

/* ==========================================================
   2. Banner / Carousel
   ========================================================== */
.carousel-item img {
    height: 550px;
    object-fit: cover;
}

.hero-banner-img {
    min-height: 300px; 
    object-fit: cover; 
    width: 100%;
}

.dynamic-caption-card {
    position: absolute;
    border-radius: 12px;
    padding: 1.5rem 2rem;
    max-width: 800px;
    width: 90%;
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
    z-index: 10;
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
}

.caption-icon-wrap {
    background-color: var(--cmat-primary, #0A3D73);
    color: #ffffff;
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    flex-shrink: 0;
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1);
}

.caption-text-wrap {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 768px) {
    .dynamic-caption-card {
        flex-direction: column;
        align-items: center;
        text-align: center !important;
        padding: 1.25rem;
        gap: 1rem;
    }
    .caption-icon-wrap {
        width: 60px; height: 60px; font-size: 2rem; border-radius: 12px;
    }
    .caption-text-wrap h2 { font-size: 1.5rem !important; text-align: center !important; }
    .caption-text-wrap p { font-size: 1rem !important; text-align: center !important; }
}

/* ==========================================================
   3. Quick Links (เมนูทางลัด)
   ========================================================== */
.quick-links-section { 
    background-color: var(--primary-blue); 
    padding: 30px 0; 
}

.icon-box { 
    text-align: center; 
    padding: 20px 15px; 
    border-radius: 12px; 
    background: #ffffff; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    text-decoration: none; 
    display: block; 
    color: var(--primary-blue); 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    height: 100%;
}

.icon-box:hover { 
    transform: translateY(-8px); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.25); 
}

.icon-box i { 
    font-size: 2.5rem; 
    color: var(--accent-gold); 
    margin-bottom: 8px; 
    display: block; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

.icon-box:hover i { 
    transform: scale(1.25) translateY(-3px); 
    color: var(--primary-hover); 
}

/* ==========================================================
   4. Section Backgrounds (สลับสีพื้นหลัง)
   ========================================================== */
.section-light { background-color: #ffffff; padding: 15px 0 30px; }
.section-dark { background-color: #f4f7f6; padding: 15px 0 30px; border-top: 1px solid #eaeaea; border-bottom: 1px solid #eaeaea; }

/* ==========================================================
   5. News List (ดีไซน์รายการข่าวทั่วไป)
   ========================================================== */
.signal-list-container { 
    border: 1px solid #eaeaea; background: #fff; border-radius: 8px; 
}
.signal-list-header {
    background-color: var(--primary-blue);
    color: white; padding: 12px 20px; font-weight: bold; display: flex; justify-content: space-between; align-items: center;
    border-radius: 8px 8px 0 0;
}
.signal-list-item {
    display: flex; align-items: flex-start;
    padding: 10px 15px;  
    border-bottom: 1px solid #f0f0f0; text-decoration: none; color: #333; 
    transition: var(--transition);
    position: relative;
    background-color: #fff;
    border-left: 4px solid transparent; 
}
.signal-list-item:last-child { 
    border-bottom: none; 
    border-radius: 0 0 8px 8px; 
}
.signal-list-item:hover { 
    background-color: #ffffff; 
    transform: scale(1.01) translateX(3px); 
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); 
    border-left: 4px solid var(--accent-gold); 
    border-radius: 8px; 
    z-index: 10; 
    border-bottom-color: transparent; 
}

.signal-list-date-box { 
    flex-shrink: 0; 
    width: 65px; 
    background-color: #f4f7f6; border: 1px solid #eaeaea; border-radius: 8px; 
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; 
    padding: 8px 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
    transition: all 0.3s ease; 
}
.date-day { 
    width: 100%; text-align: center; 
    font-size: 1.2rem; font-weight: 800; line-height: 1; color: var(--primary-blue); 
    margin-bottom: 3px; 
} 
.date-month { 
    font-size: 0.7rem; font-weight: 600; color: #555; 
    margin-right: 3px; 
}
.date-year { 
    font-size: 0.7rem; color: #888; 
}

.signal-list-item:hover .signal-list-date-box { background-color: var(--primary-blue); border-color: var(--primary-blue); }
.signal-list-item:hover .date-day, 
.signal-list-item:hover .date-month, 
.signal-list-item:hover .date-year { color: #fff; }

.signal-list-title { 
    flex-grow: 1; margin-left: 15px; display: flex; flex-direction: column; justify-content: center; width: 100%;
}
.signal-list-title-text { 
    font-size: 0.95rem; line-height: 1.4; 
    display: -webkit-box; -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; overflow: hidden;
    transition: color 0.3s ease; 
}

/* ==========================================================
   6. News Card (ดีไซน์ข่าวแบบกล่องการ์ด)
   ========================================================== */
.signal-card { 
    border: 1px solid #eaeaea; border-radius: 8px; overflow: hidden; background: #fff; 
    height: 100%; display: flex; flex-direction: column; transition: 0.3s box-shadow, transform 0.3s; 
}
.signal-card:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.1); transform: translateY(-5px); }
.signal-card-img-wrap { position: relative; padding-top: 56.25%; overflow: hidden; }
.signal-card-img-wrap img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }
.signal-card:hover .signal-card-img-wrap img { transform: scale(1.05); }
.signal-card-body { padding: 15px; display: flex; flex-direction: column; flex-grow: 1; }
.signal-card-title { font-size: 0.95rem; font-weight: 600; color: #333; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.signal-btn-read {
    background-color: var(--primary-blue); color: white; font-size: 0.7rem; padding: 4px 12px; border-radius: 20px; text-decoration: none; transition: 0.2s;
}
.signal-btn-read:hover { background-color: var(--accent-gold); color: white; }

.badge-new { background-color: #dc3545; color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; animation: blinker 1.5s linear infinite; white-space: nowrap; vertical-align: middle; }
@keyframes blinker { 50% { opacity: 0.5; } }

/* ==========================================================
   7. Journals (จุลสาร / E-Book)
   ========================================================== */
.journal-card { border: none; background: transparent; perspective: 1000px; height: 100%; }
.journal-book-cover {
    position: relative; padding-top: 141%; border-radius: 3px 12px 12px 3px;
    box-shadow: inset 4px 0 10px rgba(0,0,0,0.1), 5px 5px 15px rgba(0,0,0,0.15);
    transition: all 0.4s ease; overflow: hidden; background: #eee; display: block;
}
.journal-book-cover::before {
    content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 12px;
    background: linear-gradient(to right, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.0) 100%); z-index: 2;
}
.journal-card:hover .journal-book-cover { transform: translateY(-10px) rotateY(-5deg); box-shadow: inset 4px 0 10px rgba(0,0,0,0.1), 10px 15px 25px rgba(0,0,0,0.25); }
.journal-cover-img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; transition: transform 0.5s ease; }
.journal-card:hover .journal-cover-img { transform: scale(1.05); }
.journal-bottom-title {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0) 100%);
    color: #ffffff; padding: 30px 10px 10px; z-index: 4; font-size: 0.85rem; font-weight: 600; text-align: center; text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}
.journal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(10, 61, 115, 0.75); color: white; display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; z-index: 3; transition: all 0.3s ease; padding-bottom: 20px;
}
.journal-card:hover .journal-overlay { opacity: 1; }
.journal-overlay i { font-size: 2rem; transform: translateY(20px); transition: all 0.3s ease; }
.journal-card:hover .journal-overlay i { transform: translateY(0); }

/* ==========================================================
   8. Agencies (หน่วยงานที่เกี่ยวข้อง)
   ========================================================== */
.agency-wrapper { background-color: #ffffff; border-radius: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); padding: 30px 20px; }
.agency-logo-box {
    display: flex; align-items: center; justify-content: center; height: 90px; padding: 15px;
    background: #fdfdfd; border: 1px solid #f0f0f0; border-radius: 12px; transition: all 0.3s ease; text-decoration: none;
}
.agency-logo-box:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(10, 61, 115, 0.15); border-color: rgba(10, 61, 115, 0.3); background: #ffffff; }
.agency-logo-img { max-height: 55px; max-width: 100%; object-fit: contain; filter: grayscale(100%); opacity: 0.7; transition: all 0.3s ease; }
.agency-logo-box:hover .agency-logo-img { filter: grayscale(0%); opacity: 1; transform: scale(1.1); }
.agency-title-line { width: 50px; height: 3px; background-color: var(--accent-gold); margin: 10px auto 0; border-radius: 3px; }

/* ==========================================================
   9. Footer
   ========================================================== */
.cmat-footer { background-color: #555555; color: #e0e0e0; }
.cmat-footer h5 { color: #ffffff; font-weight: 600; position: relative; padding-bottom: 12px; margin-bottom: 25px; font-size: 1.2rem; }
.cmat-footer h5::after { content: ''; position: absolute; left: 0; bottom: 0; width: 35px; height: 3px; background-color: #999999; }
.footer-text { font-size: 0.95rem; line-height: 1.8; color: #cccccc; }
.footer-links { margin: 0; padding: 0; list-style: none; }
.footer-links a { display: block; color: #cccccc; text-decoration: none; padding: 12px 0; border-bottom: 1px solid #666666; transition: var(--transition); font-size: 0.95rem; }
.footer-links a:hover { color: #ffffff; padding-left: 8px; border-bottom-color: #999999; }
.footer-bottom { background-color: #444444; padding: 20px 0; text-align: center; color: #aaaaaa; font-size: 0.85rem; }

/* ==========================================================
   10. Utilities & Responsive
   ========================================================== */
@media (max-width: 768px) {
    .carousel-item img { height: 350px; }
}

/* ==========================================================
   11. ส่วนหัวหน้าย่อย (Page Header)
   ========================================================== */
.page-header-bg { 
    background: linear-gradient(180deg, #031526 0%, #072b52 100%);
    padding: 60px 0 100px; 
    color: white; 
    text-align: center;
    box-shadow: inset 0 8px 20px rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.page-header-bg h1 {
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
}
.breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.4); 
}
.breadcrumb-item a {
    color: rgba(255, 255, 255, 0.7); 
    text-decoration: none;
    transition: 0.3s ease;
}
.breadcrumb-item a:hover {
    color: #ffffff;
}
.breadcrumb-item.active {
    color: var(--cmat-accent, #E5A822); 
    font-weight: 600;
}

/* ==========================================================
   12. หน้าข่าวสารและหมวดหมู่ (Category, News Detail, Search)
   ========================================================== */
.category-content-card, .news-article-card, .contact-card { 
    background: #fff; 
    padding: 40px; 
    border-radius: 12px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.08); 
    margin-top: -60px; 
    position: relative; 
    z-index: 10; 
    margin-bottom: 60px;
    min-height: 400px;
}
.news-article-card { margin-top: -70px; }
.pagination { margin-top: 40px; }
.page-link { color: var(--cmat-primary, #0A3D73); font-weight: 600; padding: 10px 20px; }
.page-item.active .page-link { background-color: var(--cmat-primary, #0A3D73); border-color: var(--cmat-primary, #0A3D73); color: white; }
.page-link:hover { color: var(--cmat-accent, #E5A822); background-color: #f8f9fa; }
.article-meta { font-size: 0.95rem; color: #666; border-bottom: 1px solid #eaeaea; padding-bottom: 20px; margin-bottom: 30px; }
.ck-content { font-size: 1.1rem; line-height: 1.8; color: #333; }
.ck-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 15px 0; }
.ck-content .image-style-align-left { float: left; margin-right: 25px; margin-bottom: 15px; max-width: 50%; }
.ck-content .image-style-align-right { float: right; margin-left: 25px; margin-bottom: 15px; max-width: 50%; }
.ck-content .image-style-align-center { margin: 20px auto; display: table; text-align: center; }
.ck-content::after { content: ""; display: table; clear: both; }
.gallery-item { display: block; overflow: hidden; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.05); transition: 0.3s; }
.gallery-item:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.gallery-item img { width: 100%; height: 200px; object-fit: cover; transition: 0.5s; }
.gallery-item:hover img { transform: scale(1.05); }

/* ==========================================================
   12.1 ลิงก์ในเนื้อหาข่าว (CKEditor Content)
   ========================================================== */
.ck-content a {
    color: #0A3D73 !important; 
    text-decoration: underline !important; 
    font-weight: 600; 
    word-break: break-word; 
    transition: all 0.2s ease;
}
.ck-content a:hover {
    color: #E5A822 !important; 
    text-decoration: none !important;
}

/* ==========================================================
   13. หน้าบุคลากร (Committee & Academic)
   ========================================================== */
.executive-card { text-align: center; margin-bottom: 3rem; }
.executive-img-wrap {
    width: 220px; height: 280px; margin: 0 auto 20px; border-radius: 12px; overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); border: 4px solid #ffffff; position: relative; background-color: #f8f9fa;
}
.president .executive-img-wrap { width: 260px; height: 330px; border-color: var(--cmat-accent, #E5A822); }
.executive-img-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.executive-card:hover .executive-img-wrap img { transform: scale(1.05); }
.executive-name { font-size: 1.25rem; font-weight: bold; color: var(--cmat-primary, #0A3D73); margin-bottom: 5px; }
.president .executive-name { font-size: 1.4rem; }
.executive-position { font-size: 1rem; color: #666; font-weight: 500; }
.president .executive-position { color: var(--cmat-accent, #E5A822); font-weight: bold; }
.committee-table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); padding: 30px; margin-bottom: 3rem; }
.section-title-bar { border-left: 5px solid var(--cmat-accent, #E5A822); padding-left: 15px; margin-bottom: 20px; color: var(--cmat-primary, #0A3D73); font-weight: bold; }
.committee-list { list-style: none; padding: 0; margin: 0; }
.committee-list li { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px dashed #eaeaea; transition: background-color 0.2s; }
.committee-list li:hover { background-color: #f8f9fa; }
.committee-list li:last-child { border-bottom: none; }
.c-name { font-weight: 600; color: #333; font-size: 1.05rem; }
.c-position { color: #666; font-size: 0.95rem; text-align: right; }

/* ==========================================================
   14. หน้าติดต่อเรา (Contact)
   ========================================================== */
.contact-info-item { display: flex; align-items: flex-start; margin-bottom: 25px; padding-bottom: 20px; border-bottom: 1px dashed #eaeaea; }
.contact-info-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.contact-icon { width: 50px; height: 50px; background-color: rgba(10, 61, 115, 0.1); color: var(--cmat-primary, #0A3D73); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; margin-right: 20px; transition: 0.3s; }
.contact-info-item:hover .contact-icon { background-color: var(--cmat-primary, #0A3D73); color: #ffffff; transform: scale(1.1); }
.contact-text h6 { font-weight: 700; color: var(--cmat-primary, #0A3D73); margin-bottom: 5px; }
.contact-text p, .contact-text a { color: #555; font-size: 1.05rem; margin-bottom: 0; text-decoration: none; }
.contact-text a:hover { color: var(--cmat-accent, #E5A822); }
.map-container { border-radius: 12px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); height: 100%; min-height: 400px; border: 2px solid #eaeaea; }
.map-container iframe { width: 100%; height: 100%; border: 0; }

@media (max-width: 768px) {
    .category-content-card, .news-article-card, .contact-card { padding: 25px 15px; }
    .committee-list li { flex-direction: column; align-items: flex-start; }
    .c-position { text-align: left; margin-top: 5px; color: var(--cmat-primary, #0A3D73); }
    .map-container { min-height: 350px; margin-top: 30px; }
}

/* ==========================================================
   15. หน้าประวัติและวัตถุประสงค์ (About)
   ========================================================== */
.history-section {
    background: #fff; padding: 50px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); margin-top: -60px; position: relative; z-index: 10; margin-bottom: 50px;
}
.history-icon-wrapper {
    width: 80px; height: 80px; background: linear-gradient(135deg, var(--cmat-primary, #0A3D73), #1e5a9b); color: white; border-radius: 20px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; margin-bottom: 25px; box-shadow: 0 8px 20px rgba(10, 61, 115, 0.2);
}
.history-text { font-size: 1.1rem; line-height: 1.85; color: #444; text-indent: 40px; }
.history-text strong { color: var(--cmat-primary, #0A3D73); font-size: 1.15rem; }
.section-title { color: var(--cmat-primary, #0A3D73); font-weight: 700; position: relative; padding-bottom: 15px; margin-bottom: 40px; text-transform: uppercase; }
.section-title::after { content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 80px; height: 4px; background-color: var(--cmat-accent, #E5A822); border-radius: 2px; }
.objectives-main-card { background: #fff; border: 1px solid #eaeaea; border-radius: 15px; padding: 40px; box-shadow: 0 5px 15px rgba(0,0,0,0.02); }
.objective-row-item { display: flex; align-items: flex-start; padding: 20px 0; border-bottom: 1px dashed #eee; transition: background-color 0.3s; }
.objective-row-item:last-child { border-bottom: none; padding-bottom: 0; }
.objective-row-item:first-child { padding-top: 0; }
.objective-row-item:hover { background-color: #fcfcfc; }
.obj-number { width: 45px; height: 45px; background-color: rgba(10, 61, 115, 0.08); color: var(--cmat-primary, #0A3D73); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 800; flex-shrink: 0; margin-right: 20px; transition: 0.3s; }
.objective-row-item:hover .obj-number { background-color: var(--cmat-primary, #0A3D73); color: #fff; transform: scale(1.1); }
.obj-text { font-size: 1.05rem; color: #555; line-height: 1.7; margin: 0; padding-top: 5px; }

@media (max-width: 768px) {
    .history-section { padding: 30px 20px; margin-top: -40px; }
    .history-text { text-indent: 20px; font-size: 1rem; }
    .objectives-main-card { padding: 25px 20px; }
    .obj-number { width: 35px; height: 35px; font-size: 1.1rem; margin-right: 15px; }
}

/* ==========================================================
   16. โซนโปรโมทงานสัมมนาและอีเวนต์ (Events Highlight)
   ========================================================== */
.event-highlight-section {
    background: linear-gradient(135deg, #06203a 0%, #0A3D73 100%); padding: 35px 0; color: white; position: relative; overflow: hidden;
}
.event-highlight-section::before {
    content: ''; position: absolute; top: -50px; right: -50px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(229,168,34,0.2) 0%, rgba(255,255,255,0) 70%); border-radius: 50%;
}
.event-card-wrapper {
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(229, 168, 34, 0.3); border-radius: 12px; padding: 15px; backdrop-filter: blur(10px); transition: transform 0.3s, box-shadow 0.3s; height: 100%;
}
.event-card-wrapper:hover {
    transform: translateY(-5px); box-shadow: 0 15px 35px rgba(229, 168, 34, 0.15); border-color: rgba(229, 168, 34, 0.6);
}
.event-poster { width: 100%; border-radius: 8px; box-shadow: 0 10px 20px rgba(0,0,0,0.3); transition: 0.4s; }
.event-card-wrapper:hover .event-poster { transform: scale(1.02); }
.event-title { font-size: 1.05rem; font-weight: 700; color: var(--cmat-accent, #E5A822); margin-top: 15px; line-height: 1.4; }
.event-desc { font-size: 0.85rem; color: #e0e0e0; margin-top: 5px; margin-bottom: 0; }
.btn-register-event {
    background: linear-gradient(90deg, #E5A822 0%, #ffc107 100%); color: #000 !important; font-weight: 700; border: none; border-radius: 30px; padding: 6px 20px; font-size: 0.85rem; display: inline-block; margin-top: 12px; text-decoration: none; box-shadow: 0 5px 15px rgba(229, 168, 34, 0.4); transition: 0.3s;
}
.btn-register-event:hover { transform: scale(1.05); box-shadow: 0 8px 25px rgba(229, 168, 34, 0.6); }

/* สไตล์แถบคาดมุม (Ribbon) สำหรับโปสเตอร์งานสัมมนา */
.event-poster-link {
    position: relative;
    display: block;
    overflow: hidden; 
    border-radius: 8px; 
}
.event-ribbon {
    position: absolute;
    top: 20px;
    right: -35px;
    width: 140px;
    transform: rotate(45deg);
    background: linear-gradient(90deg, #ff3b3b 0%, #ff8b7e 100%);
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 800;
    padding: 5px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 10;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

/* ==========================================================
   17. Custom Buttons (ปุ่มพิเศษ)
   ========================================================== */
.btn-outline-white-custom {
    color: rgba(255, 255, 255, 0.9); border: 2px solid rgba(255, 255, 255, 0.6); transition: all 0.3s ease;
}
.btn-outline-white-custom:hover {
    background-color: #ffffff; color: #0A3D73 !important; border-color: #ffffff; transform: translateY(-2px);
}
.btn-outline-gold {
    color: var(--cmat-accent, #E5A822); border: 2px solid var(--cmat-accent, #E5A822); transition: all 0.3s ease;
}
.btn-outline-gold:hover {
    background-color: var(--cmat-accent, #E5A822); color: #0A3D73 !important; border-color: var(--cmat-accent, #E5A822); transform: translateY(-2px);
}

/* ==========================================================
   18. Mini E-Book (จุลสารหน้าแรก และ หน้ารวมจุลสาร)
   ========================================================== */
.library-container { padding: 40px 0; background-color: #fcfcfc; }
.book-card-mini {
    background: #fff; border-radius: 3px 8px 8px 3px; box-shadow: 2px 4px 8px rgba(0,0,0,0.1); transition: all 0.3s ease; position: relative; overflow: hidden; border: 1px solid #f1f1f1; border-left: none; display: block; margin: 0 auto;
}
.book-card-mini:hover { transform: translateY(-6px); box-shadow: 4px 10px 18px rgba(0,0,0,0.15); }
.book-spine-mini {
    position: absolute; top: 0; left: 0; bottom: 0; width: 10px; background: linear-gradient(to right, rgba(255,255,255,0.6) 0%, rgba(0,0,0,0.1) 3px, rgba(255,255,255,0.2) 5px, transparent 100%); z-index: 10; border-radius: 3px 0 0 3px; pointer-events: none; 
}
.book-cover-wrap-mini {
    position: relative; width: 100%; aspect-ratio: 1 / 1.414; background-color: #e9ecef; overflow: hidden;
}
.book-cover-img-mini { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.book-card-mini:hover .book-cover-img-mini { transform: scale(1.05); }

.book-overlay-mini {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(10, 61, 115, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: all 0.3s ease; z-index: 15;
}
.book-card-mini:hover .book-overlay-mini { opacity: 1; }
.btn-read-mini {
    background-color: var(--cmat-accent, #E5A822); color: #0A3D73; font-weight: bold; font-size: 0.8rem; padding: 5px 15px; border-radius: 50px; transform: translateY(10px); transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
.book-card-mini:hover .btn-read-mini { transform: translateY(0); }

.badge-new-journal {
    position: absolute; top: 6px; left: -22px; background: #dc3545; color: white; padding: 2px 25px; font-size: 0.6rem; font-weight: bold; transform: rotate(-45deg); z-index: 20; box-shadow: 0 2px 4px rgba(0,0,0,0.2); text-transform: uppercase; letter-spacing: 1px;
}

/* ==========================================================
   19. Live Search Box (กล่องค้นหาแบบ Real-time)
   ========================================================== */
.search-wrapper { position: relative; }
.search-wrapper input { border-radius: 8px; background-color: #f8f9fa; border: 1px solid #e9ecef; }
.search-wrapper input:focus { background-color: #fff; box-shadow: 0 0 0 0.25rem rgba(10, 61, 115, 0.1); border-color: #0A3D73; }
.btn-clear-search { 
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: #e9ecef; border: none; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; color: #6c757d; cursor: pointer; transition: 0.2s; z-index: 10; font-size: 0.85rem;
}
.btn-clear-search:hover { background: #dc3545; color: #fff; }

/* ==========================================================
   20. News Row V2 (รายการข่าวแนวนอน หน้า Category)
   ========================================================== */
.news-row-v2 { 
    display: flex; gap: 20px; padding: 15px; transition: all 0.3s ease; border-bottom: 1px solid #f1f3f5; text-decoration: none; color: inherit; align-items: center;
}
.news-row-v2:last-child { border-bottom: none; }
.news-row-v2:hover { background-color: #f8f9fa; border-radius: 12px; transform: translateX(8px); box-shadow: -4px 0 0 var(--cmat-accent, #E5A822); }
.news-cover-v2 { 
    width: 100px; height: 70px; flex-shrink: 0; border-radius: 6px; overflow: hidden; position: relative; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.news-cover-v2 img { width: 100%; height: 100%; object-fit: cover; transition: 0.3s; }
.news-row-v2:hover .news-cover-v2 img { transform: scale(1.05); }
.news-body-v2 { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; }
.news-title-v2 { font-size: 1.05rem; font-weight: 600; color: #0A3D73; margin-bottom: 4px; line-height: 1.4; transition: 0.2s; }
.news-row-v2:hover .news-title-v2 { color: var(--cmat-accent, #E5A822); }
.news-meta-v2 { display: flex; flex-wrap: wrap; gap: 15px; font-size: 0.8rem; color: #6c757d; margin-bottom: 6px; }
.news-desc-v2 { font-size: 0.85rem; color: #555; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
.news-list-wrapper { padding-bottom: 10px; }
@media (max-width: 576px) {
    .news-row-v2 { gap: 12px; padding: 12px 10px; align-items: flex-start; }
    .news-cover-v2 { width: 85px; height: 60px; }
    .news-title-v2 { font-size: 0.95rem; }
}

/* ==========================================================
   21. Downloads Row V2 (รายการเอกสารหน้า Downloads)
   ========================================================== */
.doc-icon-v2 { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; border-radius: 8px; background: #f8f9fa; }
.icon-public { color: #198754; background: #e8f5e9; }
.icon-password { color: #fd7e14; background: #fff3e0; }
.doc-row-v2 { transition: all 0.2s ease; border-bottom: 1px solid #f1f3f5; }
.doc-row-v2:last-child { border-bottom: none !important; }
.doc-row-v2:hover { background-color: #f8f9fa; border-radius: 8px; transform: translateX(5px); }
.doc-list-wrapper { padding-bottom: 10px; }

/* ==========================================================
   22. Cookie Banner & Footer Additions
   ========================================================== */
.social-circle:hover { 
    background-color: rgba(255,255,255,0.15); 
    transform: translateY(-3px); 
}

.cookie-banner {
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    background-color: #ffffff;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.08); 
    padding: 20px 0; 
    z-index: 9999;
    font-family: 'Prompt', sans-serif;
    border-top: 4px solid var(--cmat-primary, #0A3D73);
    transform: translateY(100%); 
    transition: transform 0.5s ease-in-out;
}
.cookie-banner.show { 
    transform: translateY(0); 
}
.cookie-btn-outline { 
    border: 1px solid #888; 
    color: #555; 
    background: transparent; 
    transition: 0.3s; 
}
.cookie-btn-outline:hover { 
    background: #f0f0f0; 
    color: #333; 
}
.cookie-btn-accept { 
    background-color: #A08C73; 
    color: #fff; 
    border: 1px solid #A08C73; 
    transition: 0.3s; 
}
.cookie-btn-accept:hover { 
    background-color: #8c7960; 
    color: #fff; 
}

/* ==========================================================
   23. Rules & Regulations (หน้าข้อบังคับสมาคม) - อัปเดตเลย์เอาต์ใหม่แบบรวมแผ่น
   ========================================================== */
/* 🔴 1. สร้างกล่องหลักให้คลุมทุกหมวด */
.rules-container-main {
    background: #fff;
    border-radius: 12px;
    padding: 40px 50px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid #eaeaea;
}

/* 🔴 2. เลิกใช้กล่องแยก ให้เป็นเพียงระยะห่างระหว่างหมวด */
.rules-card {
    background: transparent;
    border-radius: 0;
    padding: 0 0 35px 0;
    box-shadow: none;
    margin-bottom: 35px;
    border: none;
    border-bottom: 2px dashed #eaeaea; /* เพิ่มเส้นประคั่นระหว่างหมวด */
}
/* หมวดสุดท้ายไม่ต้องมีเส้นคั่นใต้ล่าง */
.rules-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.rules-chapter-header {
    text-align: center;
    margin-bottom: 25px;
}
.rules-chapter-badge {
    background: #E5A822; /* สีทอง CMAT */
    color: #000;
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 12px;
}
.rules-chapter-name {
    color: #0A3D73;
    font-size: 22px;
    font-weight: 700;
    margin: 0;
}

.rules-list {
    list-style-type: none;
    padding-left: 0;
    margin-bottom: 0;
}
.rules-list li {
    margin-bottom: 15px;
    color: #444;
    line-height: 1.8;
    font-size: 15.5px;
}
.rule-item-text {
    text-indent: 40px; 
    text-align: left; /* 🔴 แก้ตรงนี้เป็น left ครับ */
}
.rules-highlight {
    font-weight: 700;
    color: #0A3D73;
    margin-right: 5px;
}

.rule-sub-item {
    padding-left: 30px; 
    margin-top: 10px;
}
.rule-sub-item .fw-bold {
    color: #0A3D73;
    margin-right: 5px;
}

@media (max-width: 768px) {
    .rules-container-main { padding: 25px 20px; }
}