/* HEADER MAIN LAYOUT*/
.main-header {
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.03);
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  height: 72px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

/* Logo */
.logo-section {
  display: flex;
  align-items: center;
  text-decoration: none;
  z-index: 1001;
  flex-shrink: 0;
}

.brand-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #0d5c2e, #10b981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Right Section Actions */
.header-right-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Nav Menu (Desktop) */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-right: 12px;
}

.nav-tab {
  text-decoration: none;
  color: #1e293b;
  font-size: 15px;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.nav-tab::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 100%;
  height: 2.5px;
  border-radius: 10px;
  background-color: #0d5c2e;
  transition: transform 0.25s ease;
}

.nav-tab:hover::after,
.nav-tab.active::after {
  transform: translateX(-50%) scaleX(1);
}

.nav-tab:hover,
.nav-tab.active {
  color: #0d5c2e;
  font-weight: 600;
}

/* ซ่อนเมนูไอคอนบน Mobile เมื่ออยู่บน Desktop */
.mobile-nav-icons {
  display: none;
}

/* Desktop Action Icons */
.desktop-action-icons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: #eef7f2;
  color: #0d5c2e;
  transform: translateY(-2px);
}

.cart-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background-color: #ff2b56;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
}

/* Sliding Search Overlay */
.search-overlay-bar {
  width: 100%;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  padding: 16px 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.search-overlay-bar.active {
  max-height: 350px;
  opacity: 1;
  padding: 16px 0 24px 0;
}

.search-overlay-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.search-input-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #f4f5f7;
  border: 1px solid #e2e8f0;
  border-radius: 50px;
  padding: 10px 20px;
  gap: 12px;
  transition: all 0.25s ease;
}

.search-input-box:focus-within {
  background: #ffffff;
  border-color: #0d5c2e;
  box-shadow: 0 0 0 4px rgba(13, 92, 46, 0.08);
}

.search-icon {
  color: #64748b;
  flex-shrink: 0;
}

.search-input-box input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: #1e293b;
  font-family: inherit;
}

.search-input-box input::placeholder {
  color: #94a3b8;
}

.search-close-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.search-close-btn:hover {
  color: #0d5c2e;
}

.search-results-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px;
}

.search-results-dropdown {
  margin-top: 12px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #f1f5f9;
  max-height: 0;
  overflow: hidden;
  transition: all 0.25s ease;
}

.search-results-dropdown.active {
  max-height: 250px;
  overflow-y: auto;
}

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  text-decoration: none;
  color: #1e293b;
  font-size: 14px;
  border-bottom: 1px solid #f8faf8;
  transition: background 0.2s ease;
}

.search-item:hover {
  background: #eef7f2;
}

.item-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 50px;
  font-weight: 500;
}

.item-badge.product {
  background: #e0f2fe;
  color: #0284c7;
}

.item-badge.category {
  background: #dcfce7;
  color: #15803d;
}

.search-no-result {
  padding: 16px;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
}

/* Hamburger Btn */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.hamburger-btn span {
  width: 100%;
  height: 2px;
  background-color: #0d5c2e;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* MOBILE RESPONSIVE*/
@media (max-width: 768px) {
  .header-container {
    padding: 0 16px;
    height: 64px;
  }

  .brand-name {
    font-size: 20px;
  }

  /* ซ่อนชุดไอคอนนอกเมนูบน Mobile */
  .desktop-action-icons {
    display: none !important;
  }

  .hamburger-btn {
    display: flex;
    margin-left: 4px;
  }

  .hamburger-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .hamburger-btn.active span:nth-child(2) {
    opacity: 0;
  }
  .hamburger-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* เมนูเบอร์เกอร์พับลงมา */
  .nav-menu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    width: 100% !important;
    background-color: #ffffff !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 12px 20px 20px 20px !important;
    gap: 0 !important;
    margin-right: 0 !important;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s ease-in-out;
  }

  .nav-menu.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
  }

  .nav-tab {
    font-size: 15px;
    width: 100% !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid #f1f5f9;
    display: block !important;
  }

  .nav-tab::after {
    display: none !important;
  }

  /* แสดงกลุ่มไอคอนด้านในเมนูเบอร์เกอร์ */
  .mobile-nav-icons {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
  }

  .mobile-icon-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #1e293b;
    font-size: 15px;
    font-weight: 500;
    background: #f8faf8;
    transition: background 0.2s ease;
  }

  .mobile-icon-link:active {
    background: #eef7f2;
    color: #0d5c2e;
  }

  .icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .search-overlay-container {
    padding: 0 16px;
  }
}