/* -----------------------------------------------
   CSS สำหรับหน้า NEWS DETAIL
-------------------------------------------------- */

.page-banner {
    width: 100%;
    background: linear-gradient(135deg, rgba(12,127,234,0.7), rgba(12,127,234,0.5)), 
                url('../images/news/bg-news_detail.png') no-repeat center center/cover;
    color: #ffffff;
    padding: 110px 0 70px 0;
    text-align: center;
}

.banner-content h1 {
    font-size: 2.5rem;
    font-weight: 500;
    margin-bottom: 10px;
}

.banner-content p {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

.news-banner {
    background: linear-gradient(135deg, rgba(12,127,234,0.85), rgba(11,26,48,0.9)), 
                url('https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?auto=format&fit=crop&w=1440&q=80') no-repeat center center/cover;
}

/* การจัดโครงสร้าง <main> พร้อม Background แบบ Fade จางลง */


.news-detail-container {
    position: relative;
    z-index: 2; /* ดันเนื้อหาขึ้นมาเหนือบอร์ดเดอร์พื้นหลัง */
    display: flex;
    gap: 40px;
    padding:40px 0;
}

/* คอลัมน์เนื้อหาหลัก */
.news-article {
    flex: 2.7;
    background-color: #ffffff;
    padding: 40px;
    border-radius: var(--border-radius-custom); /* 33px */
    box-shadow: 0 10px 40px rgba(12, 127, 234, 0.03);
}

/* Breadcrumb */
.breadcrumb {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 25px;
    font-weight: 300;
}
.breadcrumb a {
    color: var(--text-light);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--primary-color);
}

/* หัวข้อข่าว */
.article-header {
    margin-bottom: 30px;
}
.article-tag {
    display: inline-block;
    background-color: var(--primary-color); /* สีน้ำเงินหลัก */
    color: #ffffff;
    padding: 4px 18px;
    font-size: 13px;
    border-radius: var(--border-radius-custom); /* 33px */
    margin-bottom: 15px;
}
.article-title {
    font-size: 24px;
    color: var(--text-dark);
    line-height: 1.5;
    font-weight: 500;
    margin-bottom: 15px;
}
.article-meta {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-light);
    font-weight: 300;
}

/* หน้าปกข่าว (Cover) */
.article-cover {
    width: 100%;
    margin-bottom: 35px;
}
.article-cover img {
    width: 100%;
    border-radius: 15px; /* 33px โค้งมนตามภาพสินค้าหน้าแรก */
    box-shadow: 0 8px 25px rgba(0,0,0,0.05);
}

/* ส่วนเนื้อหาคำบรรยาย */
.article-body {
    font-size: 16px;
    color: #444444;
    line-height: 1.8;
    font-weight: 300;
}
.article-body p {
    margin-bottom: 20px;
    text-indent: 30px;
    text-align: justify;
}
.article-body h3 {
    font-size: 18px;
    color: var(--primary-color);
    margin: 35px 0 20px 0;
    font-weight: 500;
}

/* กล่องคำพูดเด่น (Quote) */
.article-body blockquote {
    border-left: 4px solid var(--secondary-color); /* เส้นส้ม */
    background-color: #fffbf7;
    padding: 20px 30px;
    margin: 30px 0;
    font-style: italic;
    color: #555555;
    border-radius: 0 var(--border-radius-custom) var(--border-radius-custom) 0;
}

/* แกลเลอรีรูปภาพย่อย */
.article-gallery {
    display: grid;
    /* แบ่งเป็น 4 คอลัมน์เท่าๆ กัน (สามารถปรับเป็น 3 หรือ 4 ตามดีไซน์ที่ชอบได้ครับ) */
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; /* ระยะห่างระหว่างรูปภาพ */
    margin-top: 30px;
    width: 100%;
}

