@import url('https://fonts.googleapis.com/css2?family=Kanit&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Kanit", serif;
  background: #f5f5f5; /* เพิ่มพื้นหลังอ่อนๆ เพื่อทำให้เนื้อหาดูสะอาดตา */
  margin-top: 50px; /* ปรับระยะห่างให้เนื้อหาด้านล่างไม่ชนกับเมนู */

}

/* เมนูหลัก */
.menu-container {
  display: flex;
  justify-content: space-between;
  flex-direction: column;  /* ใช้ flexbox แนวตั้ง */
  align-items: center;
  background-color: rgb(17, 17, 17);
  padding: 8px 20px; /* ลด padding ด้านบน-ล่าง และซ้าย-ขวา */
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 9999;
  transition: background-image 1s ease, padding 0.3s ease; /* เพิ่มแอนิเมชันที่นุ่มนวล */
  background-size: cover;
  background-position: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); /* เพิ่มเงาเบาๆ ที่เมนู */
  height: 50px; /* กำหนดความสูงแถบเมนูให้คงที่ */
}

.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.menu-container.scrolled {
  background-color: rgb(17, 17, 17);
  padding: 10px 50px; /* ลด padding เมื่อลงจากการเลื่อน */
}

.logo {
  text-align: center;
  margin-bottom: 0px;  /* เพิ่มระยะห่างด้านล่างให้กับโลโก้ */
}

.logo img {
  width: 70px;  /* กำหนดขนาดความกว้าง */
  height: auto;  /* ความสูงจะปรับให้สัมพันธ์กัน */
}


.menu-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;  /* จัดตำแหน่งลิงก์ทั้งหมดให้อยู่กลาง */
  gap: 20px;
  position: relative;
  font-family: "Kanit", serif;
  margin-bottom: 1px;  /* เพิ่มระยะห่างด้านล่างของเมนู */
  z-index: 1;
  transform: translateY(0%);
  transition: transform 0.5s;
}

.menu-tabs.dropdown-is-active {
  transform: translateY(0);
}

.menu-tabs a {
  color: white;
  text-decoration: none;
  font-size: 13px;
  padding: 4px 8px; /* ลด padding ของลิงก์ */
  transition: color 0.3s ease, transform 0.3s ease; /* เพิ่มแอนิเมชันที่เน้นการเปลี่ยนแปลง */
   
}

.menu-tabs a:hover {
  color: #ffcc00; /* สีที่สะดุดตาเมื่อ hover */
}

/* เมนูย่อย */
.menu-tabs .submenu {
  display: none;
  position: absolute;
  top: 40px;
  left: 70px;
  width: 100%; /* เพิ่มความกว้าง */
  background: linear-gradient(135deg, #1e2a47, #3a4a74); /* ใช้ gradient เพื่อให้พื้นหลังดูสวยงาม */
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 15px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease; /* เพิ่มแอนิเมชันที่เรียบเนียน */
  z-index: 1;
}

.menu-tabs a:hover + .submenu,
.menu-tabs .submenu:hover {
  display: block;
  opacity: 1;
  transform: translateY(0);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4); /* เงาเพิ่มขึ้นเมื่อแสดงเมนูย่อย */
}

.submenu a {
  color: white;
  text-decoration: none;
  display: block;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 5px;
  transition: all 0.3s ease;
}

/* เพิ่มแอนิเมชันให้โลโก้ */
.menu-container.scrolled .logo {
  font-size: 28px; /* ขนาดของโลโก้เล็กลงเมื่อเลื่อน */
}

/* การตั้งค่าสำหรับค้นหา */
/* .search input {
  padding: 8px 15px;
  border: 2px solid #fff;
  border-radius: 25px;
  width: 150px;
  transition: width 0.4s ease-in-out;
}

.search input:focus {
  width: 200px;
  outline: none;
} */

.menu-item-with-submenu {
  position: relative; /* เพื่อให้ submenu ที่ absolute อ้างอิงจากตรงนี้ */
}

