/* Mapa interativo de Alola (mapa-alola.html) -- reaproveita as variáveis de
   cor globais (--header-purple, --active-green, --text-dark etc.) de
   style.css, que carrega antes deste arquivo. */

.map-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.map-intro {
  text-align: center;
  margin-bottom: 18px;
}
.map-intro h2 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 1.3rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.map-intro p {
  margin: 0 auto;
  max-width: 62ch;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
  line-height: 1.5;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* ---- Tela de seleção de ilha (as 4 ilhas "de longe") -- primeira tela
   que aparece, igual à tela de seleção de ilha real do jogo. ---- */
.map-region-view[hidden], .map-detail-view[hidden] { display: none; }

.map-region-canvas {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  aspect-ratio: 1280 / 905;
  border-radius: 20px;
  overflow: hidden;
  background: #0b3a73;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
/* Arte oficial promocional das 4 ilhas de Alola vistas de cima (Bulbapedia
   Archives, alta resolução) -- as posições dos hotspots clicáveis foram
   medidas em cima dessa arte e conferidas contra a ordem/posição real das
   ilhas na tela de seleção do próprio jogo. Os "hotspots" clicáveis ficam por
   cima, transparentes, e mostram o próprio destaque ao passar o mouse. */
.map-region-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
#map-region-hotspots {
  position: absolute;
  inset: 0;
}
.map-region-island {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 14px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.map-region-island:hover, .map-region-island:focus-visible {
  transform: scale(1.04);
  border-color: #ffd76a;
  background-color: rgba(255, 215, 106, 0.16);
  box-shadow: 0 0 0 4px rgba(255, 215, 106, 0.14);
  z-index: 2;
}
.map-region-island span {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  background: rgba(11, 20, 40, 0.72);
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.map-region-island:hover span, .map-region-island:focus-visible span {
  opacity: 1;
}
.map-region-hint {
  margin: 12px 4px 0;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
}

/* Preview flutuante com o mapa detalhado da ilha, mostrado ao passar o
   mouse num hotspot (só em telas com hover -- no toque, tocar já abre o
   mapa detalhado direto, então o preview não é necessário). */
.map-region-preview {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 38%;
  max-width: 190px;
  transform: translate(-50%, 6px);
  background: rgba(11, 20, 40, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  padding: 8px;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.map-region-preview.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.map-region-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 9px;
}
.map-region-preview span {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
}
@media (hover: none) {
  .map-region-preview { display: none; }
}

.map-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 16px 8px 12px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.map-back-btn:hover { background: rgba(255, 255, 255, 0.26); }
.map-back-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.map-detail-view { display: flex; flex-direction: column; align-items: center; }

.map-island-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.map-island-tab {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 18px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.map-island-tab.active {
  background: var(--active-green);
  color: var(--pill-text);
}

.map-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 780px) {
  .map-layout { grid-template-columns: 1fr; }
}

.map-card {
  background: rgba(20, 16, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 10px;
  backdrop-filter: blur(8px);
}

.map-viewport {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #0b1120;
  touch-action: none;
  cursor: grab;
  user-select: none;
  margin: 0 auto;
}
.map-viewport.dragging { cursor: grabbing; }
.map-viewport[data-island="melemele"] { aspect-ratio: 732 / 590; }
/* Akala e Ula'ula são retratos altos (mais alto que largo) -- limitar só a
   altura (max-height) com object-fit:cover no <img> corta pedaço do mapa,
   porque a caixa passa a ter uma proporção diferente da imagem real e o
   "cover" preenche cortando a sobra. Limitando a LARGURA a um valor que já
   dá, pela proporção, a altura-alvo, a caixa nunca sai da proporção real
   da imagem -- encolhe inteira, sem cortar nada. */
.map-viewport[data-island="akala"] { aspect-ratio: 654 / 782; max-width: calc(72vh * 654 / 782); }
.map-viewport[data-island="ulaula"] { aspect-ratio: 752 / 858; max-width: calc(72vh * 752 / 858); }
.map-viewport[data-island="poni"] { aspect-ratio: 654 / 504; }

.map-stage {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.map-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

#map-region-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
#map-region-overlay.visible { opacity: 1; }

.map-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}
.map-pin svg { width: 26px; height: 34px; color: #e3350d; }
.map-pin.has-species svg { color: var(--active-green); }
.map-pin.selected svg { color: #ffd76a; }
.map-pin:hover svg { transform: scale(1.15); }
.map-pin svg { transition: transform 0.12s ease; }

.map-controls {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.map-ctrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 16, 40, 0.75);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.map-ctrl-btn:hover { background: rgba(20, 16, 40, 0.95); }
.map-ctrl-btn svg { width: 16px; height: 16px; }

.map-hint {
  margin: 8px 4px 0;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.map-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.map-dex {
  background: rgba(20, 16, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 14px;
  backdrop-filter: blur(8px);
  color: #fff;
}
.map-dex-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.map-dex-header h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
}
.map-dex-count {
  font-size: 0.7rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}
.map-dex-mode-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.map-dex-mode-tab {
  flex: 1;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 6px 8px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}
.map-dex-mode-tab.active {
  background: rgba(97, 227, 129, 0.22);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(97, 227, 129, 0.5);
}

.map-dex-search {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.2);
  color: #fff;
  margin-bottom: 10px;
}
.map-dex-search::placeholder { color: rgba(255, 255, 255, 0.45); }
.map-dex-search:focus { outline: 2px solid var(--active-green); outline-offset: 1px; }

.map-dex-filter[hidden] { display: none; }
.map-dex-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(97, 227, 129, 0.16);
  border: 1px solid rgba(97, 227, 129, 0.4);
  border-radius: 10px;
  padding: 6px 10px;
  margin-bottom: 10px;
}
.map-dex-filter span {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--active-green);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-dex-filter button {
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.map-dex-filter button:hover { background: rgba(255, 255, 255, 0.24); }

.map-dex-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 340px;
  overflow-y: auto;
}
.map-dex-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-family: inherit;
  text-align: left;
  border: none;
  border-radius: 10px;
  padding: 5px 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.map-dex-item:hover { background: rgba(255, 255, 255, 0.08); }
.map-dex-item img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}
.map-dex-item-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--active-green);
}
.map-dex-item-name {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-method-icons {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.map-method-icon {
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.45);
}
.map-method-icon svg { width: 100%; height: 100%; display: block; }
.map-method-icon--grass { color: #7bd66b; }
.map-method-icon--surf { color: #5eb6e8; }
.map-method-icon--fish { color: #e8b45e; }
.map-dex-item-count {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.map-dex-empty {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  padding: 14px 6px;
}

.map-panel {
  background: rgba(20, 16, 40, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 18px;
  backdrop-filter: blur(8px);
  color: #fff;
  min-height: 160px;
}
.map-panel-empty {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  text-align: center;
  padding: 20px 6px;
}
.map-panel-name {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
}
.map-panel-desc {
  margin: 0 0 12px;
  font-size: 0.84rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.88);
}
.map-panel-species-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--active-green);
  margin-bottom: 6px;
}
.map-panel-species-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.map-panel-species-item {
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px 10px;
}

.map-panel-full-species {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.map-panel-full-species-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  padding: 6px 4px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  text-align: center;
}
.map-panel-full-species-item:hover { background: rgba(255, 255, 255, 0.14); }
.map-panel-full-species-item img { width: 36px; height: 36px; object-fit: contain; }
.map-panel-full-species-item span {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.map-panel-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 2px;
}
.map-panel-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 7px 10px;
}
.map-panel-item.is-hidden { background: rgba(255, 215, 106, 0.1); }
.map-panel-item-icon {
  flex-shrink: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--active-green);
}
.map-panel-item.is-hidden .map-panel-item-icon { color: #ffd76a; }
.map-panel-item-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
}
.map-panel-item-desc {
  display: block;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}

.map-caption {
  margin: 14px 4px 0;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
  max-width: 62ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}
