@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@100;200;300;400;500;600;700&family=Noto+Serif+Thai:wght@100..900&display=swap');

* {
   font-family: "Noto Serif Thai", serif;
   padding: 0;
   margin: 0;
   box-sizing: border-box;
}


/* ส่วน logo, ค้นหา, iconbasket, iconuser */

body {
   padding-top: 175px;
}


.search-bar-sticky {
   display: flex;
   justify-content: center;
   align-items: center;
   position: fixed;
   width: 100%;
   top: 0;
   background: #fff;
   z-index: 999;
   transition: all 0.3s ease;
}

/* ตอน scroll ลง ให้มีเงา */
.search-bar-sticky.scrolled {
   box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}


.logo-shop {
   display: flex;
   align-items: center;
   justify-content: space-between;
   width: 100%;
   height: 75px;
   margin: 0 100px;
}

.logo {
   a {
      text-decoration: none;
      font-size: 1.5rem;
      font-weight: bold;
      color: black;
   }
}

.icon-search {
   flex: 1;
   display: flex;
   justify-content: center;
}

.group-icon-search {
   input {
      border: 1px solid #e0e0e0;
      border-radius: 20px;
      font-size: 16px;
      outline: none;
      width: 100%;
      height: 50px;
      padding-left: 20px;
   }
}

.user-menu-container {
   position: relative;
   display: flex;
   align-items: center;
}



.icon-user {
   cursor: pointer;
   padding: 0 22px;
}

.dropdown-menu {
   display: none;
   position: absolute;
   top: 40px;
   right: 0;
   background-color: white;
   border: 1px solid #ccc;
   border-radius: 6px;
   box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
   min-width: 160px;
   z-index: 1000;
}

.dropdown-menu a {
   display: block;
   padding: 10px;
   text-decoration: none;
   color: #333;
}

.dropdown-menu a:hover {
   background-color: #f0f0f0;
}


.login-register-buttons {
   display: flex;
}

.header-login-if {
   margin-right: 15px;
   padding: 5px 10px;
   border: 1px solid #3366CC;
   border-radius: 5px;
   display: flex;
   align-items: center;

   a {
      color: #3366CC !important;
      text-decoration: none;
   }

}


.header-login-if:hover,
.header-login-if:hover a {
   background-color: #3366CC !important;
   color: white !important;
}

.header-register-if {
   padding: 7px 10px;
   border: 1px solid #3366CC;
   border-radius: 5px;
   background-color: #3668cc;
   display: flex;
   align-items: center;

   a {
      color: #ffffff !important;
      text-decoration: none;
      font-size: 13px;
   }

}

.header-register-if:hover,
.header-register-if:hover a {
   background-color: #1c56c9 !important;
   color: white !important;
}

/* ส่วน menu และประเภทสินค้า */
.main-nav {
   position: fixed;
   top: 75px;
   width: 100%;
   transition: top 0.8s ease;
   z-index: 998;
   box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
   background-color: #ffffff;
}

.type {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 15px 85px 15px 85px;
}

.category-dropdown-content {
   display: none;
   position: absolute;
   background: #fff;
   border: 1px solid #ddd;
   box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
   z-index: 999;
}

.category-dropdown-content a:hover {
   color: red;
}

.category-dropdown-container.show .category-dropdown-content {
   display: block;
}

.category-dropdown-container {
   position: relative;
   display: inline-block;
}

.category-dropdown-content {
   display: none;
   position: absolute;
   top: 100%;
   left: 0;
   background: #fff;
   border: 1px solid #ddd;
   box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
   min-width: 200px;
   z-index: 999;
}


.category-dropdown-container.show .category-dropdown-content {
   display: block;
}

.category-button {
   background-color: #f0f2f5;
   color: #333;
   padding: 12px 20px;
   font-size: 16px;
   font-weight: 600;
   border: none;
   cursor: pointer;
   border-radius: 8px;
   display: flex;
   align-items: center;
   gap: 10px;
   transition: background-color 0.3s ease;
   min-width: 200px;
   justify-content: space-between;
}

.category-button:hover {
   background-color: #e0e2e5;
}

.category-icon {
   display: flex;
   align-items: center;
}

.category-icon svg {
   color: #333;
}

.category-arrow {
   display: flex;
   align-items: center;
}

.category-arrow svg {
   color: #666;
}

.category-dropdown-content {
   display: none;
   position: absolute;
   background-color: #f9f9f9;
   min-width: 200px;
   box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
   border-radius: 8px;
   margin-top: 5px;
   left: 0;
}

.category-dropdown-content a {
   color: black;
   padding: 12px 16px;
   text-decoration: none;
   display: block;
   transition: background-color 0.3s ease;
}

.category-dropdown-content a:hover {
   background-color: #ddd;
   border-radius: 8px;
}

.category-dropdown-container.show .category-dropdown-content {
   display: block;
}

.menu {
   display: flex;

   a {
      font-size: 16px;
   }
}

.menu li {
   border-radius: 5px;
   transition: background-color 0.3s ease;
   list-style: none;
}


.menu li.active a {
   color: rgb(255, 0, 0);
}

