/* ==========================================================================
   responsive.css — โหลดหลังไฟล์ CSS อื่นทั้งหมด (header.php)
   ทำให้ layout เดิมที่ fix ความกว้าง 1340px ปรับตามขนาดจอได้
   โดยไม่แก้ style.css เดิม
   ========================================================================== */

/* ---------- ทุกขนาดจอ ---------- */
html, body { max-width: 100%; overflow-x: hidden; }
img { max-width: 100%; height: auto; }

/* กล่องเกณฑ์ AQI ด้านขวา: เดิม fix height ทำให้ข้อความล้นทับกล่องถัดไป */
.aqi-boxR01, .aqi-boxR02, .aqi-boxR03, .aqi-boxR04, .aqi-boxR05, .aqi-boxR06 { height: auto !important; }
.aqi-boxR01 { min-height: 227px; }
.aqi-boxR02 { min-height: 140px; }
.aqi-boxR03 { min-height: 141px; }
.aqi-boxR04 { min-height: 216px; }
.aqi-boxR05 { min-height: 317px; }
.aqi-boxR06 { min-height: 197px; }
.aqi-boxR02::after, .aqi-boxR03::after, .aqi-boxR04::after,
.aqi-boxR05::after, .aqi-boxR06::after, .aqi-LA::after, .emo-box::after,
.mid-content::after, .aqi-boxL::after, .aqi-boxR::after { content: ""; display: table; clear: both; }
.emo-box { height: auto; min-height: 90px; }

/* กล่องเนื้อหาด้านซ้าย: เดิม fix height ด้วย inline style */
.aqi-LA { height: auto !important; min-height: 400px; padding-bottom: 30px; }

/* ---------- จอเล็กกว่า 1360px: เปลี่ยนจาก fix width เป็นยืดตามจอ ---------- */
@media (max-width: 1359px) {
    #header, #topnav, .bar-navmain, .bar-navmain-in, .navbar, #mid-map,
    .certa, #warer-In { min-width: 0 !important; width: 100% !important; }
    .bar-navmain, .bar-navmain-in { left: 0; }
    #mid-map { margin-bottom: 60px; }
    .mid-content, .rp-agi, .gih01, .bgbox01-in-bttom { width: auto !important; max-width: 1200px; padding-left: 16px; padding-right: 16px; }
    ul.navtop { width: auto !important; max-width: 100%; display: flex; flex-wrap: wrap; justify-content: center; }
    ul.navtop li { float: none; }

    /* ซ้าย-ขวา ของหน้า Aqi แบ่งตามสัดส่วนเดิม (746 : 453) */
    .aqi-boxL { width: 62%; margin-right: 0; }
    .aqi-boxR { width: 38%; }
    .aqi-LA { width: 100%; }
    .aqi-boxR02, .aqi-boxR03, .aqi-boxR04, .aqi-boxR05, .aqi-boxR06 { width: auto; }
    .lavel-th { width: auto; }

    /* ตารางกว้าง: เลื่อนแนวนอนในกรอบแทนการดันหน้าออก */
    .tabl01, .tabl02, .tabl04, .tabl06 { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tabl01 > tbody, .tabl02 > tbody, .tabl04 > tbody, .tabl06 > tbody { display: table; width: 100%; min-width: 760px; }
}

/* ---------- แท็บเล็ต / จอเล็ก (< 992px): วางคอลัมน์ซ้อนกัน ---------- */
@media (max-width: 991px) {
    #header { height: auto !important; padding-bottom: 20px; background-size: cover !important; }
    #topnav { height: auto !important; }
    .logo-bkk { margin: 0 auto; float: none; }
    .bar-navmain, .bar-navmain-in { position: relative !important; margin-top: 10px !important; height: auto !important; background-size: cover; }
    .navbar { height: auto !important; background-size: auto 100%; }
    ul.navtop { height: auto !important; background: none; }
    ul.navtop li a { height: auto !important; padding: 14px 12px !important; }
    ul.navtop li a:hover, .activenav, .activelang { background-position: center bottom !important; }

    .head-top, .head-top2, .head-top4 { float: none; width: auto !important; margin: 0 16px !important; height: auto !important; padding-bottom: 20px; background-size: auto 40px !important; background-position: right 10px !important; font-size: 24px; line-height: 30px; }

    .aqi-boxL, .aqi-boxR { float: none; width: 100%; }
    .aqi-LA { background-position: 100px 100% !important; }

    .text-bott { padding: 30px 16px; }
    .araf { padding: 20px 16px; }
    .bgbox01-in-bttom2 { height: auto; }
    .bf01, .bf02 { float: none !important; width: auto; background: none; padding-left: 0; height: auto; }

    /* แถวรายการสถานีหน้าแรก (inline padding-left:140px) */
    #div_data .list-group-item [class*="col-sm-"] { padding-left: 10px !important; padding-right: 10px !important; }
    .row-group [class*="col-sm-"] { text-align: center !important; }
}

/* ---------- มือถือ (< 600px) ---------- */
@media (max-width: 599px) {
    body { font-size: 15px; }
    .txt-top { font-size: 17px; line-height: 22px; }
    .logo-bkk { width: auto; height: auto; background-size: cover; padding-bottom: 10px; }
    ul.navtop li { font-size: 15px !important; }
    ul.navtop li a { padding: 10px 8px !important; }

    .head-top, .head-top2, .head-top4 { font-size: 20px; line-height: 26px; background-image: none !important; }

    /* กล่องซ้ายหน้า Aqi: รูปหมายเลขอยู่ด้านบนข้อความ */
    .aqi-LA { min-height: 0; padding: 0 16px 24px; background-image: none !important; }
    .aqi-LA-in { float: none !important; width: auto; padding: 20px 0 10px; }
    .aqi-LA-in p { display: inline-block; vertical-align: middle; padding: 0 10px 0 0 !important; }
    .aqi-LA .thapi, .aqi-LA .thapiHead { float: none !important; padding-top: 10px !important; }
    .thapi { font-size: 17px; }
    .aqi-LA .thapi br { display: none; } /* ข้อความเดิมตัดบรรทัดไว้สำหรับจอกว้าง */
    .txt-top { display: inline-block; background: rgba(255,255,255,.85); border-radius: 6px; padding: 2px 8px; }
    .thapiHead, .thapiHead2 { font-size: 21px; }

    .aqi-boxR01 { padding: 20px 16px; min-height: 0; background-image: none; }
    .aqi-boxR02, .aqi-boxR03, .aqi-boxR04, .aqi-boxR05, .aqi-boxR06 { padding: 20px 16px; min-height: 0; background-image: none; }
    .padd09 { padding-right: 12px; }
    .padd09 img { width: 64px; }
    .enapi { font-size: 18px; line-height: 30px; }

    .text-bott .spf { float: none; display: block; text-align: center; padding: 0 0 10px; }
    .copy { padding: 20px 10px; font-size: 13px; letter-spacing: 0; }
    .btn-lg { padding: 8px 14px; font-size: 15px; margin-bottom: 6px; }
}