.menu-item-with-submenu > a {
  display: inline-block;
  padding: 4px 8px;
  color: white;
  text-decoration: none;
  font-size: 13px;
}



/* ปรับตำแหน่ง submenu ให้เริ่มจากล่างของลิงก์เมนู */
.menu-item-with-submenu .submenu {
  position: absolute;
  top: 100%; /* อยู่ใต้ลิงก์เมนู */
  left: 0; /* เริ่มที่ขอบซ้ายของเมนูหลัก */
  right: 0; /* สำคัญ: เต็ม container */
  width: calc(100vw - (100vw - 100%)); /* ให้ submenu กว้างเท่า menu-container */
  margin-left: calc(-1 * (var(--menu-container-left, 0px))); /* ดึงกลับซ้ายเท่ากับ menu-container */
  margin-left: calc(-1 * var(--container-padding, 20px));
  width: calc(100% + (2 * var(--container-padding, 20px)));
  background: rgb(218, 4, 4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  padding: 15px 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  display: none; /* ซ่อนปกติ */
  z-index: 9999; 
}

/* สไตล์ของสไลด์ */
.slider {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.slider-images {
  display: flex;
  transition: transform 0.5s ease-in-out;
  width: calc(var(--total-slides) * 100vw); 
  height: 100%;
}

.slide {
  flex: 0 0 100vw;
  height: 100%;
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* สไตล์สำหรับ dot navigation */
.slider-dots {
  position: absolute;
  bottom: 20px; /* ตั้งตำแหน่งด้านล่าง */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 10px;
}

.dot {
  width: 12px;
  height: 12px;
  background-color: grey;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.3s ease;
  cursor: pointer;
}

/* เมื่อ dot ถูกเลือก (active) จะเปลี่ยนสี */
.dot.active {
  background-color: rgb(117, 0, 226);
  transform: scale(1.2);
}

.fade {
  animation-name: fadeAnimation;
  animation-duration: 1.5s; 
}
@keyframes fadeAnimation {
  from {opacity: .4}
  to {opacity: 1}
} 

.text {
  position: absolute;
  bottom: 20px;
  left: 20px;
  color: white;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* เพิ่มการจัดตำแหน่งแถบค้นหาและภาษา */
.top-right-menu {
  position: absolute;
  top: 15px;
  right: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}
/* ปรับสไตล์ปุ่มเปลี่ยนภาษา */
.language-dropdown {
    position: relative;
}

.language-button {
  background-color: transparent;
  border: 1px solid #ccc;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #ffffff;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.language-button:hover {
  background-color: rgba(0, 0, 0, 0.1);
  border-color: #ffffff;
}

.language-icon {
  width: 14px;
  height: 14px;
}

.arrow {
  font-size: 8px;
}

.language-options {
  display: none;
  position: absolute;
  top: 40px;
  right: 0;
  background-color: transparent;
  border: 1px solid #ffffff;
  border-radius: 5px;
  width: 60px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  z-index: 1;
}

.language-option {
  background-color: transparent;
  border: none;
  padding: 8px;
  text-align: left;
  width: 100%;
  cursor: pointer;
  color: #ffffff;
  font-size: 12px;
}

.language-option:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

/* ปรับให้เมนูภาษาแสดงเมื่อคลิก */
.language-dropdown.active .language-options {
  display: block;
}

.language-button i {
  font-size: 16px;
}


/* สไตล์ช่องค้นหา */
.search {
  display: flex;
  justify-content: center;
  align-items: center;
}

.search-button {
  background-color: transparent;
  border: 1px solid #ccc;
  padding: 5px 10px;
  border-radius: 25px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
  color: #ffffff; /* สีของไอคอน */
}

.search-button:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: #aaa;
}

.search-button i {
  font-size: 16px;
}

.search-button:focus {
  outline: none;
}
/*  */



.menu-scrolled {
  background-color: rgb(17, 17, 17); /* ตัวอย่างสีโปร่งใส */
  transition: background-color 0.3s ease-in-out; /* ทำให้การเปลี่ยนแปลงสีดูนุ่มนวล */
}

/* เมื่อไม่เลื่อนพื้นหลังจะโปร่งใส */
/* กำหนดสไตล์ปกติของเมนู */
#mainMenu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    transition: top 0.3s ease;
    z-index: 9999;
}

/* ซ่อนเมนูปกติในขนาดหน้าจอเล็ก */
.menu-items {
  display: flex;
  gap: 15px;
}

.hamburger-menu {
  display: none;
  cursor: pointer;
  color: #fcf8f8;
}



/*menu-apple*/

.mega-submenu {
  display: none;
  position: absolute; 
  top: 100%; 
  left: 0; 
  width: 100%;
  background: rgb(17, 17, 17); 
  padding: 0; 
  animation: dropdown 0.4s ease forwards; /* เรียกใช้ keyframes */
  pointer-events: auto;
  justify-content: center;
  z-index: 9999;
}
.mega-submenu.show { 
  display: flex; 
  justify-content: left 0; 
}

.submenu-layout {
  display: grid;
  grid-template-rows: repeat(2, auto);     /* 2 แถว */
  grid-auto-flow: column;                  /* เติมจากบนลงล่าง แล้วไปทางขวา */
  max-width: 1280px;
}

.submenu-content {
  display: grid;
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  gap: 1px;
  top: 0; 
  left: 5.5%; 
  width: 100%;
  font-size: 16px;
  position: relative;
}
.submenu-content.show {
  display: flex; /* flex แนวตั้ง */
}
.submenu-content a {
  color: rgba(255, 255, 255, 0.582); /* เปลี่ยนสีพื้นหลังเมื่อ hover */
  text-decoration: none; 
  padding: 4px 20px;
  transition: color 0.3s ease, background-color 0.3s ease; /* เพิ่มแอนิเมชันที่เน้นการเปลี่ยนแปลง */
}
.submenu-content a:hover {
  color: white; 
}
.submenu-column {
  display: flex;
  flex-direction: column;
  min-width: 200px; /* กำหนดความกว้างขั้นต่ำ */
}
.submenu-column p {
  color: #8d38c9; 
  text-decoration: none; 
  padding: 8px 20px;
  font-size: 14px;
  font-weight: bold;
}



.sliedown {
    animation: fade-in-top-normal 0.4s 
    normal forwards;
    }

.sliedown:nth-child(1) {
      animation-delay: 0s;
    }

    .sliedown:nth-child(2) {
      animation-delay: 0.1s;
    }

    .sliedown:nth-child(3) {
      animation-delay: 0.15s;
    }

    .sliedown:nth-child(4) {
      animation-delay: 0.20s;
    }

.menu-item-with-submenu .submenu {
  animation: dropdownOut 0.4s ease forwards; /* เมื่อไม่ hover */
}

.menu-item-with-submenu:hover .submenu {
  animation: dropdown 0.4s ease forwards; /* เมื่อ hover */
}

/* เบลอ background ทั้ง body เมื่อเมนูแสดง */
body.blur-bg::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    backdrop-filter: blur(10px); /* เบลอ */
    background: rgba(0,0,0,0.1); /* เพิ่มเงาอ่อน */
    z-index: 999; /* ใต้ mega-submenu */
}

#scrollToTop, #messengerBtn {
  position: fixed;
  bottom: 25px;
  z-index: 9999;
  background: #3a4a7493;
  color: white;
  border-radius: 50%;
  width: 45px;
  height: 45px;
  font-size: 20px;
  text-align: center;
  line-height: 45px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.3s ease;
}



