/* รีเซ็ตค่าพื้นฐาน */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background: #f7f7f7;
  transition: background-color 0.3s ease-in-out;
}

.air h1 {
  text-align: center;
  font-size: 35px;
  color: #333;
  padding: 5px; 
  margin-bottom: 5px; /* เพิ่มระยะห่างด้านล่าง */
  margin-top: -90px; /* เพิ่มระยะห่างด้านบน */
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ส่วนเมนู/เนื้อหาด้านล่าง */
.air-qty-grid {
  position: relative;
  z-index: 2;
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: -50px; /* เพิ่มระยะห่างด้านล่าง */
  padding: 10px 20px;
  height: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

.air-all {
  width: 0;
  height: 0;
  overflow: hidden; /* ซ่อนเนื้อหาที่เกินขอบ */
}

/* การ์ดข่าว */
.air-qty-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 0px;
  max-width: 650px; /* ขนาดการ์ด */
  height: 200px;
  transition: transform 0.3s ease;
  box-sizing: border-box;
}

.air-qty-card:hover {
  transform: translateY(-5px); 
}

.air-qty-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.air-qty img:hover {
  transform: scale(1.05); /* ขยายภาพเมื่อ hover */
}

.air-qty-card h3 {
  position: absolute;
  bottom: 100px;
  left: 0;
  width: 80%;
  padding: 15px;
  color: white;
  text-align: left;
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 22px;
  font-weight: bold;
  padding: 10px;
  margin-left: 10px; 
}

.air-qty-card-body {
    padding: 0 0 20px 0; /* เพิ่มระยะห่างด้านล่าง */
    font-size: 14px;
    color: #000000;
    height: 100%;
    width: 100%;
    overflow: hidden; /* ทำให้เนื้อหาภายในการ์ดไม่ล้นออกมา */
    display: flex; /* ใช้ flexbox เพื่อจัดเรียงเนื้อหา */
    justify-content: space-between; /* จัดเรียงเนื้อหาให้เต็มความสูง */
    background-color: #ffffff; /* สีพื้นหลังของการ์ด */
}

.air-qty-card-body p {
    font-size: 16px;
    position: absolute;
    bottom: 0;
    width: 100%;
    color: rgb(0, 0, 0);
    text-align: center;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* เพิ่มแอนิเมชันให้กับแต่ละการ์ด */
.air-qty-card {
  animation: fadeInFromBottom 0.6s ease-out;
}

/* ส่วนของวัดปริมาณน้ำฝน */
.rain-qty-grid {
  position: relative;
  z-index: 2;
  max-width: 1800px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: -50px; /* เพิ่มระยะห่างด้านล่าง */
  padding: 10px 20px;
  height: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 20px;
}

/* การ์ดน้ำฝน */
.rain-qty {
  width: 100%;
  text-align: center;
  padding: 10px;
  margin-top: -100px; /* เพิ่มระยะห่างด้านบน */
}

.rain-qty-card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  cursor: pointer;
  margin-top: 0px;
  margin-bottom: 60px; /* เพิ่มระยะห่างด้านล่าง */
  max-width: 700px; /* ขนาดการ์ด */
  width: 30%;
  height: 250px;
  transition: transform 0.3s ease;
  box-sizing: border-box;
}

.rain-qty-card:hover {
  transform: translateY(-5px); 
}

/* เพิ่มแอนิเมชันให้กับแต่ละการ์ด */
.air-qty-card {
  animation: fadeInFromBottom 0.6s ease-out;
}

/* ส่วนของแถบค้นหา */
.search-bar {
  text-align: center;
  padding: 20px;
  background-color: #ffffff;
  border-radius: 50px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin: 10px auto;
  max-width: 1000px;
}

.search-bar input {
  width: 300px;
  padding: 10px;
  border: none;
  border-radius: 30px;
  outline: none;
  font-size: 16px;
  transition: width 0.3s ease;
  background-color: #f0f0f0;
}

.search-bar input:focus {
  width: 350px;
  background-color: #fff;
  border: 2px solid #ffcc00;
}

.search-bar button {
  padding: 10px 20px;
  cursor: pointer;
  background-color: #ffcc00;
  color: black;
  font-size: 16px;
  border-radius: 30px;
  transition: background-color 0.3s ease, transform 0.3s ease;
  border: none;
}

.search-bar button:hover {
  background-color: #ff9900;
  transform: translateY(-3px);
}

/* Container grid */
.preview-menu-grid,
.preview-menu-grid-sub {
  width: 100%;
  max-width: 1500px;
  height: auto;
  box-sizing: border-box;
  padding: 0 10px;
  margin: 30px auto;
  display: grid;
  gap: 1px;
}

/* Desktop grid setup */
.preview-menu-grid {
  grid-template-columns: repeat(6, 1fr);
  margin-bottom: 1px;
}

.preview-menu-grid-sub {
  grid-template-columns: repeat(6, 1fr);
  margin-top: 1px;
  padding-bottom: 100px;
}

/* Grid Items */
.grid-item {
  position: relative;
  border-radius: 1px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
  width: 100%;
}

.grid-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.grid-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 1px;
  transition: transform 2s ease;
}

