/* --- [2] CSS STYLES --- */
:root {
  --primary-color: #c28559;
  --text-color: #ffffff;
  --font-main: "Kanit", sans-serif;
  --font-serif: "Playfair Display", serif;
  --nav-height: 90px;
  --nav-scrolled-height: 70px;
  --transition-speed: 0.4s;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  overflow-x: hidden;
}

/* Navbar Container */
.luxury-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--nav-height);
  z-index: 1000;
  background-color: transparent;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  /* Padding ซ้ายขวา เพื่อกันไม่ให้ตัวหนังสือชิดขอบจอเกินไป */
  padding: 0 40px;
  box-sizing: border-box;
  justify-content: center;
  /* จัดแกนกลาง */
}

.luxury-nav.scrolled {
  background-color: var(--primary-color);
  height: var(--nav-scrolled-height);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Logo Area (Center) */
.nav-logo {
  /* Fix ขนาดโลโก้ให้แน่นอน เพื่อเป็นแกนกลาง */
  width: 160px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  /* ห้ามย่อขยาย */
  z-index: 10;
}

.nav-logo img {
  height: 65px;
  width: auto;
  transition: all var(--transition-speed);
}

.luxury-nav.scrolled .nav-logo img {
  /* height: 50px; */
}

/* Menu Groups Wrapper */
/* เราจะสร้าง Grid จำลองขึ้นมา ซ้ายและขวาต้องมีขนาดเท่ากันเป๊ะๆ (Flex 1) */
.nav-menu-group {
  flex: 1;
  /* ยืดให้เต็มพื้นที่ที่เหลือ */
  display: grid;
  height: 100%;
  align-items: center;
}

/* --- [THE MAGIC LOGIC] --- */
/* กำหนดให้ทั้งสองฝั่งมี 4 ช่องเท่ากันเป๊ะ (Repeat 4, 1fr) */

.nav-menu-group.left {
  /* 4 เมนู ใส่ 4 ช่อง */
  grid-template-columns: repeat(4, 1fr);
  padding-right: 20px;
  /* เว้นระยะห่างจากโลโก้นิดหน่อย */
}

.nav-menu-group.right {
  /* มี 3 เมนู แต่เราสร้าง 4 ช่อง เพื่อให้ขนาดช่องเท่ากับฝั่งซ้าย! */
  grid-template-columns: repeat(4, 1fr);
  padding-left: 20px;
  /* เว้นระยะห่างจากโลโก้นิดหน่อย */
}

/* Link Styles */
.nav-link,
.has-dropdown {
  display: flex;
  justify-content: center;
  /* จัดกึ่งกลางช่องของตัวเอง */
  align-items: center;
  width: 100%;
  height: 100%;

  text-decoration: none;
  color: var(--text-color) !important;
  font-family: var(--font-serif);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  position: relative;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.nav-link:hover {
  /* opacity: 0.8; */
}

/* Underline Effect */
.nav-link::after {
  content: "";
  position: absolute;
  width: 0;
  height: 1px;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #fff;
  transition: width 0.3s;
}

.luxury-nav.scrolled .nav-link::after {
  bottom: 20px;
}

.nav-link:hover::after {
  width: 50%;
}

/* Action Group (Book Now) */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  /* ใช้ Position Absolute ยึดกับขอบขวาของจอ */
  position: absolute;
  right: 40px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 20;
  height: 100%;
}

.lang-switch a {
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.85rem;
  opacity: 0.7;
  transition: 0.3s;
  font-family: var(--font-main);
}

.lang-switch a.active,
.lang-switch a:hover {
  opacity: 1;
  font-weight: 500;
}

.btn-book-now {
  background-color: transparent;
  color: var(--text-color);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 10px 20px;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-book-now:hover {
  background-color: #fff;
  color: var(--primary-color);
  border-color: #fff;
}

/* Dropdown Logic */
.has-dropdown {
  position: relative;
  cursor: pointer;
  /* เพิ่ม height 100% เพื่อให้พื้นที่ Hover ครอบคลุมตั้งแต่บนสุดถึงล่างสุดของเมนูบาร์ */
  height: 100%;
  display: flex;
  align-items: center;
}

.luxury-dropdown {
  position: absolute;
  top: 80%;
  /* ตำแหน่งที่จะเริ่มแสดง */
  left: 50%;
  transform: translateX(-50%) translateY(20px);

  background-color: rgba(255, 255, 255, 0.98);
  min-width: 240px;
  padding: 15px 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);

  /* Animation States */
  opacity: 0;
  visibility: hidden;
  display: block;
  /* สำคัญ: บังคับให้แสดงผลเป็นบล็อก เพื่อไม่ให้หายไป */

  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  list-style: none;
  border-radius: 2px;
  text-align: left;
  z-index: 100;
}

.dropdown-menu {
  position: absolute;
  top: 80%;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(255, 255, 255, 0.98);
  min-width: 240px;
  padding: 15px 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  list-style: none;
  border-radius: 2px;
  text-align: left;
  z-index: 100;
}

.has-dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.has-dropdown:hover .luxury-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.luxury-dropdown li a {
  display: block;
  padding: 12px 25px;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--font-main);
  transition: 0.2s;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);

  /* Reset ค่าที่อาจติดมาจาก nav-link หลัก */
  height: auto;
  width: auto;
  justify-content: flex-start;
}