/* ปุ่ม scroll ↑ อยู่ขวากว่า messenger นิด */
#scrollToTop {
  right: 80px;
  display: none;
}

#messengerBtn {
  right: 25px;
  text-decoration: none;
}
#scrollToTop:hover {
  transform: scale(1.15);
  background: #8d38c9;
}
#messengerBtn:hover {
  transform: scale(1.15);
  background: #007aff;
}
    
@keyframes dropdown {
  0% {
    opacity: 0;
    transform: translateX(0%) translateY(-20px); /* เริ่มล่าง */
  }
}

@keyframes dropdownOut {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

@keyframes fade-in-top-normal {
  0% { transform: translateY(-50px); opacity: 0; } 
  100% { transform: translateY(0); opacity: 1;} 
}

/* สำหรับหน้าจอเล็ก (มือถือ, แท็บเล็ต) */
@media screen and (max-width: 768px) {
  /* ซ่อนเมนู */
  .menu-tabs {
      display: none;
  }

  /* แสดง hamburger menu */
  .hamburger-menu {
      display: block;
      cursor: pointer;
      font-size: 30px;
      padding: 10px;
      position: absolute;
      top: -5px;
      left: 0;
  }

  /* เมนูเต็มเมื่อกด hamburger */
  .menu-container.open .menu-tabs {
      display: block;
      position: absolute;
      top: 50px;
      left: 0;
      width: 100%;
      background-color:  rgb(17, 17, 17);
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 15px;
      z-index: 10;
  }

  .slider {
      height: 300px; /* ปรับความสูงของสไลด์ให้เหมาะสมกับมือถือ */
      width: 100%;
  }
}

/* assets/css/style.css เพิ่มส่วนนี้ */
@media screen and (max-width: 768px) {
    .menu-tabs {
        display: none;
        position: absolute;
        top: 50px;
        left: 0;
        width: 100%;
        background:  rgb(17, 17, 17);
        flex-direction: column;
        padding: 10px 20px;
        z-index: 999;
    }

    .menu-tabs.show { 
      display: flex; 
    }

    /* ปุ่ม ภาษา กับค้นหา */
    .top-right-menu {
        position: absolute;
        top: 10px;
        right: 0;
        padding: 5px;
    }

    .search-button, .language-button {
        padding: 4px 8px;
        font-size: 12px;
    }
}

/* Mobile - Mega Menu (Accordion) */
@media screen and (max-width: 768px) {
  .mega-submenu {
    display: none;
    position: absolute;
    top: 50px;
    left: 0;
    width: 100%;
    flex-direction: column;
    background:  rgb(17, 17, 17);
  }

  .mega-submenu.show {
      display: flex;
  }
  
  .menu-container.open .mega-submenu {
      display: block;
      position: absolute;
      top: 50px;
      left: 0;
      width: 100%;
      background-color:  rgb(17, 17, 17);
      padding: 0px;
      display: flex;
      flex-direction: column;
      gap: 15px;
      z-index: 10;
  }

  .submenu-content {
    display: none;
    flex-direction: column;
    padding: 10px;
    background: #111;
    width: 100%;
  }

  .submenu-content.show {
    display: flex;
  }

  .mega-submenu.open .submenu-content {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: #111;
    width: 100%;
  }
}

/* จอขนาดกลาง (แท็บเล็ต) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .menu-container {
        display: flex;
        height: auto;
        justify-content: flex-start;
    }
    .menu-tabs {
        display: flex !important;
        flex-direction: row;
        position: static;
        width: auto;
        background: none;
        gap: 1px;
        padding: 0px 20px; /* ปรับ padding ให้เหมาะสม */
        margin-right: 30px; /* ปรับระยะห่างด้านล่างของเมนู */
    }

    .menu-tabs a {
        font-size: 10px; /* ปรับขนาดตัวอักษร */
    }

    .hamburger-menu {
        display: none;
    }
    .mega-submenu {
        position: absolute;
        top: 90%;
        left: 0;
        width: 100%;
        background-color:  rgb(17, 17, 17);
    }
    .mega-submenu.show {
        display: flex !important;
    }

    .submenu-content {
    display: none;
    flex-direction: column;
    background: #111;
    width: 100%;
    padding: 20px 0 20px 35px;
    font-size: 12px; 
  }

  .submenu-content.show {
    display: flex;
  }

    /* ปุ่ม ภาษา กับค้นหา */
    .top-right-menu {
        position: absolute;
        top: 0;
        right: 0;
        padding: 10px;
        gap: 2px;
        flex-direction: column;
        display: flex;
        align-items: center;
    }

    .search-button {
        padding: 2px 8px;
        font-size: 12px;
    }

    .language-button {
        padding: 2px 8px;
        font-size: 8px;
    }
}