.grid-item:hover img {
  transform: scale(1.05);
}

.overlay-text {
  position: absolute;
  bottom: 20px;
  left: 40px;
  color: #ffffff;
  font-weight: bold;
  text-shadow: 2px 2px 2px rgb(0, 0, 0);
  transition: transform 0.3s ease;
  z-index: 2;
  font-size: 30px;
  letter-spacing: 0.05cm;
}

.grid-item:hover .overlay-text {
  transform: translateY(-5px);
}

.icon-overlay {
  position: absolute;
  bottom: 20px;
  right: 30px;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  font-size: 25px;
  z-index: 2;
}

.grid-item:hover .icon-overlay {
  opacity: 1;
  text-shadow: 1px 1px 1px rgb(0, 0, 0);
}

/* กำหนดขนาดและตำแหน่ง */
/* ภาพใหญ่แถวบน กิน 6 คอลัมน์เต็ม */
.item1 {
  grid-column: 1 / span 6;
  height: 650px;
}

/* แถวสอง 2 รูป (3 คอลัมน์ต่อรูป) */
.item2 {
  grid-column: 1 / span 3;
  height: 500px;
}
.item3 {
  grid-column: 4 / span 3;
  height: 500px;
}

/* แถวสาม 3 รูป (2 คอลัมน์ต่อรูป) */
.item4 {
  grid-column: 1 / span 2;
  height: 300px;
}
.item5 {
  grid-column: 3 / span 2;
  height: 300px;
}
.item6 {
  grid-column: 5 / span 2;
  height: 300px;
}

  /* Banner promote cesm  */
    .slider2 {
      position: relative;
      width: 90%;
      max-width: 100%;
      height: auto;
      overflow: hidden;
      margin-top: 10px;
      margin: 0 auto;
    }

    .slides2 {
      display: flex;
      transition: transform 0.5s ease-in-out;
      width: 100%;
    }

    .slide2 {
      min-width: 100%;
    }

    .slide2 img {
      width: 100%;
      height: auto;
      display: block;
    }

    .nav-btn {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      background: #00AEEF;
      color: white;
      border: none;
      padding: 12px;
      cursor: pointer;
      z-index: 10;
      border-radius: 6px;
    }

    .nav-btn:hover {
      background: #007bbd;
      transform: translateY(-50%) scale(1.1);
    }

    .prev {
      left: 10px;
    }

    .next {
      right: 10px;
    }

    .dots2 {
      position: absolute;
      bottom: 15px;
      right: 5%;
      transform: translateX(-50%);
      display: flex;
      gap: 8px;
    }

    .dot2 {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: #b4b3b3;
      cursor: pointer;
    }

    .dot2.active {
      background: #00AEEF;
    }

/* Animation */
@keyframes scaleUpAndFadeIn {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.05);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.grid-item {
  animation: scaleUpAndFadeIn 0.8s ease-out;
}

/* Responsive Media Queries */

