/* ============================================================
   SỐ HOÁ ĐỊA CHỈ NHÀ - Thôn Bảo An - Xã Phù Đổng
   Neon / glass theme on flat blue vector map background.
   Mobile-first (mặc định = dọc, <=768px), PC > 768px.
   ============================================================ */

:root {
  --cyan: #00baff;
  --cyan-glow: rgba(0, 186, 255, 0.75);
  --gold: #fdb40d;
  --gold-dark: #deb134;
  --gold-hi: #f9de75;
  --gold-rim: #808d30;
  --ink: #0a2a6b;              /* chữ xanh đậm trên kính */
  --ink-soft: #33518f;         /* dòng phụ xám xanh */
  --blue-deep: #1256e0;
  --blue-mid: #3073e4;
  --vignette: rgba(2, 37, 125, 0.55);
  --periwinkle-a: #a5b5d6;
  --periwinkle-b: #bdcfe8;
  --frame: #41517f;
  --violet: #545bb6;
  --glass-bg: rgba(157, 188, 220, 0.58);
  --glass-bg-strong: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(255, 255, 255, 0.35);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

html, body {
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--ink);
  background-color: #0d3a9e; /* dự phòng trong lúc tải ảnh nền */
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
}

/* ---------- Nền: bản đồ xanh + vignette (cố định, không cuộn) ---------- */

.bg-map {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse at center,
      rgba(2, 37, 125, 0) 28%,
      rgba(2, 37, 125, 0.28) 62%,
      var(--vignette) 100%),
    url('../img/map-bg.png') center center / cover no-repeat;
  pointer-events: none;
}

/* Lưu ý: title / org-line / robot giờ là PNG có sẵn kênh alpha —
   không dùng bất kỳ hiệu ứng trộn màu (blend) nào nữa. .page và các tổ
   tiên của ảnh vẫn KHÔNG được tạo stacking context (không z-index /
   transform / opacity / filter) cho tới khi thực sự cần thiết.
   Các lớp nền đã được làm phẳng (vignette + bản đồ gộp chung .bg-map,
   robot dùng position: absolute) để tránh đường seam ngang khi các
   fixed layer bị promote riêng biệt (thấy ở DPR cao). */

.page {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.8vh 18px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================ HEADER ============================ */

.hero {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.logo-pair {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3vw;
  margin-bottom: 0.15vh;
  flex-shrink: 0;
}

.logo {
  height: clamp(56px, 12vw, 92px);
  width: auto;
  flex-shrink: 0;
}

.org-line {
  width: 85%;
  max-width: 430px;
  margin-bottom: 0.4vh;
}

.title-gold {
  width: 90%;
  max-width: 436px;
}

/* ============================ TÌM KIẾM ============================ */

.search-zone {
  width: 100%;
  max-width: 540px;
  margin-top: 2.8vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.search-container {
  position: relative;
  width: 100%;
}

.search-bar-block {
  position: relative;
}

.search-box-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  height: 60px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--periwinkle-a) 0%, var(--periwinkle-b) 100%);
  border: 2px solid var(--frame);
  padding: 0 58px 0 56px;
  box-shadow:
    0 0 18px var(--cyan-glow),
    inset 0 2px 8px rgba(255, 255, 255, 0.6),
    inset 0 -2px 6px rgba(65, 81, 127, 0.25);
  transition: box-shadow 0.25s ease;
}

.search-box-wrapper:focus-within {
  box-shadow:
    0 0 28px rgba(0, 186, 255, 0.95),
    inset 0 2px 8px rgba(255, 255, 255, 0.6),
    inset 0 -2px 6px rgba(65, 81, 127, 0.25);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  color: var(--ink);
  opacity: 0.85;
  pointer-events: none;
}

.search-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.search-box {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  font-weight: 600;
}

.search-box::placeholder {
  color: #33477f;
  opacity: 0.85;
  font-weight: 500;
}

