/* ==================== Birth Place Picker Dialog ==================== */
/* JS port of the Flutter `BirthPlacePickerDialog` (2-tab Việt Nam /
   Nước ngoài). Reuses dialog-overlay / dialog-card / dialog-fade
   keyframes from create-horoscope-dialog.css so visual + animation
   are consistent. Stack ABOVE the create horoscope dialog (z-index
   higher) since it opens on top of it. */

#birth-place-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 11000; /* > .dialog-overlay (10000) so it sits above */
  display: flex;
  align-items: center;
  justify-content: center;
  animation: dialogFadeIn 0.3s ease;
}

#birth-place-overlay.fade-out {
  animation: dialogFadeOut 0.2s ease forwards;
}

.bp-dialog {
  background: #ffffff;
  border-radius: 24px;
  width: 480px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

/* Mobile (<600px viewport): full-screen takeover for map breathing room.
   `dvh` accounts for iOS Safari's URL bar + bottom toolbar — `vh` ignores
   them and would push the dialog header / footer off-screen. Declare
   `vh` first as a fallback for older WebKit. */
@media (max-width: 599px) {
  .bp-dialog {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }
}

/* ==================== Header ==================== */

.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0eef7;
}

.bp-title {
  font-family: 'Philosopher', serif;
  font-size: 18px;
  font-weight: 400;
  color: #111111;
  margin: 0;
}

.bp-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #111111;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}

.bp-close:hover {
  background: #f4f2f8;
}

.bp-close .material-icons-outlined {
  font-size: 22px;
}

/* ==================== Pill TabBar ==================== */

.bp-tabbar {
  margin: 8px 20px 12px;
  height: 44px;
  background: #EDEAF7;
  border-radius: 24px;
  padding: 3px;
  display: flex;
  position: relative;
}

.bp-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'Philosopher', serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.08px;
  line-height: 18px;
  color: #111111;
  border-radius: 22px;
  transition: color 0.18s;
}

.bp-tab.active {
  background: #ffffff;
  color: #191970;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* ==================== Body ==================== */

.bp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* allow flex children to shrink */
}

/* Search field shared between tabs. */
.bp-search {
  margin: 4px 20px 12px;
  height: 44px;
  background: #F4F2F8;
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  gap: 10px;
}

.bp-search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 14px;
  color: #111111;
}

.bp-search-input::placeholder {
  color: #6B6B7A;
}

.bp-search-icon {
  color: #6B6B7A;
  font-size: 20px;
}

/* Trailing slot — swap between spinner / clear ✕ / pin 📍. */
.bp-trailing {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.bp-trailing-clear {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #191970;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.bp-trailing-clear .material-icons-outlined {
  font-size: 14px;
}

.bp-trailing-pin {
  color: #111111;
  font-size: 20px;
}

.bp-trailing-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(25, 25, 112, 0.2);
  border-top-color: #191970;
  border-radius: 50%;
  animation: bpSpin 0.8s linear infinite;
}

@keyframes bpSpin {
  to { transform: rotate(360deg); }
}

/* List area (VN provinces / Foreign results). */
.bp-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 4px 8px;
}

.bp-list-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 32px;
  color: #6B6B7A;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

.bp-empty-text {
  margin: 0;
  max-width: 320px;
}

.bp-empty-link {
  color: #191970;
  font-weight: 600;
  text-decoration: none;
}

.bp-list-item {
  flex-shrink: 0; /* keep item height in the flex-column list; scroll instead of squashing */
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s;
}

.bp-list-item:hover {
  background: #f4f2f8;
}

.bp-list-item.selected {
  background: #EDEAF7;
}

.bp-list-item-title {
  font-family: Roboto, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #111111;
}

.bp-list-item-subtitle {
  margin-top: 2px;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 13px;
  color: #6B6B7A;
}

/* Inline error text below the search field. */
.bp-error {
  padding: 4px 24px 8px;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 13px;
  color: #B42318;
}

/* ==================== Map ==================== */

.bp-map {
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* Leaflet default markers override — use a navy pin matching the
   brand. (Native default red is mismatched.) */
.bp-map .leaflet-marker-icon {
  /* keep default icon */
}

/* ==================== Confirm button ==================== */

.bp-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0eef7;
}

.bp-confirm {
  width: 100%;
  height: 48px;
  border: none;
  background: #191970;
  color: #ffffff;
  font-family: Roboto, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  border-radius: 28px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.bp-confirm:hover:not(:disabled) {
  background: #14145c;
}

.bp-confirm:disabled {
  background: #CBCBD3;
  cursor: not-allowed;
}
