/* =========================================
   1. ตัวแปรและตั้งค่าพื้นฐาน (Global Reset)
========================================= */
:root {
    --primary: #1D2A74;
    --light: #00AEEF;
    --danger: #ED1C24;
    --bg-gray: #f4f6f9;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

html, body {
    max-width: 100%;
    overflow-x: hidden; /* ห้ามเลื่อนซ้ายขวาเด็ดขาด */
    background-color: var(--bg-gray);
    font-family: 'Prompt', sans-serif;
    color: #333;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* บังคับรูปภาพทุกรูปไม่ให้ล้นจอ */
img { 
    max-width: 100%; 
    height: auto !important; 
    display: block; 
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================================
   2. ส่วนหัว (Header & Top Bar)
========================================= */
.top-bar { background: #222; color: #fff; font-size: 0.8rem; padding: 8px 0; }
.top-bar-flex { display: flex; justify-content: space-between; align-items: center; }

.main-header { background: #fff; overflow: hidden; }
.main-header img { width: 100%; object-fit: cover; }

/* =========================================
   3. เมนูนำทาง (Navbar)
========================================= */
.navbar {
    background-color: var(--primary);
    border-bottom: 4px solid var(--light);
    position: sticky;
    top: 0;
    z-index: 9999;
    min-height: 50px;
}

.nav-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 50px;
}

.nav-menu { display: flex; }
.nav-menu li a { display: block; padding: 13px 20px; color: #fff; font-weight: 400; }
.nav-menu li a:hover { background-color: var(--light); }

/* ปุ่ม 3 ขีด */
.mobile-menu-btn {
    display: none; /* ซ่อนในคอม */
    background: rgba(255,255,255,0.1);
    border: 1px solid #fff;
    color: #fff;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Prompt', sans-serif;
    position: absolute;
    right: 15px;
}

/* =========================================
   4. Layout หลัก (Hero, Content, Sidebar)
========================================= */
/* Hero Grid (พาดหัวใหญ่) */
.hero-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    margin: 20px 0;
}

.hero-main { height: 400px; position: relative; background: #000; border-radius: 8px; overflow: hidden; display: block; }
.hero-sub-grid { display: grid; grid-template-rows: 1fr 1fr; gap: 15px; }
.hero-sub { height: 192.5px; position: relative; background: #000; border-radius: 8px; overflow: hidden; display: block; }

.hero-img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: 0.5s; }
.hero-main:hover .hero-img, .hero-sub:hover .hero-img { opacity: 1; transform: scale(1.05); }

.news-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%;
    padding: 20px; background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: #fff;
}

/* โครงสร้าง Main + Sidebar */
.content-wrapper {
    display: flex;
    gap: 30px;
}
.main-content { flex: 2; min-width: 0; } /* min-width: 0 กัน Flex พัง */
.sidebar { flex: 1; }

/* Grid ข่าวทั่วไป */
.section-title {
    background: var(--primary); color: #fff;
    padding: 5px 15px; display: inline-block; margin-bottom: 20px;
}
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}
.grid-item { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.grid-img img { height: 180px; width: 100%; object-fit: cover; }
.grid-content { padding: 15px; }

/* =========================================
   5. ส่วนท้าย (Footer)
========================================= */
footer { background: var(--primary); color: #fff; padding-top: 40px; margin-top: 50px; }
.footer-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 30px; 
    padding-bottom: 40px; 
}
.footer-bottom { background: #111; padding: 20px 0; font-size: 0.85rem; }

/* =========================================
   6. โหมดมือถือ (Mobile Responsive)
========================================= */
@media screen and (max-width: 768px) {
    .container { padding: 0 10px; }

    /* Navbar มือถือ */
    .nav-container { justify-content: flex-start; height: 50px; }
    .mobile-menu-btn { display: flex; align-items: center; gap: 5px; }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        background-color: var(--primary);
        position: absolute;
        top: 50px;
        left: 0;
        z-index: 1000;
    }
    .nav-menu.active { display: flex; }
    .nav-menu li { border-bottom: 1px solid rgba(255,255,255,0.1); }
    .nav-menu li a { padding: 15px 20px; }

    /* ปรับ Layout เนื้อหาเป็นแนวตั้ง */
    .hero-section { grid-template-columns: 1fr; }
    .hero-main { height: 250px; }
    .hero-sub-grid { grid-template-columns: 1fr 1fr; height: auto; }
    .hero-sub { height: 150px; }

    .content-wrapper { flex-direction: column; }
    .news-grid { grid-template-columns: 1fr; } /* ข่าวเรียงเดี่ยวในมือถือ */

    .top-bar-flex { flex-direction: column; text-align: center; gap: 5px; }
}

@media screen and (max-width: 480px) {
    .hero-sub-grid { grid-template-columns: 1fr; }
    .hero-sub { height: 200px; }
}
/* =========================================
   5. ส่วนท้าย (Footer - กลับมาใช้แบบคลีน)
========================================= */
footer { 
    background: var(--primary); /* ใช้สีน้ำเงินตั้งต้นของเว็บ */
    color: #fff; 
    padding-top: 40px; 
    margin-top: 50px; 
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 30px;
    padding-bottom: 30px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 300px;
}

.footer-contact {
    flex: 1;
    min-width: 250px;
}

.footer-contact h4 {
    color: var(--light);
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255,255,255,0.1);
    padding-bottom: 5px;
    display: inline-block;
}

.footer-bottom { 
    background: #111; 
    padding: 15px 0; 
    font-size: 0.85rem; 
}

/* จัดระเบียบ Footer ในมือถือ */
@media screen and (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .footer-logo {
        flex-direction: column;
        text-align: center;
    }
    .footer-bottom .container {
        justify-content: center !important; /* จัดสถิติและข้อความให้อยู่ตรงกลางในมือถือ */
    }
}
/* =========================================
   แถบข่าวด่วน (Breaking News Ticker)
========================================= */
.breaking-news-container {
    max-width: 1200px;
    margin: 15px auto;
    padding: 0 15px;
}

.breaking-news {
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #ED1C24; /* เส้นขอบซ้ายสีแดงเพิ่มมิติ */
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08); /* เพิ่มเงาให้กล่องลอยเด่นขึ้นมา */
}

.breaking-label {
    background-color: #ED1C24; /* สีแดงสด */
    color: #ffffff;
    padding: 10px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

/* เพิ่มลูกเล่นกระพริบเบาๆ ให้ไอคอนหน้าคำว่าข่าวด่วน */
.breaking-label i {
    animation: blink-icon 1.5s infinite;
}
@keyframes blink-icon {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.breaking-ticker {
    flex-grow: 1;
    padding: 0 15px;
    display: flex;
    align-items: center;
}

.breaking-ticker marquee {
    font-size: 1.1rem; /* ปรับขนาดอักษรข่าวให้ใหญ่ขึ้น */
    font-weight: 500;
    padding-top: 5px;
}

.breaking-ticker a {
    color: #1D2A74; /* สีตัวหนังสือข่าวเป็นสีน้ำเงินเข้ม */
    text-decoration: none;
    transition: 0.3s;
}

.breaking-ticker a:hover {
    color: #ED1C24; /* เวลาเอาเมาส์ชี้เปลี่ยนเป็นสีแดง */
    text-decoration: underline;
}

/* ปรับขนาดในมือถือ */
@media screen and (max-width: 768px) {
    .breaking-label { padding: 8px 15px; font-size: 1rem; }
    .breaking-ticker marquee { font-size: 1rem; }
}
/* --- Dropdown Menu --- */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #1D2A74; /* สีเดียวกับ Navbar */
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 999;
    top: 100%;
    left: 0;
    border-radius: 0 0 5px 5px;
    overflow: hidden;
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dropdown-content a:hover {
    background-color: #00AEEF; /* สีฟ้าตอนเอาเมาส์ชี้ */
}

/* แสดง Dropdown เมื่อเอาเมาส์ชี้ */
.dropdown:hover .dropdown-content {
    display: block;
}

/* เครื่องหมายลูกศรชี้ลง */
.dropbtn i {
    font-size: 0.8rem;
    margin-left: 3px;
}