.reset-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(65, 81, 127, 0.45);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.reset-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.reset-btn.show {
  opacity: 1;
  visibility: visible;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.reset-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.reset-btn:focus-visible {
  outline: 2px solid var(--frame);
  outline-offset: 1px;
}

/* --- Bộ lọc: pill kính mờ --- */

.filter-inputs {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.filter-select {
  flex: 1;
  min-width: 0;
  height: 44px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  border: 1px solid rgba(0, 186, 255, 0.55);
  background-color: rgba(10, 30, 90, 0.45);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2012%208'%3E%3Cpath%20d='M1%201l5%205%205-5'%20fill='none'%20stroke='white'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 0 38px 0 18px;
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.filter-select:hover {
  border-color: var(--cyan);
}

.filter-select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 186, 255, 0.55);
}

.helper-text {
  margin-top: 5px;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(2, 20, 80, 0.8);
}

/* --- Gợi ý: thẻ kính, thanh accent cyan bên trái --- */

.suggestions-list {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 60;
  margin: 0;
  padding: 6px;
  list-style: none;
  display: none;
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: 0 16px 42px rgba(2, 20, 80, 0.45), 0 0 22px rgba(0, 186, 255, 0.22);
  max-height: 46vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.suggestions-list.show {
  display: block;
}

.suggestion-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 12px;
  border-left: 3px solid var(--cyan);
  background: rgba(13, 27, 61, 0.045);
  cursor: pointer;
  transition: background 0.15s ease;
}

.suggestion-item + .suggestion-item {
  margin-top: 6px;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: rgba(210, 230, 250, 0.55);
}

.suggestion-item.active {
  border-left-color: var(--gold);
}

.suggestion-icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(0, 186, 255, 0.22);
  border: 1px solid rgba(0, 186, 255, 0.5);
}

.suggestion-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.suggestion-text {
  flex: 1;
  min-width: 0;
}

.suggestion-address {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.3;
}

.suggestion-family {
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  word-break: break-word;
}

.suggestion-meta {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-soft);
}

/* Vùng phải: trên mobile con của nó tham gia thẳng luồng trang,
   trên PC trở thành cột phải (xem media query). */
.right-zone {
  display: contents;
}

/* ============================ NÚT BẤM ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn svg {
  width: 21px;
  height: 21px;
  flex: none;
  display: block;
}

.btn:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.9);
  outline-offset: 2px;
}

/* Hàng nút mobile: hai nút nằm cạnh nhau trên cùng một đường cơ sở
   (trên PC wrapper này được ẩn đi bằng display: contents — xem media query). */
.actions-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  gap: 3.5%;
  margin-top: 1.2vh;
}

/* Nút xanh "TRA CỨU ĐỊA CHỈ": nửa trái của hàng nút */
.btn-search {
  width: 52%;
  height: 56px;
  font-size: 15px;
  color: #fff;
  border: none;
  background: linear-gradient(180deg, var(--blue-mid) 0%, var(--blue-deep) 100%);
  box-shadow: 0 0 22px rgba(0, 186, 255, 0.8), 0 10px 22px rgba(2, 20, 80, 0.4);
  text-shadow: 0 1px 4px rgba(2, 30, 100, 0.5);
}

/* Nút vàng "CHỈ ĐƯỜNG": nửa phải của hàng nút, cùng baseline */
.btn-directions {
  position: relative;
  z-index: 2;
  width: 44%;
  height: 56px;
  margin: 0;
  font-size: 14.5px;
  color: #3a2f05;
  border: 2px solid var(--gold-rim);
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold-dark) 100%);
  box-shadow: 0 0 22px rgba(253, 180, 13, 0.55), 0 10px 20px rgba(80, 60, 0, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-search:hover,
.btn-directions:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.06);
}

.btn-search:active,
.btn-directions:active {
  transform: scale(0.97);
}

/* Nút "CHỈ ĐƯỜNG" mờ đi khi chưa có hộ nào được chọn
   (độ đặc thua .btn-directions thường và cả rule trong media PC). */
.btn-directions:not(.is-active) {
  filter: grayscale(0.4) brightness(0.72) saturate(0.65);
  opacity: 0.55;
  box-shadow: none;
  cursor: not-allowed;
}

/* ============================ KẾT QUẢ ============================ */

.results-container {
  position: relative;
  z-index: 40;
  width: 100%;
  margin-top: 3.2vh;
  display: none;
}