/* iPad Portrait & Tablets 768px - 1024px */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  .preview-menu-grid,
  .preview-menu-grid-sub {
    grid-template-columns: repeat(2, 1fr);
    max-width: 900px;
    padding: 0 10px;
  }

  .item1 {
    grid-column: 1 / span 2;
    height: 400px;
  }

  .item2,
  .item3 {
    grid-column: auto;
    height: 280px;
  }

  .item4,
  .item5,
  .item6 {
    grid-column: auto;
    height: 200px;
  }
}

/* Android Tablets 600px - 767px */
@media screen and (min-width: 600px) and (max-width: 767px) {
  .preview-menu-grid,
  .preview-menu-grid-sub {
    grid-template-columns: repeat(2, 1fr);
    max-width: 600px;
    padding: 0 10px;
    gap: 10px;
  }

  .item1 {
    grid-column: 1 / span 2;
    height: 300px;
  }

  .item2,
  .item3,
  .item4,
  .item5,
  .item6 {
    grid-column: auto;
    height: 220px;
  }
}

/* Mobile Portrait max-width: 599px */
@media screen and (max-width: 599px) {
  .search-bar input {
    width: 80vw;
  }

  .preview-menu-grid,
  .preview-menu-grid-sub {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin: 20px auto;
    padding: 0 10px 30px 10px;
  }

  .item1 {
    grid-column: 1 / span 1;
    height: 210px;
  }
  .item2,
  .item3,
  .item4,
  .item5,
  .item6 {
    grid-column: auto;
    height: 200px;
  }
}

@media screen and (max-width: 390px) {
  .search-bar input {
    width: 80vw;
  }

  .preview-menu-grid,
  .preview-menu-grid-sub {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin: 20px auto;
    padding: 0 10px 30px 10px;
  }

  .item1 {
    grid-column: 1 / span 1;
    height: 180px;
  }
  .item2,
  .item3,
  .item4,
  .item5,
  .item6 {
    grid-column: auto;
    height: 170px;
  }
}

@media screen and (max-width: 320px) {
  .search-bar input {
    width: 80vw;
  }

  .preview-menu-grid,
  .preview-menu-grid-sub {
    grid-template-columns: 1fr;
    max-width: 100%;
    margin: 20px auto;
    padding: 0 10px 30px 10px;
  }

  .item1 {
    grid-column: 1 / span 1;
    height: 140px;
  }
  .item2,
  .item3,
  .item4,
  .item5,
  .item6 {
    grid-column: auto;
    height: 130px;
  }
}

  


/* Responsive Styles for Air Quality Cards */