.menu li:hover:not(.active) {
   background-color: none;
}

.menu li a {
   text-decoration: none;
   padding: 10px 20px;
   display: block;
   color: black;
   transition: color 0.3s;
}

.menu li a:hover {
   color: red;
}

.icon-basket {
   position: relative;
}

.basket-count {
   position: absolute;
   top: -8px;
   right: -8px;
   background: red;
   color: white;
   font-size: 12px;
   font-weight: bold;
   padding: 2px 6px;
   border-radius: 50%;
   box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.group-icon-search {
   position: relative;
   /* เพื่อให้ ul position absolute อิง input */
}

#searchInputHeader {
   width: 850px;
   /* ปรับตามต้องการ */
   padding: 10px;
   padding-left: 20px;
   box-sizing: border-box;
}

.search-results {
   position: absolute;
   top: 100%;
   left: 0;
   width: 100%;
   background: #fff;
   list-style: none;
   padding: 0;
   margin: 0;
   max-height: 200px;
   overflow-y: auto;
   z-index: 1000;
   margin-top: 5px;
   background-color: #ffffff;
   border: none;
   border-radius: 5px;
}

.search-results li {
   padding: 8px 10px;
   cursor: pointer;
   color: #000;
}

.search-results li:hover {
   background-color: #eeeeee;
   color: red;
   border-radius: 3px;
}

/* Hamburger Menu CSS */
.ham-menu {
   display: inline-block;
   cursor: pointer;
}

.bar1,
.bar2,
.bar3 {
   width: 35px;
   height: 5px;
   background-color: #ffffff;
   margin: 6px 0;
   transition: 0.4s;
}

.change .bar1 {
   transform: translate(0, 11px) rotate(-45deg);
}

.change .bar2 {
   opacity: 0;
}

.change .bar3 {
   transform: translate(0, -11px) rotate(45deg);
}

/* มือถือ */
@media (max-width: 500px) {

   body {
      padding-top: 150px;
   }

   .logo-shop {
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0;
      gap: 40px;
      padding: 0 10px;
   }

   .header-register-if {
      display: none;
   }

   .icon-search {
      display: none;
   }

   .icon-user {
      display: none;
   }

   /* ส่วน MenuHame */
   .type {
      display: none;

   }

   .category-button {
      display: none;
   }

   .menu-active {
      display: block;
   }

   .main-nav {
      display: flex;
      height: auto;
      padding: 0.5rem 1rem;
      background-color: #333;
      justify-content: space-between;
   }

   .typemenu-active {
      display: flex;
      align-items: center;
      width: 100%;
   }

   .con-menu {
      width: 100%;
   }

   .menu {
      display: flex;
      flex-direction: column;
      justify-content: right;
      padding: 10px 0;

      li {
         border-radius: 0;

         a {
            color: white;
            padding-left: 0;
         }
      }
   }

   .menu li.active a {
      color: rgb(255, 255, 255);
   }

   .menu li a:hover {
      color: rgb(141, 141, 141);
   }

   .logoutHam hr {
      color: white;
   }
}

/* ใฟ้แฮมเบอร์เกอรหายไป */
@media only screen and (min-width: 780px) {
   .ham-menu {
      display: none;
   }

   .profileHam {
      display: none;
   }

   .logoutHam {
      display: none;
   }


}

/* แท็บเล็ต */
@media only screen and (min-width: 500px) and (max-width: 780px) {

   body {
      padding-top: 150px;
   }

   .logo-shop {
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0;
      gap: 80px;
      padding: 0 10px;
   }

   .icon-search {
      display: none;
   }

   .icon-user {
      display: none;
   }

   /* ส่วน MenuHame */
   .type {
      display: none;

   }

   .category-button {
      display: none;
   }

   .menu-active {
      display: block;
   }

   .main-nav {
      display: flex;
      height: auto;
      padding: 0.5rem 1rem;
      background-color: #333;
      justify-content: space-between;
   }

   .typemenu-active {
      display: flex;
      align-items: center;
      width: 100%;
   }

   .con-menu {
      width: 100%;
   }

   .menu {
      display: flex;
      flex-direction: column;
      justify-content: right;
      padding: 10px 0;

      li {
         border-radius: 0;

         a {
            color: white;
            padding-left: 0;
         }
      }
   }

   .menu li.active a {
      color: rgb(255, 255, 255);
   }

   .menu li a:hover {
      color: rgb(141, 141, 141);
   }

   .logoutHam hr {
      color: white;
   }



}

/* เดสก์ท็อปกลาง */
@media (min-width: 769px) and (max-width: 1199px) {
   .logo-shop {
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0;
      gap: 100px;
   }

   .icon-search {
      display: none;
   }
}

/* เดสก์ท็อปใหญ่ */
@media only screen and (min-width: 1200px) and (max-width: 1500px) {

   .logo-shop {
      padding: 0 50px;
      margin: 0;
   }

   .logo {
      min-width: 190px;

      a {
         font-size: 1.4rem;
      }
   }

   .icon-search {
      width: auto;
   }

   .group-icon-search {
      input {
         max-width: 700px;
      }
   }

   .user-menu-container {
      width: auto;
   }


}