/* CSS Customization Based on Branding */
:root {
    --color-primary: #e31c25; /* Red - สำหรับ Header/Footer/Background สีแดง */
    --color-secondary: #ffcc00; /* Yellow - สีเน้น (Accent) */
    --color-dark: #1a1a1a; /* Dark background - สำหรับเนื้อหาหลัก */
    --color-text-light: #ffffff;
    --color-text-dark: #000000;
    --font-headline: 'Kanit', sans-serif; /* พาดหัว */
    --font-body: 'Sarabun', 'TH Sarabun New', sans-serif; /* เนื้อหา */
}

body {
    font-family: var(--font-body);
    background-color: var(--color-dark);
    color: var(--color-text-light);
}

h1, h2, h3, h4, h5, .navbar-brand, .section-header {
    font-family: var(--font-headline);
}

/* Top Header (Red Bar) */
.top-header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 8px 0;
    font-size: 0.85rem;
}

.top-header a {
    color: var(--color-text-light);
    text-decoration: none;
}

/* Main Navbar */
.navbar {
    background-color: var(--color-dark);
    border-bottom: 2px solid var(--color-primary);
}

.navbar-brand {
    color: var(--color-primary) !important;
    font-weight: 700;
    font-size: 1.8rem;
}

.nav-link {
    color: var(--color-text-light) !important;
    font-family: var(--font-headline);
    font-weight: 400;
}

/* Section Header Styling (Red block as seen in template) */
.section-header {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    display: inline-block;
    padding: 5px 15px;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Card Customization for Dark Theme */
.card {
    background-color: #2a2a2a; /* Darker than body */
    color: var(--color-text-light);
    border: 1px solid #333;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.card-title a {
    color: var(--color-text-light);
    text-decoration: none;
    font-weight: 600;
}

/* Featured Top Story (Hero Section) */
.featured-hero {
    position: relative; /* สำคัญสำหรับการวางองค์ประกอบซ้อนทับ */
    height: 500px; /* กำหนดความสูงเพื่อให้ภาพครอบคลุม */
    overflow: hidden; /* ซ่อนส่วนเกินของภาพ */
    border-radius: 5px;
}

.featured-hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ทำให้รูปภาพครอบคลุมพื้นที่โดยไม่บิดเบี้ยว */
    position: absolute;
    top: 0;
    left: 0;
}

.featured-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.4) 50%, transparent 100%); /* ไล่สีจากล่างขึ้นบน */
    z-index: 1; /* วาง overlay ทับรูปภาพ */
}

.featured-hero-content {
    position: relative; /* ให้อยู่เหนือ overlay */
    z-index: 2;
    padding: 3rem; /* เพิ่ม padding */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* จัดเนื้อหาไปอยู่ด้านล่าง */
    height: 100%;
    color: var(--color-text-light);
}

.featured-hero h2 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-top-badge {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    position: absolute; /* ตำแหน่งตามรูป */
    top: 1.5rem;
    left: 1.5rem;
    z-index: 3; /* อยู่เหนือทุกอย่าง */
    border-radius: 3px;
}

.hero-logo-corner {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 3;
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--color-secondary);
    padding: 5px 10px;
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 3px;
}

/* Top Stories Grid (ใหม่) */
.top-stories-grid .card {
    background-color: #2a2a2a; /* สีพื้นหลังการ์ด */
    border: none;
    border-radius: 0; /* ไม่มีขอบมน */
}
.top-stories-grid .card-body {
    padding: 10px;
}
.top-stories-grid .card-title {
    font-size: 0.9rem; /* ลดขนาดตัวอักษรพาดหัว */
    line-height: 1.3;
}
.top-stories-grid .card-text {
    font-size: 0.75rem; /* ลดขนาดตัวอักษรวันที่ */
}
.top-stories-grid img {
    height: 120px; /* กำหนดความสูงรูปภาพ */
    object-fit: cover;
    width: 100%;
}

/* Hot Issue (Red Block - Page 15) */
.hot-issue-block {
    background-color: var(--color-primary);
    color: var(--color-text-light);
    padding: 30px;
    min-height: 400px;
    display: flex;
    align-items: center;
    border-radius: 5px;
    margin-bottom: 40px;
}

.hot-issue-block img {
    object-fit: cover;
    height: 100%;
    border-radius: 5px;
}

/* Inside Thai Armed Forces Section (Colored Banners - Page 17) */
.branch-header {
    padding: 10px;
    text-align: center;
    font-weight: 600;
    margin-bottom: 15px;
    border-radius: 5px 5px 0 0;
}

.army-bg { background-color: #006400; } /* Dark Green */
.navy-bg { background-color: #000080; } /* Dark Blue */
.airforce-bg { background-color: #4682b4; } /* Steel Blue */

/* Special Quote Block (Page 19) */
.special-quote {
    background-color: #333;
    color: var(--color-text-light);
    padding: 20px;
    border-radius: 5px;
}

.quote-accent {
    background-color: var(--color-secondary);
    height: 5px;
    width: 50px;
    margin-top: 10px;
}

.quote-text {
    font-size: 1.1rem;
    font-style: italic;
}

/* Footer */
.main-footer {
    background-color: var(--color-primary);
    padding: 40px 0 20px;
    margin-top: 40px;
}

.main-footer a {
    color: var(--color-text-light);
    text-decoration: none;
    transition: color 0.2s;
}

.main-footer a:hover {
    color: var(--color-secondary);
}

.footer-logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-secondary);
}

/* Prevent content duplication */
.page-already-loaded {
    display: none;
}

/* Ensure proper spacing for detail page */
#detail-page-content {
    position: relative;
    z-index: 1;
}

.article-headline {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

.featured-image-container {
    margin: 1rem 0;
    position: relative;
    z-index: 1;
}

.article-content {
    position: relative;
    z-index: 1;
}

/* Clearfix for floated elements */
.clearfix::after {
    content: "";
    display: table;
    clear: both;
}