/* ========== 1. Desktop ========== */
@media screen and (min-width: 1025px) {
  .menu-container {
        display: flex;
        justify-content: flex-start;
  }

    .menu-tabs {
        display: flex !important;
        flex-direction: row;
        position: static;
        width: auto;
        background: none;
        padding: 0px 50px; /* ปรับ padding ให้เหมาะสม */
        margin-right: 50px; /* ปรับระยะห่างด้านล่างของเมนู */
    }
    .mega-submenu {
        position: absolute;
        top: 90%;
        left: 0;
        width: 100%;
        display: none;
    }
    .mega-submenu.show {
        display: flex !important;
    }

    .submenu-content {
    display: none;
    flex-direction: column;
    background: #111;
    width: 100%;
    padding: 20px 0 20px 290px;
  }

  .submenu-content.show {
    display: flex;
  }

  /* ปุ่ม ภาษา กับค้นหา */
    .top-right-menu {
        position: absolute; 
        top: 5px;
        right: 50px;
        padding: 10px;
        gap: 2px;
        display: flex;
        align-items: center;
    }

  .search-button {
        padding: 2px 8px;
        font-size: 12px;
    }

    .language-button {
        padding: 2px 8px;
        font-size: 8px;
    }
}

/* ปรับ menu-tabs ให้ตัวหนังสือ ไม่หล่น */
@media screen and (min-width: 1025px) and (max-width: 1440px) {
  .menu-container {
        display: flex;
        justify-content: flex-start;
    }
    .menu-tabs {
        display: flex !important;
        flex-direction: row;
        position: static;
        width: auto;
        background: none;
        gap: 1px;
        padding: 0px 20px; /* ปรับ padding ให้เหมาะสม */
        margin-right: 30px; /* ปรับระยะห่างด้านล่างของเมนู */
    }

    .menu-tabs a {
        font-size: 10px; /* ปรับขนาดตัวอักษร */
    }

    .hamburger-menu {
        display: none;
    }
    .mega-submenu {
        position: absolute;
        top: 90%;
        left: 0;
        width: 100%;
        background-color:  rgb(17, 17, 17);
    }
    .mega-submenu.show {
        display: flex !important;
    }

    .submenu-content {
    display: none;
    flex-direction: column;
    background: #111;
    width: 100%;
    padding: 20px 0 20px 35px;
    font-size: 12px; 
  }

  .submenu-content.show {
    display: flex;
  }

  /* ปุ่ม ภาษา กับค้นหา */
    .top-right-menu {
        position: absolute; 
        top: 5px;
        right: 5px;
        padding: 10px;
        gap: 2px;
        display: flex;
        align-items: center;
    }

  .search-button {
        padding: 2px 8px;
        font-size: 12px;
    }

    .language-button {
        padding: 2px 8px;
        font-size: 8px;
    }

}

@media screen and (min-width: 1025px) and (max-width: 1090px) {
  /* ปุ่ม ภาษา กับค้นหา */
    .top-right-menu {
        position: absolute;
        top: 0;
        right: 0;
        padding: 10px;
        gap: 2px;
        flex-direction: column;
        display: flex;
        align-items: center;
    }

    .search-button {
        padding: 2px 8px;
        font-size: 8px;
    }
    .search-button i {
        font-size: 12px; 
    }

    .language-button {
        padding: 2px 8px;
        font-size: 8px;
    }
    .language-button i {
        font-size: 12px; 
    } 
}