/* Base Styles */

/* ลิงก์ */
a {
    text-decoration: none;
}

a:hover {
    color: #007bff;
}

/* รูปภาพ */
img {
    display: block; /* แสดงเป็นบล็อก */
    width: auto; /* กำหนดความกว้าง */
    height: auto; /* ให้ความสูงปรับตามสัดส่วน */
    cursor: pointer; /* เมื่อวางเมาส์บนรูปจะเปลี่ยนเคอร์เซอร์เป็นรูปมือ */
}

img:hover {
    opacity: 1.5; /* ลดความชัดเจนเล็กน้อยเมื่อ hover */
}

/* Typography Styles */

/* ข้อความทั่วไป */
.news-content p,
.news-content-left p {
    margin: 0 0 10px; /* ปรับระยะห่างระหว่างย่อหน้า */
    line-height: 1.6; /* ปรับความสูงของบรรทัด */
}

/* หัวเรื่อง */
.news-content h2,
.news-content-left h2 {
    font-size: 16px;
    margin: 0;
    padding: 10px 0;
    color: #333;
    font-weight: lighter;
}

/* ข้อความขนาดเล็ก */
.news-content small,
.news-content-left small {
    display: block;
    margin-top: 10px;
    color: #999;
}

/* Layout Styles */

/* คอนเทนเนอร์ข่าว */
.news-container-index {
    display: grid;
    grid-template-columns: 50% 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.news-content-index,
.news-content-index-left {
    padding: 5px;
}

/* ส่วนข่าวหลัก */
.news-main {
    grid-column: 1 / 2;
    position: relative;
    overflow: hidden;
}

/* ส่วนข่าวด้านข้าง */
.news-side {
    grid-column: 2 / 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

/* เนื้อหาข่าว */
.news-content,
.news-content-left {
    padding: 2px;
    font-size: 14px;
    font-weight: lighter;
    text-align: left;
}

.news-content {
    overflow: hidden;
    word-wrap: break-word;
}

/* รูปภาพและ iframe ในเนื้อหาข่าว */
.news-content img,
.news-content iframe {
    max-width: 100%; /* กำหนดความกว้างสูงสุดของรูปภาพและ iframe */
    height: auto; /* รักษาสัดส่วน */
    display: block; /* ป้องกันการห่อของเนื้อหาแบบ inline */
    margin: 10px 0; /* เพิ่มระยะห่าง */
    border-radius: 8px; /* ทำมุมโค้ง */
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1); /* เพิ่มเงาเล็กน้อย */
}

/* News Items */

/* รายการข่าว */
.news-item,
.news-item-left {
    background-color: #fff;
    padding: 5px;
    margin-bottom: 0px;
    border-radius: 10px;
    box-shadow: 0 0px 1px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease-in-out, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}



.news-item-left img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 5px;
    font-weight: lighter;
}

.news-item img {
    height: 130px;
    width: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* Header Styles */

/* ส่วนหัว */
.header-back {
    display: flex;
    justify-content: space-between; /* กระจายองค์ประกอบให้อยู่ซ้ายขวา */
    align-items: center; /* จัดให้อยู่ตรงกลางแนวตั้ง */
    padding: 0px; /* ปรับ padding ให้กระชับ */
    border-radius: 10px; /* มุมมน */
    background-color: transparent; /* ลบสีพื้นหลังออก */
}

.title {
    font-size: 15px;
    color: white;
    margin: 0;
    text-align: left; /* ชิดซ้าย */
}

/* Slider Styles */

/* คอนเทนเนอร์สไลเดอร์ */
.slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
}