.dropdown-menu li a {
  display: block;
  padding: 12px 25px;
  color: #555;
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--font-main);
  transition: 0.2s;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  flex: unset;
  justify-content: flex-start;
}

.dropdown-menu li:last-child a {
  border-bottom: none;
}

.luxury-dropdown li a:hover {
  background-color: #f9f9f9;
  color: var(--primary-color);
  padding-left: 30px;
}

.luxury-dropdown li a::after {
  display: none;
}

/* Mobile Logic */
.mobile-toggle-btn {
  display: none;
  width: 48px;
  /* พื้นที่กดสัมผัสกว้างขึ้น */
  height: 48px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1001;
  padding: 0;

  /* จัดกึ่งกลางเส้นภายใน */
  position: absolute;
  left: 20px;
  align-items: center;
  justify-content: center;
}

/* เส้นเมนู */
.mobile-toggle-btn span {
  display: block;
  width: 24px;
  /* ความยาวเส้น */
  height: 2px;
  /* ความหนาเส้น */
  background-color: #fff;
  position: absolute;
  transition: all 0.3s ease-in-out;
  border-radius: 2px;
}

/* สถานะปกติ (3 ขีด) */
.mobile-toggle-btn span:nth-child(1) {
  transform: translateY(-7px);
}

.mobile-toggle-btn span:nth-child(2) {
  opacity: 1;
}

.mobile-toggle-btn span:nth-child(3) {
  transform: translateY(7px);
}

/* สถานะ Active (กากบาท X) - สมมาตรเป๊ะ */
.mobile-toggle-btn.active span:nth-child(1) {
  transform: rotate(45deg);
}

.mobile-toggle-btn.active span:nth-child(2) {
  opacity: 0;
}

.mobile-toggle-btn.active span:nth-child(3) {
  transform: rotate(-45deg);
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(194, 133, 89, 0.98);
  /* สีธีม */
  z-index: 999;
  padding-top: 100px;
  padding-bottom: 40px;

  /* [แก้] เปลี่ยนจาก align-items: center เป็น flex-start */
  display: flex;
  flex-direction: column;
  align-items: flex-start;

  /* [แก้] เว้นระยะจากขอบซ้าย ไม่ให้ชิดจอเกินไป */
  padding-left: 40px;
  padding-right: 20px;

  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
}

.mobile-menu-overlay.open {
  transform: translateY(0);
}

/* 2. ลิงก์เมนูหลัก - ปรับตัวหนังสือให้เล็กลง */
.mobile-nav-link {
  font-family: var(--font-serif);

  /* [แก้] ปรับขนาดตัวอักษรให้เล็กลง (จาก 1.6rem เหลือ 1.2rem) */
  font-size: 1.2rem;

  color: #fff;
  text-decoration: none;
  margin: 8px 0;
  /* ลดระยะห่างบรรทัดนิดหน่อย */
  width: 100%;
  /* ให้กินพื้นที่เต็มความกว้างเพื่อจัด text-align ได้ */
  text-align: left;
  /* บังคับชิดซ้าย */

  opacity: 0;
  transform: translateY(20px);
  transition: 0.4s;
}

