/* World map (/plattegrond) - matches the rework theme (see login.css). */

/*
 * Village map (/dorp) - ported verbatim from legacy beta/index.php
 * (coordinates converted from page-absolute to map-relative so they don't
 * depend on header height). Lives here rather than in game/dorp.php's own
 * <style> block for the same reason as the .gm-* rules above: this
 * stylesheet is always loaded (see head.php), so it's already present when
 * nav.js swaps a nav-click's .game-content into /dorp from elsewhere.
 */
.village-map { position: relative; width: 600px; height: 400px; }
.village-map img { display: block; }
.village-map-layer { position: absolute; top: 0; left: 0; width: 600px; height: 400px; }
.lvllabel { position: absolute; height: 18px; min-width: 22px; padding: 0 3px; box-sizing: border-box; text-align: center; line-height: 16px; border-radius: 5px; background: linear-gradient(180deg, #6ea2ff 0%, #3f73e0 45%, #2350b0 100%); border: 2px solid #0a1430; box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 2px 4px rgba(0,0,0,0.35); font-family: Verdana, Arial; font-size: 10px; color: #f4f8ff; text-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.village-map.is-night .lvllabel { background: linear-gradient(180deg, #2c4a8a 0%, #1c3260 55%, #0f1d3e 100%); border-color: #060e20; color: #dfe8fa; }
.gebouw01 { left: 35px;  top: 181px; }
.gebouw02 { left: 25px;  top: 281px; }
.gebouw03 { left: 215px; top: 291px; }
.gebouw04 { left: 535px; top: 261px; }
.gebouw05 { left: 415px; top: 371px; }
.gebouw06 { left: 25px;  top: 81px; }
.gebouw07 { left: 110px; top: 41px; }
.gebouw08 { left: 415px; top: 71px; }
.gebouw09 { left: 195px; top: 81px; }
.gebouw10 { left: 265px; top: 91px; }
.gebouw12 { left: 265px; top: 201px; }
.village-map-toggle { position: absolute; left: 577px; top: 378px; cursor: pointer; }

.gm-btn.btn-primary {
  margin-top: 0;
  padding: 6px 14px;
  border-width: 2px;
  border-radius: 6px;
  font-size: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 3px 6px rgba(0,0,0,0.3);
}

.gm-legend-overlay {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 5px 14px;
  padding: 8px 10px;
  background: rgba(6,14,32,0.85);
  border: 2px solid #1c3260;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(2,8,22,0.45);
}
.gm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: Verdana, Arial;
  font-size: 10px;
  color: #dfe8fa;
  white-space: nowrap;
}
.gm-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid #0a1430;
  flex-shrink: 0;
}

.gm-shell {
  position: relative;
}
.gm-shell.is-maximized {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: #050c1f;
}
.gm-shell.is-maximized .gm-map-grid {
  flex: 1;
  min-height: 0;
}
.gm-shell.is-maximized .gm-viewport {
  height: 100%;
}
body.gm-lock-scroll { overflow: hidden; }

.gm-map-grid {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: 22px 1fr;
  border: 2px solid #1c3260;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(2,8,22,0.35);
}
.gm-ruler-corner, .gm-ruler-x, .gm-ruler-y { display: block; background: #0f1b33; }
.gm-ruler-x, .gm-ruler-y { width: 100%; height: 100%; }

.gm-viewport {
  position: relative;
  width: 100%;
  height: 560px;
  overflow: hidden;
  background: #79bd45;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.gm-viewport.is-dragging { cursor: grabbing; }

.gm-canvas {
  position: absolute;
  top: 0;
  left: 0;
  background: #79bd45 url('/assets/images/worldmap/grass.png') 0 0 / 448px 448px repeat;
  will-change: transform;
}

.gm-terrain {
  position: absolute;
  width: 120px;
  height: 120px;
  pointer-events: none;
  display: block;
}

.gm-tile {
  position: absolute;
  width: 56px;
  height: 56px;
  display: block;
  text-decoration: none;
}
/* 120x120 village sprite with the tile at (32,40) - only the 56x56 anchor itself is clickable */
.gm-sprite {
  position: absolute;
  left: -32px;
  top: -40px;
  width: 120px;
  height: 120px;
  pointer-events: none;
  display: block;
}
.gm-dot {
  position: absolute;
  z-index: 1;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid #0a1430;
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.gm-overlay-left {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.gm-coords-overlay {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(6,14,32,0.85);
  border: 2px solid #1c3260;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(2,8,22,0.45);
  font-family: Verdana, Arial;
  font-size: 11px;
  color: #dfe8fa;
}
.gm-coords-overlay .qty-input,
.gm-coords-overlay .gm-btn.btn-primary {
  height: 28px;
  box-sizing: border-box;
}
.gm-coords-overlay .qty-input {
  width: 52px;
  padding: 0 8px;
}
.gm-coords-overlay .gm-btn.btn-primary {
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.gm-icon-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gm-icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: rgba(6,14,32,0.85);
  border: 2px solid #1c3260;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(2,8,22,0.45);
  color: #dfe8fa;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.gm-icon-btn:hover { background: rgba(22,40,80,0.95); transform: translateY(-2px); }
.gm-icon-btn:active { transform: translateY(0); }

.gm-minimap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 50;
  border: 2px solid #1c3260;
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(2,8,22,0.45);
  cursor: pointer;
}

#maptile_tooltip {
  display: none;
  position: absolute;
  z-index: 999;
  min-width: 180px;
  max-width: 240px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #eef3fc 0%, #d9e3f5 100%);
  border: 2px solid #1c3260;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(2,8,22,0.4);
  color: #0f1b33;
  font-family: Verdana, Arial;
  font-size: 11px;
  pointer-events: none;
}
/* top-layer variant (popover): reset the UA popover box and use viewport coords */
#maptile_tooltip:popover-open {
  position: fixed;
  inset: auto;
  margin: 0;
  overflow: visible;
  z-index: auto;
}
.gm-tt-title {
  margin-bottom: 6px;
  font-weight: bold;
  color: #1f4fa8;
}
.gm-tt-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.gm-tt-row + .gm-tt-row { margin-top: 2px; }

@media (max-width: 720px) {
  .gm-viewport { height: 420px; }
  .gm-legend-overlay {
    grid-template-columns: 1fr;
    right: 8px;
    bottom: 8px;
    gap: 3px;
    padding: 6px 8px;
    max-width: calc(100% - 16px);
  }
  .gm-legend-item { font-size: 9px; }
  .gm-swatch { width: 8px; height: 8px; }
}