.slider .slides {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.slider .slide {
    position: relative;
    flex-shrink: 0;
    width: 100%;
}

/* รูปภาพในสไลเดอร์ */
.slider .slide img {
    width: 100%;
    height: 420px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.slider .slide:hover img {
    transform: scale(1.05);
}

/* Overlay ในสไลเดอร์ */
.slider .slide .overlay {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 15px 20px;
    text-align: left;
    border-radius: 0 0 8px 8px;
    transition: background 0.3s ease;
}

.slider .slide .overlay:hover {
    background: rgba(0, 0, 0, 0.8);
}

.slider .slide .overlay h3 {
    font-size: 22px;
    margin: 0;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.slider .slide .overlay p {
    margin: 10px 0 0;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* การจัดการ Pagination */
.slider .pagination {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
}

.slider .pagination span {
    cursor: pointer;
    height: 12px;
    width: 12px;
    background-color: #bbb;
    border-radius: 50%;
    margin: 0 5px;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.slider .pagination span:hover {
    transform: scale(1.2);
}

.slider .pagination .active {
    background-color: #5f6063;
}

/* Main Slider Container */

/* คอนเทนเนอร์สไลเดอร์หลัก */
.slider-head {
    position: relative;
    max-width: 100%;
    margin: auto;
    overflow: hidden;
    background-color: white;
    padding-bottom: 10px;
    border-radius: 8px;
}

/* คอนเทนเนอร์สไลด์ */
.slides-head {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 100%;
}

/* แต่ละสไลด์ */
.slides-head > div {
    min-width: 100%;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

/* รูปภาพในสไลด์ */
.slides-head img {
     width: 100vw;
    height: 56.25vw; /* 9/16 * 100vw */
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
	    width: 100%;
    height: 100%;

}

.slides-head img:hover {
    transform: scale(1.03);
    border-radius: 8px;
}

/* Pagination */
.pagination-head {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 5px 0;
    z-index: 10;
}

.pagination-head span {
    cursor: pointer;
    height: 12px;
    width: 12px;
    background-color: #bbb;
    border-radius: 50%;
    margin: 0 5px;
    display: inline-block;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.pagination-head span:hover {
    transform: scale(1.2);
}

.pagination-head .active {
    background-color: #5f6063;
}

/* Overlay Content */
.overlay-content {
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    background-color: rgba(42, 62, 244, 0.5);
    color: white;
    padding: 5px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    max-height: 100px;
    overflow-y: auto;
}

.overlay-content-a {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    max-height: 100px;
    overflow-y: auto;
}

/* Action Buttons */

/* ปุ่มการกระทำ */
.action-buttons {
    display: flex;
    gap: 10px;
    /* เพิ่มระยะห่างระหว่างปุ่ม */
}

.action-buttons button {
    padding: 8px 8px;
    font-size: 12px;
    border-radius: 5px;
    cursor: pointer;
    border: none;
    transition: background-color 0.3s ease;
    display: inline-block;
    width: 100px;
    /* กำหนดความกว้างให้ปุ่มเท่ากัน */
    text-align: center;
}

.btn-edit-news {
    background-color: #5677fc;
    color: #fff;
}

.btn-edit-news:hover {
    background-color: #445fd4;
}

.btn-delete-news {
    background-color: #dc3545;
    color: #fff;
}

.btn-delete-news:hover {
    background-color: #b02a37;
}

/* Table Styles */

/* คอนเทนเนอร์ตาราง */
.table_news_sidebar-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 0 auto;
    background-color: #f9f9f9;
    padding: 5px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ตาราง */
table.table_news_sidebar {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto;
    text-decoration: none;
}

.table_news_sidebar th, 
.table_news_sidebar td {
    padding: 10px 10px;
    border-bottom: 1px solid #e0e0e0;
    text-decoration: none; 
}

.table_news_sidebar th {
    background-color: #3c6382;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 1rem;
    border-bottom: 1px solid #dddddd;
}

.table_news_sidebar td {
    color: #333;
}

.table_news_sidebar th:first-child {
    border-top-left-radius: 12px;
}

.table_news_sidebar th:last-child {
    border-top-right-radius: 12px;
}

/* Edit Text Table Styles */

/* ตารางทั่วไป */
.edittext {
    width: 100%;
    margin: 0 auto;
    font-size: 14px;
    overflow-x: auto;
    box-shadow: 0 3.2px 6.4px rgba(0, 0, 0, 0.1);
    font-family: 'Kanit', sans-serif;
    border-spacing: 0;
}

/* หัวตาราง */
.edittext th {
    background-color: #1a73e8;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    border: 1px solid #e7e5e5;
}

/* เนื้อหาตาราง */
.edittext td {
    background-color: #f9f9f9;
    padding: 10px;
    border: 1px solid #e7e5e5;
    text-align: left;
    transition: background-color 0.3s ease;
}

/* สีแถวสลับ */
.edittext tr:nth-child(even) {
    background-color: #eef3fb;
}

/* Hover Effect */
.edittext tr:hover td {
    background-color: #E6F7FF;
}

/* จัดตำแหน่งคอลัมน์แรก */
.edittext td:first-child {
    text-align: right;
    font-weight: bold;
    width: 200px;
    vertical-align: top;
}

/* มุมโค้งของแถวสุดท้าย */
.edittext tbody tr:last-child td:first-child {
    border-bottom-left-radius: 6.4px;
}

.edittext tbody tr:last-child td:last-child {
    border-bottom-right-radius: 6.4px;
}

/* ฟอร์มอินพุต */
.edittext input[type="text"],
.edittext select,
.edittext textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

/* ฟอร์มไฟล์อินพุต */
.edittext input[type="file"] {
    padding: 8px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* ปุ่มส่งฟอร์ม */
.edittext input[type="submit"] {
    background-color: #1a73e8;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
}

.edittext input[type="submit"]:hover {
    background-color: #1558c1;
}

/* จัดปุ่มส่งให้อยู่ตรงกลาง */
.edittext tbody tr:last-child td {
    text-align: center;
}

/* News Page Styles */

/* คอนเทนเนอร์หน้าข่าว */
.news-container {
    display: grid;
    grid-template-columns: 78% 22%;
    gap: 20px;
    padding: 5px;
}

.main-news {
    text-align: left;
}

.news-title {
    text-align: left;
}

.news-content {
    text-align: left;
    margin-top: 20px;
}

.featured-image img {
    max-width: 100%;
    height: auto;
}

.category-list {
    padding: 0px;
    align-self: flex-start;
}

.category-list h3 {
    font-size: 18px;
    margin-bottom: 10px;
    text-align: left;
}

.category-list ul {
    list-style: none;
    padding: 0;
    text-align: left;
}

.category-list ul li {
    margin-bottom: 8px;
}

.category-list ul li a {
    text-decoration: none;
    color: #333;
}

.category-list ul li a:hover {
    color: #007bff;
}

/* Gallery Styles */

/* แกลเลอรี */
.gallery {
    margin-top: 20px;
}

.gallery-container {
    display: flex;
    flex-wrap: wrap;
}

.gallery-item {
    flex: 1 0 22%;
    margin: 5px;
    box-sizing: border-box;
}

.gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 5px;
}

.gallery-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.gallery-thumbnails a {
    flex: 1 0 22%;
    box-sizing: border-box;
}

.gallery-thumbnails img {
    width: 100%;
    height: auto;
    object-fit: cover;
    cursor: pointer;
    border-radius: 5px;
}

/* Pagination Styles */

/* การแบ่งหน้า */
.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination a {
    padding: 8px 16px;
    margin: 0 4px;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
}

.pagination a.active {
    background-color: #333;
    color: #fff;
    border: 1px solid #333;
}

/* Responsive Adjustments */

/* การปรับสำหรับหน้าจอขนาดเล็ก */
@media screen and (max-width: 768px) {
    .edittext td:first-child {
        text-align: left;
        width: 100%;
    }

    .edittext td {
        display: block;
        text-align: left;
    }

    .edittext th {
        font-size: 14px;
    }

    .edittext input[type="submit"] {
        width: 100%;
    }

}