.mobile-menu-overlay.open .mobile-nav-link {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(1) {
  transition-delay: 0.1s;
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(2) {
  transition-delay: 0.2s;
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(3) {
  transition-delay: 0.3s;
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(4) {
  transition-delay: 0.4s;
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(5) {
  transition-delay: 0.5s;
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(6) {
  transition-delay: 0.6s;
}

.mobile-menu-overlay.open .mobile-nav-link:nth-child(7) {
  transition-delay: 0.7s;
}

.mobile-submenu {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  /* จัดรายการย่อยชิดซ้าย */
  width: 100%;
  margin-bottom: 5px;

  /* [แก้] เขยิบเนื้อหา Villa มาทางขวา (Indentation) */
  padding-left: 25px;
  box-sizing: border-box;
}

.mobile-submenu a {
  /* [แก้] ปรับขนาดตัวอักษรให้เท่ากับเมนูหลัก หรือเล็กกว่านิดเดียวตามดีไซน์ */
  font-size: 1.1rem;

  margin: 6px 0;
  opacity: 0.8;
  /* ลดความเข้มลงนิดหน่อยให้ดูเป็นลูก */
  font-family: var(--font-main);
  font-weight: 300;
  color: #fff;
  text-decoration: none;
}

/* 4. Language Switcher - จัดชิดซ้าย */
.mobile-lang-group {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 15px;

  /* จัดตำแหน่ง */
  justify-content: flex-start;
  width: 100%;

  opacity: 0;
  transform: translateY(20px);
  transition: 0.4s;
  transition-delay: 0.6s;
}

.mobile-lang-link {
  font-family: var(--font-main);
  /* ใช้ Kanit เหมือน Desktop */
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  letter-spacing: 1px;
  font-weight: 300;
  transition: 0.3s;
}

.mobile-lang-link.active {
  color: #fff;
  font-weight: 500;
  border-bottom: 1px solid #fff;
  /* ขีดเส้นใต้เล็กๆ ให้รู้ว่าเลือกอยู่ */
}

.mobile-lang-sep {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 100;
}

.mobile-book-btn {
  margin-top: 25px;
  padding: 10px 30px; /* ปรับขนาดปุ่มให้พอดี */
  background: transparent;
  border: 1px solid #fff;
  color: #fff;

  font-family: var(--font-main);
  font-size: 0.9rem; /* ตัวอักษรปุ่ม */
  text-transform: uppercase;
  letter-spacing: 2px;
  text-decoration: none;

  /* ไม่ให้ปุ่มยืดเต็มจอ ให้กว้างตามเนื้อหา */
  align-self: flex-start;

  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  transition-delay: 0.7s;
}

.mobile-menu-overlay.open .mobile-book-btn {
  opacity: 1;
  transform: translateY(0);
}

.mobile-book-btn:hover {
  background-color: #fff;
  color: var(--primary-color);
}

.mobile-menu-overlay.open .mobile-lang-group {
  opacity: 1;
  transform: translateY(0);
}

/* --- ปรับ Grid ฝั่งขวาใหม่ให้รองรับปุ่ม --- */
.nav-menu-group.right {
  /* เปลี่ยนจาก repeat 4 ช่องเท่ากัน เป็น auto เพื่อให้ปุ่มขวาสุดกินที่ตามจริง */
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 15px;
  /* เพิ่มระยะห่างระหว่างเมนู */
  padding-left: 30px;
}

/* --- Container ของปุ่มขวาสุด (ภาษา + Book Now) --- */
.nav-actions-inline {
  display: flex;
  flex-direction: column;
  /* เปลี่ยนเป็นแนวตั้ง */
  justify-content: center;
  /* จัดกึ่งกลางแนวตั้ง */
  align-items: stretch;
  /* สั่งให้ลูกขยายความกว้างเต็มพื้นที่ (เท่ากัน) */
  gap: 6px;
  /* ระยะห่างระหว่างปุ่มภาษา กับ ปุ่ม Book Now */
  height: 100%;
  min-width: 140px;
  /* กำหนดความกว้างรวมของทั้งก้อนให้พอดี */
}

/* --- ดีไซน์ปุ่มภาษาใหม่ (Luxury Minimal) --- */
.lang-switch-modern {
  display: grid;
  /* ใช้ Grid เพื่อแบ่งช่องซ้ายขวาเท่ากันเป๊ะ */
  grid-template-columns: 1fr 1fr;
  /* แบ่ง 2 ช่องเท่ากัน */
  align-items: center;
  text-align: center;

  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);

  /* ปรับขนาดให้กระชับลงเพื่อให้วางซ้อนกันได้ */
  padding: 2px 0;
  width: 100%;
  /* กว้างเต็มพื้นที่ */
  transition: all 0.3s ease;
}

.luxury-nav.scrolled .lang-switch-modern {
  border-color: rgba(255, 255, 255, 0.4);
}

.lang-switch-modern a {
  text-decoration: none;
  font-family: var(--font-main);
  font-size: 0.75rem;
  /* ลดขนาดลงเล็กน้อยเพื่อให้ดูหรู */
  color: rgba(255, 255, 255, 0.6);
  transition: 0.3s;
  font-weight: 300;
  display: block;
  /* ให้พื้นที่คลิกเต็มช่อง */
  line-height: 1.2;
}

/* สถานะ Active */
.lang-switch-modern a.active {
  color: var(--primary-color);
  background-color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lang-switch-modern a:hover:not(.active) {
  color: #fff;
}

.btn-book-now {
  display: flex;
  justify-content: center;
  align-items: center;

  width: 100%;
  /* กว้างเต็มพื้นที่ (เท่ากับตัวบน) */
  height: 34px;
  /* กำหนดความสูงให้แน่นอนและไม่สูงเกินไป */
  padding: 0;
  /* เอา padding ออก เพราะเราใช้ width 100% จัดกลางแทน */

  background-color: transparent;
  color: var(--text-color);
  border: 1px solid rgba(255, 255, 255, 0.6);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-book-now:hover {
  background-color: #fff;
  color: var(--primary-color);
  border-color: #fff;
}

/* Responsive */
/* Responsive */
@media (max-width: 1250px) {
  .nav-menu-group,
  .nav-actions {
    display: none;
  }

  .mobile-toggle-btn {
    display: flex;
  }

  .nav-logo {
    flex: unset;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }

  .mobile-toggle-btn {
    position: absolute;
    left: 20px;
  }

  /* --- [แก้ไข] บังคับให้ Luxury Nav แสดงผลเหมือน Scrolled ตลอดเวลา --- */
  .luxury-nav {
    justify-content: center;
    padding: 0 20px;

    /* ใส่คุณสมบัติของ .scrolled ลงไปตรงนี้เลย */
    background-color: var(--primary-color);
    height: var(--nav-scrolled-height);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  }
}
