/* BK91 - Product Category Menu */
.daw-pcm {
  --daw-pcm-accent: #f47a00 !important;
  --daw-pcm-accent-dark: #bf4e0a;
  --daw-pcm-accent-soft: #fff3e8;
  --daw-pcm-brown: #35170c;
  --daw-pcm-text: #252525;
  --daw-pcm-muted: #77736f;
  --daw-pcm-border: #e9e2dc;
  --daw-pcm-surface: #ffffff;
  --daw-pcm-soft: #faf8f6;
  --daw-pcm-shadow: 0 18px 45px rgba(53, 23, 12, 0.16);

  position: relative;
  z-index: 9999;
  width: 100%;
  max-width: 300px;
  margin: 0;
  color: var(--daw-pcm-text);
  font-family: inherit;
  line-height: 1.4;
}

.daw-pcm *,
.daw-pcm *::before,
.daw-pcm *::after {
  box-sizing: border-box;
}

.daw-pcm button,
.daw-pcm input {
  font-family: inherit;
}

/* Nút mở menu */
.daw-pcm__toggle {
  position: relative;
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 7px 12px 7px 8px;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 15px rgba(174, 70, 0, 0.2);
  overflow: hidden;
  text-align: left;
  text-transform: none;
  transition:
    box-shadow 0.2s ease,
    filter 0.2s ease,
    transform 0.2s ease;
}

.daw-pcm__toggle::after {
  content: "";
  position: absolute;
  right: -24px;
  bottom: -38px;
  width: 105px;
  height: 105px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  pointer-events: none;
}

.daw-pcm__toggle:hover,
.daw-pcm__toggle:focus-visible {
  filter: brightness(1.035);
  box-shadow: 0 7px 19px rgba(174, 70, 0, 0.27);
  transform: translateY(-1px);
  outline: none;
}

.daw-pcm__toggle-icon {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  background: rgba(66, 24, 4, 0.17);
}

.daw-pcm__toggle-icon svg {
  width: 21px;
  height: 21px;
}

.daw-pcm__toggle-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
}

.daw-pcm__toggle-copy strong {
  overflow: hidden;
  max-width: 100%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.daw-pcm__toggle-copy small {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
  display: none;
}

.daw-pcm__toggle-arrow {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.23);
  border-radius: 50%;
  background: rgba(68, 24, 3, 0.13);
  transition: transform 0.2s ease;
}

.daw-pcm__toggle-arrow svg {
  width: 16px;
  height: 16px;
}

.daw-pcm.is-open .daw-pcm__toggle-arrow {
  transform: rotate(180deg);
}

/* Khung menu */
.daw-pcm__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: max-content;
  min-width: 300px;
  max-width: calc(100vw - 28px);
  overflow: hidden;
  border: 1px solid var(--daw-pcm-border);
  border-top: 3px solid var(--daw-pcm-accent);
  border-radius: 6px;
  background: var(--daw-pcm-surface);
  box-shadow: var(--daw-pcm-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(7px);
  transform-origin: top left;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease,
    visibility 0.18s ease;
}

.daw-pcm.is-right .daw-pcm__dropdown {
  right: 0;
  left: auto;
  transform-origin: top right;
}

.daw-pcm.is-open .daw-pcm__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* Tìm kiếm */
.daw-pcm__search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--daw-pcm-border);
  background: #fff;
}

.daw-pcm__search-wrap > svg {
  position: absolute;
  left: 26px;
  z-index: 1;
  width: 18px;
  height: 18px;
  color: #9b918a;
  pointer-events: none;
  display: none;
}