/* กล่องครอบรูปภาพแต่ละรูปเพื่อควบคุมระเบียบ */
.gallery-item {
    position: relative;
    width: 100%;
    /* เทคนิคทำสัดส่วนรูปภาพให้เป็นสี่เหลี่ยมจัตุรัส (1:1) หรือสี่เหลี่ยมผืนผ้าเท่ากันทุกรูป */
    aspect-ratio: 4 / 3; /* ถ้าต้องการสี่เหลี่ยมจัตุรัสเป๊ะๆ ให้ใช้ 1 / 1 */
    overflow: hidden;
    border-radius: 15px; /* ความโค้งมนที่ดูนุ่มนวลสำหรับรูปภาพขนาดเล็กย่อย */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* ตัวรูปภาพด้านใน */
.gallery-item img {
    width: 100%;
    height: 100%;
    /* คีย์เวิร์ดสำคัญ: บังคับให้รูปขยายเต็มพื้นที่กล่อง โดยที่สัดส่วนไม่เบี้ยว ไม่บดบัง */
    object-fit: cover; 
    object-position: center center; /* จัดให้จุดกึ่งกลางภาพอยู่ตรงกลางกล่องเสมอ */
    transition: transform 0.3s ease;
}

/* เพิ่มลูกเล่นเวลา Hover เพื่อให้เว็บดูโมเดิร์นขึ้น */
.gallery-item:hover img {
    transform: scale(1.05); /* ซูมเข้าเล็กน้อยเวลาเมาส์ชี้ */
}

/* ปุ่มย้อนกลับ */
.article-footer {
    margin-top: 50px;
    border-top: 1px solid #eeeeee;
    padding-top: 30px;
}
.btn-back {
    display: inline-block;
    background-color: var(--secondary-color); /* สีส้มตามสไตล์ปุ่มดูทั้งหมด */
    color: #ffffff;
    text-decoration: none;
    padding: 12px 30px;
    border-radius: 33px;
    font-size: 15px;
    transition: all 0.3s;
}
.btn-back:hover {
    background-color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(12, 127, 234, 0.2);
}

/* คอลัมน์แถบด้านข้าง (Sidebar) */
.news-sidebar {
    flex: 1;
}
.sidebar-widget {
    background-color: #ffffff;
    padding: 25px;
    border-radius: var(--border-radius-custom); /* 33px */
    box-shadow: 0 10px 40px rgba(12, 127, 234, 0.03);
    position: sticky;
    top: 110px; /* เกาะหน้าจอเมื่อเลื่อนอ่าน */
}
.widget-title {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(12, 127, 234, 0.1);
    font-weight: 500;
}

/* รายการย่อยใน Sidebar */
.recent-posts {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.recent-item {
    display: flex;
    gap: 15px;
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.2s;
}
.recent-item:hover {
    transform: translateX(5px);
}
.recent-thumb {
    width: 80px;
    height: 65px;
    flex-shrink: 0;
}
.recent-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}
.recent-info h4 {
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.recent-item:hover h4 {
    color: var(--primary-color);
}
.recent-date {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 300;
}

/* Responsive Web Design สำหรับหน้าจอขนาดเล็ก */
@media (max-width: 991px) {
    .article-gallery {
        grid-template-columns: repeat(3, 1fr); /* แท็บเล็ตเหลือ 3 คอลัมน์ */
    }
    .news-detail-container {
        flex-direction: column;
    }
    .news-sidebar {
        width: 100%;
    }
    .sidebar-widget {
        position: static;
    }
}
@media (max-width: 767px) {
    .article-gallery {
        grid-template-columns: repeat(2, 1fr); /* มือถือเหลือ 2 คอลัมน์ */
        gap: 12px;
    }
    .gallery-item {
        border-radius: 15px; /* ลดความโค้งลงเล็กน้อยเมื่ออยู่บนจอเล็ก */
    }
}
@media (max-width: 575px) {
    .news-article {
        padding: 20px;
    }
    .article-title {
        font-size: 18px;
    }
    .article-gallery {
        grid-template-columns: 1fr;
    }
}