.results-container.show {
  display: block;
  animation: fade-up 0.35s ease both;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-item {
  background: rgba(255, 255, 255, 0.90);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-top: 3px solid var(--gold);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 42px rgba(2, 20, 80, 0.45), 0 0 20px rgba(0, 186, 255, 0.18);
}

.result-address {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}

.result-name {
  font-size: 18px;
  font-weight: 800;
  color: #0d1b3d;
  word-break: break-word;
}

.result-family-members {
  font-size: 13px;
  font-weight: 500;
  color: #1e3a6e;
  word-break: break-word;
}

.result-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.result-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.result-detail-item--full {
  grid-column: 1 / -1;
}

.result-detail-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: rgba(13, 27, 61, 0.65);
}

.result-detail-value {
  font-size: 14.5px;
  font-weight: 600;
  color: #0d1b3d;
  word-break: break-word;
}

/* ============================ ROBOT ============================ */

.robot {
  position: absolute;
  left: 2vw;
  right: auto;
  bottom: 1vh;
  width: 42vw;
  max-width: 178px;
  z-index: 5;
  pointer-events: none;
}

/* ============================ PC (> 768px) ============================ */

@media (min-width: 769px) {
  .page {
    position: relative;
    max-width: min(86vw, 1140px);
    padding: 1vh 3vw 2vh;
    display: grid;
    grid-template-columns: minmax(0, min(46vw, 680px)) auto;
    grid-template-rows: auto 1fr;
    column-gap: 2.5vw;
    align-items: stretch;
    align-content: stretch;
  }

  .hero {
    grid-column: 1;
    grid-row: 1;
    align-items: flex-start;
  }

  .hero-top {
    flex-direction: row;
    align-items: center;
    gap: 1.8vw;
  }

  .logo-pair {
    gap: 14px;
    margin-bottom: 0;
  }

  .logo {
    height: clamp(96px, 7vw, 120px);
  }

  .org-line {
    flex: 1;
    max-width: 85%;
    margin-bottom: 0;
  }

  .title-gold {
    width: auto;
    max-width: 86%;
    margin-left: auto;
    margin-right: auto;
    /* 5vh đệm giữa hàng logo+org-line và phần ảnh/nội dung bên dưới (yêu cầu owner) */
    margin-top: 6vh;
  }

  .search-zone {
    grid-column: 1;
    grid-row: 2;
    max-width: none;
    margin-top: 2vh;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .search-container {
    width: min(600px, 100%);
  }

  .search-box-wrapper {
    height: 70px;
    padding: 0 64px 0 62px;
  }

  .search-box {
    font-size: 17px;
  }

  .search-icon {
    left: 22px;
    width: 24px;
    height: 24px;
  }

  .filter-select {
    height: 48px;
    font-size: 15px;
  }

  .helper-text {
    text-align: center;
  }

  .suggestions-list {
    max-height: min(46vh, 168px);
  }

  /* Hàng nút nằm trong cụm tìm kiếm căn giữa, rộng bằng cụm. */
  .actions-row {
    width: min(600px, 100%);
  }

  /* Nhãn tiếng Việt dài: cấm xuống dòng trong nút trên PC. */
  .btn-search,
  .btn-directions {
    white-space: nowrap;
  }

  .btn-search {
    width: 56%;
    min-width: 0;
    margin: 2.5vh 0 0 0;
    padding: 0 30px;
    height: 64px;
    font-size: 16px;
    align-self: flex-start;
  }

  .right-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    grid-column: 2;
    grid-row: 1 / -1;
    min-width: 0;
  }

  .robot {
    position: static;
    width: min(26vw, 380px);
    max-width: none;
    transform: scaleX(-1);
  }

  .btn-directions {
    position: static;
    width: 41%;
    min-width: 0;
    height: 62px;
    margin: 2.5vh 0 0 3%;
    padding: 0 28px;
    font-size: 15.5px;
  }

  .results-container {
    width: min(600px, 100%);
    max-width: none;
    margin: 2.5vh 0 0;
  }
}

/* ============================ MÀN HÌNH NHỎ ============================ */

@media (max-width: 480px) {
  .result-details {
    grid-template-columns: 1fr;
  }

  .btn-search {
    width: 54%;
    font-size: 14px;
  }

  .btn-directions {
    width: 42.5%;
    font-size: 13.5px;
  }
}

@media (max-width: 360px) {
  .btn-search,
  .btn-directions {
    font-size: 12.5px;
    gap: 7px;
  }

  .search-box {
    font-size: 15px;
  }
}

/* ============================ GIẢM CHUYỂN ĐỘNG ============================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
