/* ============================================================================
   DLV Hotel Destination Picker (.hdp-*) - dùng chung:
   - Trang chủ  : box/local_search_bar.php  (#lsHotelCity)
   - Kết quả KS : search_hotels_api.php     (#hsrCity)
   Desktop: popover .hdp-panel dưới input. Mobile ≤767px: modal .hdp-modal.
   JS: static-assets/js/hotel-dest-picker.js. Scope toàn bộ bằng prefix hdp-.
   ========================================================================== */

.hdp-anchor { position: relative; }

/* ── Desktop popover ──────────────────────────────────────────────────────── */
.hdp-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 460px;
  max-width: min(560px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(32, 33, 36, .16);
  z-index: 210; /* trên .ls-autocomplete-dropdown (100/200) để thay thế hẳn UI cũ */
  overflow: hidden;
}

.hdp-list {
  max-height: 380px;
  min-height: 56px; /* loading/error không làm nhảy layout */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 8px;
}

/* ── Group label ──────────────────────────────────────────────────────────── */
.hdp-group {
  padding: 10px 16px 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #80868b;
}

/* ── Result item ──────────────────────────────────────────────────────────── */
.hdp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
}
.hdp-item.is-active,
.hdp-item:hover { background: #fdf0f6; }
.hdp-item.is-active { outline: 2px solid var(--c-primary, #d6248c); outline-offset: -2px; } /* không chỉ dựa vào màu nền */

.hdp-ico {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f1f3f4;
  color: #5f6368;
}
.hdp-ico-hotel  { color: var(--c-primary, #d6248c); background: var(--c-primary-light, #fde4f1); }
.hdp-ico-city   { color: #1a73e8; background: #e8f0fe; }
.hdp-ico-area   { color: #188038; background: #e6f4ea; }
.hdp-ico-country{ color: #9334e6; background: #f3e8fd; }
.hdp-ico-recent { color: #80868b; background: #f1f3f4; }

.hdp-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hdp-name {
  font-size: 14.5px;
  font-weight: 600;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-bottom: 1px; /* tránh clip dấu tiếng Việt khi ellipsis */
}
.hdp-sub {
  font-size: 12.5px;
  color: #5f6368;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hdp-stars { color: #f5a623; letter-spacing: 1px; }

.hdp-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px 2px;
  border-radius: 10px;
  background: var(--c-primary-light, #fde4f1);
  color: var(--c-primary-dark, #8e155b);
  font-size: 11px;
  font-weight: 700;
  vertical-align: 1px;
}

.hdp-type {
  flex: 0 0 auto;
  font-size: 12px;
  color: #80868b;
  white-space: nowrap;
  padding-left: 8px;
}

/* ── Status rows (loading / empty / error) ────────────────────────────────── */
.hdp-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  font-size: 13.5px;
  color: #5f6368;
  line-height: 1.45;
}
.hdp-error { color: #c5221f; }
.hdp-spin {
  width: 16px;
  height: 16px;
  border: 2px solid #e8eaed;
  border-top-color: var(--c-primary, #d6248c);
  border-radius: 50%;
  animation: hdp-rotate .7s linear infinite;
  flex: 0 0 auto;
}
@keyframes hdp-rotate { to { transform: rotate(360deg); } }

/* ── Mobile modal ─────────────────────────────────────────────────────────── */
body.hdp-lock {
  position: fixed;
  width: 100%;
  overflow: hidden; /* top set bằng JS = -scrollY, khôi phục khi đóng (không giật) */
}

.hdp-modal {
  position: fixed;
  inset: 0;
  z-index: 100010; /* trên header (9990) + dest-sheet tour (100005) */
  background: #fff;
  display: flex;
  flex-direction: column;
  height: var(--hdp-vh, 100dvh); /* co theo visualViewport khi bàn phím mở */
  max-height: 100dvh;
}

.hdp-m-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f3f4;
}
.hdp-m-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #202124;
  cursor: pointer;
}
.hdp-m-close:active { background: #f1f3f4; }
.hdp-m-title {
  font-size: 17px;
  font-weight: 700;
  color: #202124;
}

.hdp-m-searchwrap {
  flex: 0 0 auto;
  position: relative;
  padding: 10px 16px;
}
.hdp-m-search {
  width: 100%;
  height: 46px;
  padding: 0 42px 0 14px;
  border: 2px solid var(--c-primary, #d6248c);
  border-radius: 10px;
  font-size: 16px; /* ≥16px: iOS không auto-zoom */
  font-family: inherit;
  color: #202124;
  outline: none;
}
.hdp-m-clear {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #80868b;
  cursor: pointer;
}

.hdp-m-list {
  flex: 1 1 auto;
  max-height: none;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); /* né bottom bar Safari */
  -webkit-overflow-scrolling: touch;
}
.hdp-m-list .hdp-item { padding: 12px 16px; }

/* Viewport hẹp: popover desktop co lại (tablet dọc vẫn dùng popover) */
@media (max-width: 991px) {
  .hdp-panel { min-width: 0; width: 100%; }
}
