/* DOCHIFOOD PUBLIC V5.2.1 — HEADERLESS + SEARCH DRAWER */

/* 1) Chỉ ẩn header ở Khám phá + Báo giá */
body[data-view="discover"] #v5Header,
body[data-view="discover"] .v5-header,
body[data-view="yours"] #v5Header,
body[data-view="yours"] .v5-header {
  display: none !important;
}

body[data-view="discover"] #v5App,
body[data-view="discover"] .v5-app,
body[data-view="yours"] #v5App,
body[data-view="yours"] .v5-app {
  --header-h: 0px !important;
  --header-height: 0px !important;
  --v5-header-h: 0px !important;
  --v5-header-height: 0px !important;
}

body[data-view="discover"] .v5-pager,
body[data-view="yours"] .v5-pager {
  top: 0 !important;
}

/* 2) Nút tìm kiếm nổi ở Khám phá, ngay trên bottom nav. */
.v521-search-launcher {
  position: fixed;
  z-index: 75;
  right: 16px;
  bottom: calc(86px + env(safe-area-inset-bottom));
  width: 50px;
  height: 50px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(8, 126, 88, .55);
  border-radius: 15px;
  background: rgba(255, 255, 255, .90);
  color: #087e58;
  box-shadow: none;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.v521-search-launcher[hidden] {
  display: none !important;
}

.v521-search-launcher svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.v521-search-launcher:active {
  transform: scale(.96);
}

/* 3) Drawer search. */
.v521-search-drawer {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.v521-search-drawer[hidden] {
  display: none !important;
}

.v521-search-drawer.is-open {
  pointer-events: auto;
}

.v521-search-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(8, 20, 16, 0);
  transition: background .24s ease;
}

.v521-search-drawer.is-open .v521-search-backdrop {
  background: rgba(8, 20, 16, .22);
}

.v521-search-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(82px + env(safe-area-inset-bottom));
  padding: 10px 14px 14px;
  border: 1px solid #dce7e2;
  border-radius: 22px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 16px 44px rgba(24, 55, 44, .16);
  transform: translateY(calc(100% + 110px));
  opacity: .35;
  transition: transform .28s cubic-bezier(.22,.8,.2,1), opacity .2s ease;
}

.v521-search-drawer.is-open .v521-search-panel {
  transform: translateY(0);
  opacity: 1;
}

.v521-search-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 9px;
  border-radius: 999px;
  background: #d7dfdc;
}

.v521-search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.v521-search-panel-head > div {
  min-width: 0;
}

.v521-search-panel-head small {
  display: block;
  color: #087e58;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: .11em;
}

.v521-search-panel-head strong {
  display: block;
  margin-top: 2px;
  color: #123e72;
  font-size: 18px;
  line-height: 1.15;
}

.v521-search-close {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #f1f5f3;
  color: #5f706a;
  font-size: 25px;
  line-height: 1;
}

.v521-search-form {
  height: 52px;
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 14px;
  border: 1.5px solid #cfdcd6;
  border-radius: 16px;
  background: #fff;
}

.v521-search-form:focus-within {
  border-color: #087e58;
}

.v521-search-form > svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #087e58;
  stroke-width: 1.9;
  stroke-linecap: round;
}

#v521SearchInput {
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #153f33;
  font: inherit;
  font-size: 16px;
}

#v521SearchInput::placeholder {
  color: #9aa7a2;
}

.v521-search-clear {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: #eef3f1;
  color: #64756f;
  font-size: 20px;
  line-height: 1;
}

.v521-search-clear[hidden] {
  display: none !important;
}

.v521-search-submit {
  height: 38px;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  background: #087e58;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.v521-search-hint {
  margin: 9px 3px 0;
  color: #788781;
  font-size: 11px;
}

body.v521-search-open {
  overflow: hidden !important;
}

/* Detail / modal mở thì không để nút tìm kiếm chồng lên. */
body:has(#v5Detail:not([hidden])) .v521-search-launcher,
body:has(#v5LeadModal:not([hidden])) .v521-search-launcher {
  display: none !important;
}

/* Desktop: drawer thành hộp tìm kiếm gọn ở góc phải dưới. */
@media (min-width: 900px) {
  .v521-search-launcher {
    right: 28px;
    bottom: 30px;
  }

  .v521-search-panel {
    left: auto;
    right: 28px;
    bottom: 28px;
    width: min(520px, calc(100vw - 56px));
  }
}

/* HOTFIX: ẩn header đúng khi đang ở Khám phá hoặc Báo giá */
body:has(#v5Nav [data-view="discover"].active) #v5Header,
body:has(#v5Nav [data-view="yours"].active) #v5Header {
  display: none !important;
}

/* Thu hồi khoảng trống header */
body:has(#v5Nav [data-view="discover"].active) .v5-pager,
body:has(#v5Nav [data-view="yours"].active) .v5-pager {
  top: 0 !important;
}

/* V5.2.6 — bỏ header toàn bộ Public */
#v5Header,
.v5-header {
  display: none !important;
}

/* thu hồi toàn bộ khoảng trống header */
.v5-pager {
  top: 0 !important;
}

#v5App,
.v5-app {
  --header-h: 0px !important;
  --header-height: 0px !important;
  --v5-header-h: 0px !important;
  --v5-header-height: 0px !important;
}

/* Bottom navigation vẫn giữ nguyên */
#v5Nav,
.v5-nav {
  display: grid !important;
  visibility: visible !important;
}
