/* style.css */

body {
    font-family: 'Sarabun', sans-serif;
    line-height: 1.6;
}

.header-bg {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 20px 0;
}

.navbar-custom {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar-nav {
    position: relative;
}

.navbar-nav .nav-item {
    position: relative;
}

.navbar-nav .nav-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 25px;
    width: 1px;
    background-color: #dee2e6;
}

.navbar-nav .nav-link {
    color: #333 !important;
    font-weight: 500;
    padding: 15px 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.navbar-nav .nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #1e3c72, #2a5298);
    transition: width 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #2a5298 !important;
}

.navbar-nav .nav-link:hover::before {
    width: 100%;
}

.navbar-nav .nav-link.active::before {
    width: 100%;
}

.carousel-item img {
    height: 400px;
    object-fit: cover;
}

.organization-logo {
    background: #f8f9fa;
    padding: 40px 0;
}

.logo-item {
    text-align: center;
    padding: 20px;
    margin: 10px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.logo-item:hover {
    transform: translateY(-5px);
}

.logo-item img {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}

.news-section {
    padding: 60px 0;
}

.news-card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    height: 100%;
}

.news-card:hover {
    transform: translateY(-5px);
}

.news-card img {
    height: 200px;
    object-fit: cover;
}

.news-card-small img {
    height: 120px;
    object-fit: cover;
}

.footer-bg {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 40px 0 20px 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e3c72;
    margin-bottom: 40px;
    text-align: center;
}

.btn-custom {
    position: relative;
    overflow: hidden;
    z-index: 1;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    border: none;
    color: white;
    padding: 10px 25px;
    border-radius: 25px;
    transition: all 0.3s ease, color 0.4s ease-in-out;
}

.btn-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: #ffc107;
    z-index: -1;
    transition: width 0.4s ease-in-out;
}

.btn-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    color: #212529;
}

.btn-custom:hover::before {
    width: 100%;
    transform: skewX(-45deg);
    transition: left 0.4s ease-in-out;
}

/* Styles for Gallery Section */
.gallery-section {
    padding: 60px 0; /* Consistent padding with other sections */
    background-color: #f8f9fa; /* Light background to distinguish from news */
    border-top: 1px solid #eee; /* Optional: separator line */
}
.gallery-card {
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease-in-out;
    margin-bottom: 30px;
    overflow: hidden;
    border-radius: 10px;
    height: 100%; /* Ensure cards in a row have same height */
    display: flex;
    flex-direction: column;
}
.gallery-card:hover {
    transform: translateY(-5px);
}
.gallery-card img {
    width: 100%;
    height: 200px; /* Fixed height for gallery cover/first image */
    object-fit: cover;
    border-radius: 10px 10px 0 0;
}
.gallery-card .card-body {
    padding: 20px;
    flex-grow: 1; /* Allow body to take remaining space */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.gallery-card .card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2a5298;
    margin-bottom: 10px;
}
.gallery-card .card-text {
    color: #666;
    font-size: 0.95rem;
    height: 70px; /* Limit description height */
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 15px; /* Space before button */
}
.btn-view-gallery {
    background-color: #0dcaf0; /* Info blue */
    border-color: #0dcaf0;
    color: #fff;
    transition: background-color 0.3s;
    align-self: flex-start; /* Align button to start within flex column */
}
.btn-view-gallery:hover {
    background-color: #0aa2c2;
    border-color: #0aa2c2;
    color: #fff;
}
/*---------------------------------------*/
/* เพิ่มเติมใน style.css ของคุณ หรือปรับค่าที่มีอยู่ */

/* การจัดสไตล์หัวข้อส่วนต่างๆ */
.section-title {
    font-weight: 600;
    color: #333; /* สีเข้มสำหรับหัวข้อ */
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 80px;
    height: 3px;
    background-color: #007bff; /* ปรับเป็นสีหลักของเว็บคุณ */
    border-radius: 5px;
}

/* ปรับหัวข้อให้อยู่ชิดซ้ายเมื่ออยู่ในคอลัมน์ */
.col-lg-6 .section-title,
.col-lg-4 .section-title {
    text-align: left;
    margin-left: 0;
    margin-right: 0;
}

.col-lg-6 .section-title::after,
.col-lg-4 .section-title::after {
    left: 0;
    transform: translateX(0);
}


/* การจัดสไตล์รายการข่าวประกาศในหน้าแรก (ส่วนหน้าซ้าย) */
.announcement-list .list-group-item {
    border: 1px solid #e9ecef;
    margin-bottom: 10px;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
    background-color: #fff;
}

.announcement-list .list-group-item:hover {
    background-color: #f8f9fa;
    border-color: #007bff; /* สีโฮเวอร์ */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.announcement-list .announcement-title {
    font-size: 1.1rem;
    color: #333;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 85%; /* ป้องกันชื่อยาวเกินไป */
}

.announcement-list .announcement-content {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #666;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* แสดง 2 บรรทัด */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* การปรับขนาดการ์ดแกลเลอรีให้เล็กลงและจัด 4x2 */
.gallery-section .card-img-top {
    height: 120px; /* กำหนดความสูงภาพปกที่เล็กลง */
    object-fit: cover; /* ทำให้ภาพเต็มพื้นที่โดยไม่ผิดสัดส่วน */
    border-top-left-radius: calc(0.25rem - 1px);
    border-top-right-radius: calc(0.25rem - 1px);
}

.gallery-section .gallery-card .card-body {
    padding: 0.75rem; /* ลด padding */
}

.gallery-section .gallery-card .card-title {
    font-size: 0.9rem; /* ลดขนาดฟอนต์หัวข้อ */
    margin-bottom: 0.25rem;
    font-weight: 600;
    white-space: nowrap; /* ป้องกันการขึ้นบรรทัดใหม่ */
    overflow: hidden; /* ซ่อนส่วนเกิน */
    text-overflow: ellipsis; /* เพิ่มจุดสามจุดถ้าข้อความยาวเกิน */
}

.gallery-section .gallery-card .card-text {
    font-size: 0.75rem; /* ลดขนาดฟอนต์เนื้อหา */
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* แสดง 2 บรรทัด */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-section .btn-view-gallery {
    font-size: 0.75rem; /* ลดขนาดฟอนต์ปุ่ม */
    padding: 0.3rem 0.6rem;
}

/* ตรวจสอบให้แน่ใจว่าการ์ดแกลเลอรีมีความสูงเท่ากัน */
.gallery-section .col .gallery-card {
    display: flex;
    flex-direction: column;
}

.gallery-section .col .gallery-card .card-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Pagination Styles (ทั่วไป) */
.pagination-container {
    margin-top: 20px;
    margin-bottom: 20px;
}

.pagination .page-link {
    color: #007bff;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
}

/* Responsive adjustments for Gallery layout */
/* For smaller screens (sm and up) show 2 columns (4*2 = 8 cards) */
@media (min-width: 576px) {
    .gallery-section .row.row-cols-md-2 > .col {
        flex: 0 0 auto;
        width: 50%;
    }
}

/* For larger screens (lg and up) show 4 columns (4*2 = 8 cards) */
@media (min-width: 992px) {
    .gallery-section .row.row-cols-lg-4 > .col {
        flex: 0 0 auto;
        width: 25%;
    }
}