@media screen and (min-width: 1441px) {
    .air-qty-grid {
      display: flex;
      flex-wrap: nowrap; /* ไม่ตัดบรรทัด */
      flex-direction: row; /* แนวนอน */
      justify-content: center; /* จัดกึ่งกลาง */
      padding: 10px 20px 10px 0px;
      gap: 10px;
    }

    .air-qty-card {
      transform: scale(1);
    }
    .air-qty-card:hover {
      transform: translateY(-5px) scale(1); /* ขยายเมื่อ hover */
    }
  }

  /* 1729px - 1160px */
  @media screen and (min-width: 1160px) and (max-width: 1440px) {
    .air-qty-grid {
      display: flex;
      flex-wrap: nowrap; /* ไม่ตัดบรรทัด */
      flex-direction: row; /* แนวนอน */
      justify-content: center; /* จัดกึ่งกลาง */
      padding: 10px 20px 10px 0px;
      gap: 5px;
    }

    .air-qty-card {
      max-width: 650px; /* ขนาดการ์ด */
      height: 200px; /* ความสูงของการ์ด */
      transform: scale(1) ; /* ไม่ต้องขยาย */
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(1); /* ขยายเมื่อ hover */
    }
  }

  /* แท็บเล็ต */
  @media screen and (max-width: 1159px) and (min-width: 1025px) {

    .air-qty-grid {
      display: flex;
      flex-direction: column; /* แนวนอน */
      justify-content: center; /* จัดกึ่งกลาง */
      padding: 10px 20px 10px 0px;
      gap: 1px;
      margin-bottom: -10px;
      margin-left: 25px;
    }

    .air-qty-card {
      max-width: 650px; /* ขนาดการ์ด */
      height: 200px; /* ความสูงของการ์ด */
      margin-bottom: -40px;
      transform: scale(1);
    }
    .air-qty-card:hover {
      transform: translateY(-5px) scale(1); /* ขยายเมื่อ hover */
    }
  }

   @media screen and (max-width: 1024px) {
    .air-qty-grid {
      display: flex;
      flex-direction: column; /* แนวนอน */
      justify-content: center; /* จัดกึ่งกลาง */
      padding: 10px 20px 10px 0px;
      gap: 1px;
      margin-bottom: -10px;
      margin-left: 30px;
    }

    .air-qty-card {
      max-width: 650px; /* ขนาดการ์ด */
      height: 200px; /* ความสูงของการ์ด */
      margin-bottom: -40px;
      transform: scale(1);
    }
    .air-qty-card:hover {
      transform: translateY(-5px) scale(1); /* ขยายเมื่อ hover */
    }
  }

  /* มือถือแนวตั้ง (แสดงแบบแนว column) */
  @media screen and (min-width: 768px) and (max-width: 857px) {
    
    .air-qty-grid {
      display: flex;
      flex-direction: column;
      align-items: center; /* กึ่งกลางแนวนอน */
      gap: 10px; /* ระยะห่างแต่ละ widget */
      padding: 5px;
    }

    .air-qty-card {
      width: 100vw; /* เต็มจอเกือบสุด */
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      transform: scale(0.9);
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.9); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 767px)  {
    .air h1 {
      font-size: 30px; /* ปรับขนาดตัวอักษร */
    }
    
    .air-qty-grid {
      display: flex;
      flex-direction: column;
      align-items: center; /* กึ่งกลางแนวนอน */
      gap: 10px; /* ระยะห่างแต่ละ widget */
      padding: 5px;
      margin-left: 50px;
      margin: 0 auto; /* จัดกึ่งกลาง */
    }

    .air-qty-card {
      width: 100vw; /* เต็มจอเกือบสุด */
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      transform: scale(0.8);
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.8); /* ขยายเมื่อ hover */
    }
  }

  /* มือถือขนาดเล็ก */
  @media screen and (max-width: 610px)  {
    .air h1 {
      font-size: 20px; /* ปรับขนาดตัวอักษร */
      margin-bottom: -20px;
    }

    .air-qty-grid {
      display: flex;
      flex-direction: column;
      align-items: center; /* กึ่งกลางแนวนอน */
      gap: 10px; /* ระยะห่างแต่ละ widget */
      padding: 5px;
      margin-left: 0px;
      margin-bottom: 0px;
      margin: 0 auto; /* จัดกึ่งกลาง */
    }
    
    .air-qty-card {
      width: 100vw;
      width: 650px; /* เต็มจอเกือบสุด */
      height: auto;
      transform: scale(0.7); /* ไม่ต้องขยาย */
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.8); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 570px)  {
    .air h1 {
      font-size: 20px; /* ปรับขนาดตัวอักษร */
      margin-bottom: -20px;
    }

    .air-qty-grid {
      display: flex;
      flex-direction: column;
      align-items: center; /* กึ่งกลางแนวนอน */
      gap: 10px; /* ระยะห่างแต่ละ widget */
      padding: 5px;
      margin-left: -45px;
      margin-bottom: 0px;
    }
    
    .air-qty-card {
      width: 100vw;
      width: 650px; /* เต็มจอเกือบสุด */
      height: auto;
      transform: scale(0.7); /* ไม่ต้องขยาย */
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.7); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 480px) {
    .air h1 {
      font-size: 20px; /* ปรับขนาดตัวอักษร */
      margin-bottom: 20px; /* เพิ่มระยะห่างด้านล่าง */
    }

    .air-qty-grid {
      flex-direction: column;
      align-items: center;
      margin-top: -50px; /* ปรับระยะห่างด้านบน */
      margin-bottom: 50px; /* เพิ่มระยะห่างด้านล่าง */
      padding: 5px;
      gap: 5px; /* เพิ่มระยะห่างระหว่างการ์ด */
    }
    
    .air-qty-card {
      width: 200vw;
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      height: auto;
      margin-left: -50px; /* ปรับตำแหน่งให้กึ่งกลาง */
      margin-bottom: -55px;
      transform: scale(0.65); 
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.65); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 430px) {
    .air h1 {
      font-size: 18px; /* ปรับขนาดตัวอักษร */
      margin-bottom: 20px; /* เพิ่มระยะห่างด้านล่าง */
    }

    .air-qty-grid {
      flex-direction: column;
      align-items: center;
      margin-top: -50px; /* ปรับระยะห่างด้านบน */
      margin-bottom: 50px; /* เพิ่มระยะห่างด้านล่าง */
      padding: 5px;
      gap: 5px; /* เพิ่มระยะห่างระหว่างการ์ด */
    }
    
    .air-qty-card {
      width: 200vw;
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      height: auto;
      margin-left: -70px; /* ปรับตำแหน่งให้กึ่งกลาง */
      margin-bottom: -55px;
      transform: scale(0.55); 
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.55); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 390px) {
    .air h1 {
      font-size: 18px; /* ปรับขนาดตัวอักษร */
    }

    .air-qty-grid {
      flex-direction: column;
      align-items: center;
      margin-top: -50px; /* ปรับระยะห่างด้านบน */
      margin-bottom: 40px; /* เพิ่มระยะห่างด้านล่าง */
      padding: 5px;
      gap: 5px; /* เพิ่มระยะห่างระหว่างการ์ด */
    }
    
    .air-qty-card {
      width: 200vw;
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      height: auto;
      margin-left: -90px; /* ปรับตำแหน่งให้กึ่งกลาง */
      margin-bottom: -70px;
      transform: scale(0.55); 
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.55); /* ขยายเมื่อ hover */
    }
  }
  
  @media screen and (max-width: 320px) {
    .air h1 {
      font-size: 14px; /* ปรับขนาดตัวอักษร */
      margin-bottom: -20px; /* เพิ่มระยะห่างด้านล่าง */
    }

    .air-qty-grid {
      flex-direction: column;
      align-items: center;
      margin-top: -50px; /* ปรับระยะห่างด้านบน */
      margin-bottom: 45px; /* เพิ่มระยะห่างด้านล่าง */
      padding: 5px;
      gap: 5px; /* เพิ่มระยะห่างระหว่างการ์ด */
    }
    
    .air-qty-card {
      width: 200vw;
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      height: auto;
      margin-left: -125px; /* ปรับตำแหน่งให้กึ่งกลาง */
      margin-bottom: -85px;
      transform: scale(0.45); 
    }

    .air-qty-card:hover {
      transform: translateY(-5px) scale(0.45); /* ขยายเมื่อ hover */
    }
  }

  /*วัดปริมาณน้ำฝน*/
  @media screen and (max-width: 480px) {

    .rain-qty-grid {
      align-content: center;
      padding: 5px 0 -10px 0; 
    }

    .rain-qty {
      width: 100%;
      text-align: center;
      padding: 5px;
      margin-top: 10px; /* เพิ่มระยะห่างด้านบน */
      font-size: 12px;;
    }
    
    .rain-qty-card {
      width: 100vw; /* เต็มจอเกือบสุด */
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      padding: 10px;
      transform: scale(1);
    }

    .rain-qty-card:hover {
      transform: translateY(-5px) scale(1); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 768px) {
    .rain-qty-grid {
      align-content: center;
      padding: 5px;
    }

    .rain-qty {
      width: 100%;
      text-align: center;
      padding: 5px;
      margin-top: 10px; /* เพิ่มระยะห่างด้านบน */
      font-size: 12px;;
    }
    
    .rain-qty-card {
      width: 100vw; /* เต็มจอเกือบสุด */
      max-width: 650px; /* จำกัดขนาดสูงสุด */
      padding: 10px;
      transform: scale(1);
    }

    .rain-qty-card:hover {
      transform: translateY(-5px) scale(1); /* ขยายเมื่อ hover */
    }
  }

  @media screen and (max-width: 1024px) {
    

    .rain-qty {
      width: 100%;
      text-align: center;
      padding: 5px;
      margin-top: 10px; /* เพิ่มระยะห่างด้านบน */
      font-size: 12px;;
    }
  }