/* hamburger-menu.css */
/* ปรับปรุงให้แสดงผลถูกต้องบนมือถือ */

/* ปุ่ม Hamburger */
.hamburger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 22px;
  cursor: pointer;
  z-index: 1002;
  position: relative;
}

.hamburger-menu span {
  display: block;
  height: 3px;
  width: 100%;
  background-color: #333;
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* เอฟเฟกต์ X เมื่อ active */
.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}
.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}
.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* แสดงเมนูสำหรับมือถือ */
@media screen and (max-width: 991px) {
  .hamburger-menu {
    display: flex !important;
    margin-left: auto; /* อยู่ชิดขวา */
  }

  .nav-item {
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: white;
    overflow-y: auto;
    z-index: 1001;
    display: none;
    padding: 20px 0;
  }

  .nav-item.active {
    display: block;
  }

  .nav-item ul {
    flex-direction: column;
    padding: 0;
  }

  .nav-item ul li {
    width: 100%;
    padding: 0;
    border-bottom: 1px solid #f0f0f0;
  }

  /* ลบขีดเส้นใต้ในเมนูย่อย */
  .dropdown-content a:after {
    display: none !important;
  }
  
  .dropdown-content a:hover:after {
    display: none !important;
  }

  /* ปรับ dropdown สำหรับมือถือ */
  .dropdown .dropdown-content {
    position: static;
    border: none;
    box-shadow: none;
    min-width: 100%;
    padding-left: 30px;
    display: none;
    opacity: 1;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  .dropdown.active .dropdown-content {
    display: block;
    max-height: 500px;
  }
  
  /* ลิงก์ใน dropdown เปลี่ยนสีเมื่อ hover เหมือน desktop */
  .dropdown-content a:hover {
    color: #1aaa55 !important;
    background-color: #f3f4f6;
  }
}

/* ================= Dropdown Menu ================= */

/* ค่าพื้นฐานซ่อน */
.dropdown .dropdown-content {
  display: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 220px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

/* ลบเอฟเฟกต์ขีดล่างสำหรับเมนู dropdown ทั้งหมด */
.dropdown .nav-link:after {
  display: none !important;
}

/* ลิงก์เมนูย่อย - ลบขีดล่าง */
.dropdown .dropdown-content a {
  display: block;
  padding: 10px 15px;
  color: #333;
  font-size: 15px;
  white-space: nowrap;
  position: relative;
  transition: all 0.2s ease;
}

/* ลบเอฟเฟกต์ขีดล่างสำหรับเมนูย่อย */
.dropdown .dropdown-content a:after {
  display: none !important;
}

.dropdown .dropdown-content a:hover:after {
  display: none !important;
}

.dropdown .dropdown-content a:hover {
  background: #f3f4f6;
  color: #1aaa55 !important;
}

/* Desktop Hover */
@media (min-width: 992px) {
  .dropdown:hover .dropdown-content {
    display: block;
    opacity: 1;
    transform: translateY(0);
  }
  
  /* ลบขีดเส้นใต้เมื่อ hover เมนูหลักที่มี dropdown */
  .dropdown:hover .nav-link:after {
    display: none !important;
  }
}

/* Mobile Toggle */
@media (max-width: 991px) {
  .dropdown {
    width: 100%;
  }
  
  .dropdown .dropdown-toggle:after {
    content: '▼';
    font-size: 10px;
    margin-left: 8px;
    display: inline-block;
    transition: transform 0.3s ease;
  }
  
  .dropdown.active .dropdown-toggle:after {
    content: '▼';
    transform: rotate(180deg);
  }
  
  .dropdown .dropdown-content {
    position: static;
    border: none;
    box-shadow: none;
    min-width: 100%;
    padding-left: 30px;
    display: none;
    opacity: 1;
    transform: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  
  .dropdown.active .dropdown-content {
    display: block;
    max-height: 500px;
  }
  
  /* ลิงก์ใน dropdown เปลี่ยนสีเมื่อ hover เหมือน desktop */
  .dropdown-content a:hover {
    color: #1aaa55 !important;
    background-color: #f3f4f6;
  }
}