.daw-pcm__search {
  width: min(560px, 72vw);
  min-width: 274px;
  height: 42px;
  margin: 0;
  padding: 0 42px 0 40px;
  border: 1px solid #dfd7d0;
  border-radius: 4px;
  background: var(--daw-pcm-soft);
  color: var(--daw-pcm-text);
  font-size: 13px;
  font-weight: 400;
  outline: none;
  box-shadow: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.daw-pcm__search::placeholder {
  color: #9b918a;
}

.daw-pcm__search:focus {
  border-color: var(--daw-pcm-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(244, 122, 0, 0.11);
}

.daw-pcm__search-clear {
  position: absolute;
  right: 21px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eee8e3;
  color: #776c65;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.15s ease,
    background 0.15s ease;
}

.daw-pcm__search-clear.is-visible {
  opacity: 1;
  visibility: visible;
}

.daw-pcm__search-clear:hover {
  background: #e3dbd5;
}

/* Các cấp danh mục */
.daw-pcm__columns {
  display: flex;
  align-items: stretch;
  max-width: calc(100vw - 28px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #d8cec6 #f7f3f0;
  scrollbar-width: thin;
}

.daw-pcm__column {
  width: 280px;
  min-width: 280px;
  max-height: min(68vh, 620px);
  overflow-y: auto;
  background: #fff;
  scrollbar-color: #d8cec6 #f7f3f0;
  scrollbar-width: thin;
}

.daw-pcm__column + .daw-pcm__column {
  border-left: 1px solid var(--daw-pcm-border);
  background: #fcfbfa;
}

.daw-pcm__columns::-webkit-scrollbar,
.daw-pcm__column::-webkit-scrollbar,
.daw-pcm__search-results::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

.daw-pcm__columns::-webkit-scrollbar-track,
.daw-pcm__column::-webkit-scrollbar-track,
.daw-pcm__search-results::-webkit-scrollbar-track {
  background: #f7f3f0;
}

.daw-pcm__columns::-webkit-scrollbar-thumb,
.daw-pcm__column::-webkit-scrollbar-thumb,
.daw-pcm__search-results::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #d8cec6;
}

.daw-pcm__column-head {
  position: sticky;
  top: 0;
  z-index: 3;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--daw-pcm-border);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 2px 5px rgba(53, 23, 12, 0.035);
  backdrop-filter: blur(8px);
}

.daw-pcm__column-head > strong {
  position: relative;
  padding-left: 11px;
  color: var(--daw-pcm-brown);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.daw-pcm__column-head > strong::before {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 3px;
  border-radius: 3px;
  background: var(--daw-pcm-accent);
}

.daw-pcm__column-title {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.daw-pcm__column-title strong {
  overflow: hidden;
  color: var(--daw-pcm-brown);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daw-pcm__column-title a {
  margin-top: 2px;
  overflow: hidden;
  color: var(--daw-pcm-accent-dark);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daw-pcm__column-title a:hover {
  color: var(--daw-pcm-accent);
}

.daw-pcm__back {
  display: none;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--daw-pcm-border);
  border-radius: 4px;
  background: #fff;
  color: var(--daw-pcm-brown);
  cursor: pointer;
}

.daw-pcm__back:hover {
  border-color: var(--daw-pcm-accent);
  color: var(--daw-pcm-accent);
}

.daw-pcm__back svg {
  width: 17px;
  height: 17px;
}

/* Danh sách */
.daw-pcm__list,
.daw-pcm__search-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.daw-pcm__item {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 1px 0;
  border: 1px solid transparent;
  border-radius: 4px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.daw-pcm__item:hover,
.daw-pcm__item:focus-within,
.daw-pcm__item.is-current {
  border-color: #f2d2b9;
  background: var(--daw-pcm-accent-soft);
}

.daw-pcm__item.is-current {
  box-shadow: inset 3px 0 0 var(--daw-pcm-accent);
}

.daw-pcm__item-link {
  min-width: 0;
  min-height: 44px;
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  padding: 6px 7px;
  color: var(--daw-pcm-text);
  text-decoration: none;
}

.daw-pcm__item-link:hover {
  color: var(--daw-pcm-brown);
}

.daw-pcm__letter {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 1px solid #f1d6c0;
  border-radius: 4px;
  background: #fff;
  color: var(--daw-pcm-accent-dark);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: none !important;
}

input.daw-pcm__search {
  box-shadow: none;
  min-height: 36px;
  border-radius: 8px;
}

.daw-pcm__item:hover .daw-pcm__letter,
.daw-pcm__item.is-current .daw-pcm__letter {
  border-color: var(--daw-pcm-accent);
  background: var(--daw-pcm-accent);
  color: #fff;
}

.daw-pcm__item-name {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daw-pcm__count {
  flex: 0 0 auto;
  min-width: 24px;
  height: 21px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 1px solid #e9e1db;
  border-radius: 10px;
  background: #f5f1ee;
  color: #7a706a;
  font-size: 9.5px;
  font-weight: 700;
}

.daw-pcm__next {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  margin: 0 5px 0 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9a8d84;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease;
}

.daw-pcm__next:hover,
.daw-pcm__next:focus-visible {
  background: #fff;
  color: var(--daw-pcm-accent);
  outline: none;
  box-shadow: 0 2px 7px rgba(53, 23, 12, 0.08);
}

.daw-pcm__next svg {
  width: 17px;
  height: 17px;
}

/* Trạng thái tải và trống */
.daw-pcm__loading,
.daw-pcm__empty,
.daw-pcm__search-empty {
  display: grid;
  place-items: center;
  min-height: 145px;
  padding: 24px;
  color: var(--daw-pcm-muted);
  font-size: 12.5px;
  text-align: center;
}

.daw-pcm__loading {
  align-content: center;
}

.daw-pcm__loading::before {
  content: "";
  width: 22px;
  height: 22px;
  margin-bottom: 10px;
  border: 2px solid #eadfd7;
  border-top-color: var(--daw-pcm-accent);
  border-radius: 50%;
  animation: daw-pcm-spin 0.7s linear infinite;
}

.daw-pcm__empty--error {
  color: #b42318;
}

/* Kết quả tìm kiếm */
.daw-pcm__search-results {
  width: min(620px, calc(100vw - 28px));
  max-height: min(68vh, 620px);
  overflow-y: auto;
  background: #fff;
  scrollbar-color: #d8cec6 #f7f3f0;
  scrollbar-width: thin;
}

.daw-pcm__search-list {
  padding: 7px;
}

.daw-pcm__search-list li + li {
  margin-top: 2px;
}

.daw-pcm__search-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--daw-pcm-text);
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.daw-pcm__search-list a:hover,
.daw-pcm__search-list a:focus-visible {
  border-color: #f2d2b9;
  background: var(--daw-pcm-accent-soft);
  outline: none;
}

.daw-pcm__search-copy {
  min-width: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.daw-pcm__search-copy strong {
  overflow: hidden;
  color: var(--daw-pcm-brown);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daw-pcm__search-copy small {
  margin-top: 2px;
  overflow: hidden;
  color: var(--daw-pcm-muted);
  font-size: 10.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes daw-pcm-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes daw-pcm-slide-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Flatsome header compatibility */
.header-wrapper,
.header-inner,
.header-nav,
.header-bottom,
.header-bottom-nav,
.header-bottom .flex-row {
  overflow: visible;
}

.header-wrapper .daw-pcm {
  z-index: 99999;
}

/* Tablet và mobile */
@media (max-width: 991px) {
  .daw-pcm {
    max-width: none;
  }

  .daw-pcm__toggle {
    min-height: 50px;
  }

  .daw-pcm__dropdown,
  .daw-pcm.is-right .daw-pcm__dropdown {
    right: auto;
    left: 0;
    width: min(94vw, 440px);
    min-width: 0;
    max-width: calc(100vw - 20px);
    transform-origin: top left;
  }

  .daw-pcm__search {
    width: 100%;
    min-width: 0;
  }

  .daw-pcm__columns {
    display: block;
    width: 100%;
    overflow: hidden;
  }

  .daw-pcm__column {
    display: none;
    width: 100%;
    min-width: 0;
    max-height: min(66vh, 570px);
    border-left: 0 !important;
  }

  .daw-pcm__column.is-active {
    display: block;
    animation: daw-pcm-slide-in 0.18s ease;
  }

  .daw-pcm__column[data-level]:not([data-level="0"]) .daw-pcm__back {
    display: grid;
  }

  .daw-pcm__item-name {
    white-space: normal;
  }

  .daw-pcm__search-results {
    width: 100%;
  }
}

@media (max-width: 575px) {
  .daw-pcm__toggle {
    border-radius: 4px;
  }

  .daw-pcm__toggle-copy strong {
    font-size: 13px;
  }

  .daw-pcm__dropdown,
  .daw-pcm.is-right .daw-pcm__dropdown {
    width: calc(100vw - 24px);
    max-width: none;
    border-radius: 5px;
  }

  .daw-pcm__search-wrap {
    padding: 9px;
  }

  .daw-pcm__search-wrap > svg {
    left: 22px;
  }

  .daw-pcm__search-clear {
    right: 17px;
  }

  .daw-pcm__column {
    max-height: 64vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .daw-pcm *,
  .daw-pcm *::before,
  .daw-pcm *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
