/* 大億行挖寶地圖正式版補充樣式 */

[hidden] {
  display: none !important;
}

.result-search {
  width: 100%;
}

.result-scan-button {
  flex-basis: 58px;
}

.loading-state,
.empty-state {
  padding: 38px 20px;
  border: 1px dashed #cbd6ee;
  border-radius: var(--radius-item);
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  text-align: center;
  line-height: 1.7;
}

.product-group {
  display: grid;
  gap: 10px;
}

.product-group + .product-group {
  margin-top: 4px;
}

.product-group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 4px 0;
}

.product-group-heading strong {
  color: var(--dayi-navy-dark);
  font-size: 14px;
}

.same-product-badge {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: #fff0cf;
  color: #8b5200;
  font-size: 12px;
  font-weight: 900;
}

.barcode-row {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.barcode-chip {
  padding: 3px 7px;
  border-radius: 8px;
  background: #eef2f8;
  color: #5c6472;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
}

.barcode-chip.primary {
  background: var(--dayi-navy-dark);
  color: white;
}

.product-card.is-located {
  border-color: #2f61b2;
  box-shadow: 0 0 0 3px rgba(47, 97, 178, 0.1), 0 10px 28px rgba(20, 42, 102, 0.1);
}

.map-intro {
  margin: 13px 0 15px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.location-focus-card {
  padding: 15px 16px;
  border: 1px solid #dbe3f3;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.location-focus-label {
  display: block;
  margin-bottom: 5px;
  color: var(--dayi-orange-press);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.location-focus-card strong {
  display: block;
  color: var(--dayi-navy-dark);
  font-size: 18px;
  line-height: 1.45;
}

.location-focus-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.location-focus-card.has-location {
  border-color: #9eb8df;
  background: #f4f8ff;
}

.map-legend {
  margin: 14px 0 10px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.map-legend button {
  min-height: 42px;
  padding: 5px 2px;
  border: 1px solid #dfe4ee;
  border-radius: 14px;
  background: var(--paper);
  color: var(--dayi-navy-dark);
  font-size: 11px;
  font-weight: 900;
}

.map-legend i {
  display: block;
  width: 18px;
  height: 5px;
  margin: 0 auto 4px;
  border-radius: var(--radius-pill);
}

.legend-yellow { background: #f2cf5b; }
.legend-blue { background: #85aede; }
.legend-green { background: #92c99a; }
.legend-red { background: #ef8d7e; }
.legend-orange { background: #f3ab63; }

.map-viewport {
  height: 520px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid #d8dfeb;
  border-radius: var(--radius-card);
  background: #eee9df;
  box-shadow: inset 0 2px 12px rgba(20, 42, 102, 0.08);
  scrollbar-width: thin;
  scrollbar-color: #8c98ad transparent;
}

.store-map {
  display: block;
  width: 100%;
  height: auto;
  min-height: 1180px;
}

.map-zone {
  cursor: pointer;
  transition: opacity 0.16s ease, filter 0.16s ease;
}

.map-zone:hover {
  filter: brightness(0.97);
}

.map-zone.is-muted {
  opacity: 0.24;
}

.map-zone.is-highlighted {
  filter: drop-shadow(0 0 8px rgba(20, 42, 102, 0.56));
}

.map-zone.is-highlighted rect {
  stroke: #142a66;
  stroke-width: 4;
}

.map-pin {
  display: none;
  filter: drop-shadow(0 5px 7px rgba(30, 35, 45, 0.32));
  pointer-events: none;
}

.map-pin.is-visible {
  display: block;
}

.map-pin.is-visible .map-pin-inner {
  animation: pin-arrive 0.32s ease both;
}

@keyframes pin-arrive {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; }
}

.location-code-note {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.location-code-note code {
  padding: 2px 6px;
  border-radius: 7px;
  background: #fff0cf;
  color: #7b4900;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.scanner-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(260px, 1fr) auto;
  background: #070b12;
  color: white;
}

.scanner-header {
  min-height: 92px;
  padding: max(18px, env(safe-area-inset-top)) 20px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #0d1421;
}

.scanner-eyebrow {
  color: #ffbd3b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.scanner-header h2 {
  margin: 4px 0 0;
  font-size: 21px;
}

.scanner-close {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 29px;
}

.scanner-camera {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  background: #05070b;
}

.scanner-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-target {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(76vw, 330px);
  height: 138px;
  transform: translate(-50%, -50%);
  border: 4px solid #4f82d2;
  border-radius: 22px;
  box-shadow: 0 0 0 200vmax rgba(0, 0, 0, 0.4);
}

.scanner-target span {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: 2px;
  background: #ff4b45;
  box-shadow: 0 0 8px rgba(255, 75, 69, 0.75);
}

.scanner-controls {
  padding: 18px 20px max(20px, env(safe-area-inset-bottom));
  background: #0d1421;
}

.scanner-controls p {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.scanner-engine {
  display: block;
  margin-top: 5px;
  color: #a7b0be;
  text-align: center;
  font-size: 11px;
}

.scanner-manual {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px;
  gap: 9px;
}

.scanner-manual input {
  min-width: 0;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 16px;
}

.scanner-manual input::placeholder {
  color: #abb2bf;
}

.scanner-manual button {
  min-height: 50px;
  border-radius: 15px;
  background: #ffbd3b;
  color: #142a66;
  font-size: 14px;
  font-weight: 900;
}

body.scanner-open {
  overflow: hidden;
}

@media (max-width: 380px) {
  .result-search {
    grid-template-columns: minmax(0, 1fr) 50px;
  }

  .result-scan-button {
    grid-column: 1 / -1;
  }

  .product-top {
    grid-template-columns: 1fr;
  }

  .price {
    text-align: left;
  }
}
