/* ==========================================================================
   AUTHENTIC TRAVIAN LEGENDS WORLD MAP STYLING & EARTH BIOMES
   ========================================================================== */

.map-view-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

/* Authentic Travian Map Window Box */
.travian-map-window {
  background: #f4ecd8;
  border: 4px solid #8c6f45;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  overflow: hidden;
  position: relative;
}

/* Map Top Toolbar */
.travian-map-top-bar {
  background: linear-gradient(180deg, #3d2f1f 0%, #20170d 100%);
  border-bottom: 2px solid #8c6f45;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fef08a;
  user-select: none;
}

.map-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-tool-btn {
  background: #2b1f14;
  border: 1px solid #785a28;
  color: #fef08a;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.map-tool-btn:hover {
  background: #4a3520;
  border-color: #fde047;
}

.map-zoom-label {
  font-size: 0.78rem;
  font-weight: bold;
  color: #fef08a;
  background: #19120a;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #4a3822;
}

/* Map Viewport & Drag Canvas */
.map-viewport-frame {
  position: relative;
  background: #7ca836;
  overflow: hidden;
  min-height: 580px;
  display: flex;
  flex-direction: column;
  cursor: grab;
  user-select: none;
  width: 100%;
}

.map-viewport-frame.is-grabbing {
  cursor: grabbing !important;
}

#map-grid {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 520px;
}

.travian-map-frame-inner {
  display: flex;
  flex: 1;
  width: 100%;
  min-height: 520px;
}

/* Coordinate Rulers */
.map-axis-y {
  display: flex;
  flex-direction: column;
  background: #2d2114;
  color: #fef08a;
  border-right: 2px solid #785a28;
  font-size: 0.72rem;
  font-family: monospace;
  font-weight: bold;
  width: 32px;
  min-width: 32px;
  z-index: 10;
}

.axis-cell-y {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.map-axis-x {
  display: flex;
  background: #2d2114;
  color: #fef08a;
  border-top: 2px solid #785a28;
  font-size: 0.72rem;
  font-family: monospace;
  font-weight: bold;
  height: 26px;
  margin-left: 32px;
  z-index: 10;
  width: calc(100% - 32px);
}

.axis-cell-x {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid rgba(255,255,255,0.08);
}

/* Main Matrix */
.map-grid-matrix {
  display: grid;
  background: #8cb94b;
  flex: 1;
  width: calc(100% - 32px);
  height: 100%;
}

/* Earth Grid Cell */
.map-grid-cell {
  width: 100%;
  height: 100%;
  min-height: 52px;
  border-right: 1px solid rgba(0,0,0,0.12);
  border-bottom: 1px solid rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.1s;
  cursor: pointer;
  box-sizing: border-box;
}

.map-grid-cell:hover {
  background: rgba(255,255,255,0.18);
  box-shadow: inset 0 0 12px rgba(255,255,255,0.4);
  z-index: 20;
}

/* Own Village Highlighted with Golden Dashed Border Box */
.cell-own-village-highlight {
  border: 2px dashed #f59e0b !important;
  background: rgba(245, 158, 11, 0.2);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
  z-index: 15;
}

.map-village-graphic {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.map-village-graphic .v-roof {
  font-size: 1.6rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}

.map-village-graphic .v-name-pill {
  font-size: 0.62rem;
  background: rgba(0,0,0,0.65);
  color: #fff;
  padding: 1px 4px;
  border-radius: 4px;
  margin-top: -3px;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.own-village .v-name-pill {
  background: #d97706;
  color: #000;
  font-weight: 900;
  border: 1px solid #fde047;
}

/* Oasis Badges */
.map-oasis-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, #fde047 0%, #ca8a04 100%);
  border: 2px solid #78350f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8), 0 2px 4px rgba(0,0,0,0.6);
  animation: pulseGold 2s infinite;
}

/* Scattered Map Location Badges */
.map-location-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.7);
  transition: transform 0.15s;
}

.map-location-badge:hover {
  transform: scale(1.25);
  z-index: 50;
}

.barbarian-badge {
  background: radial-gradient(circle, #ef4444 0%, #7f1d1d 100%);
  border: 2px solid #f87171;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.ruins-badge {
  background: radial-gradient(circle, #3b82f6 0%, #1e3a8a 100%);
  border: 2px solid #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

.animal-badge {
  background: radial-gradient(circle, #22c55e 0%, #14532d 100%);
  border: 2px solid #4ade80;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

.grove-badge {
  background: radial-gradient(circle, #15803d 0%, #052e16 100%);
  border: 2px solid #86efac;
}

.quarry-badge {
  background: radial-gradient(circle, #ea580c 0%, #7c2d12 100%);
  border: 2px solid #fdba74;
}

.crag-badge {
  background: radial-gradient(circle, #64748b 0%, #1e293b 100%);
  border: 2px solid #cbd5e1;
}

.crop-basin-badge {
  background: radial-gradient(circle, #eab308 0%, #713f12 100%);
  border: 2px solid #fef08a;
}

/* Natural Earth Biome Decorations */
.terrain-lake { font-size: 1.4rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.terrain-forest { font-size: 1.1rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.terrain-mountain { font-size: 1.2rem; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); }
.terrain-tree-single { font-size: 0.95rem; opacity: 0.85; }

/* Coordinate Jump Box (Bottom-Right Overlay) */
.map-jump-overlay-box {
  position: absolute;
  bottom: 36px;
  right: 14px;
  background: rgba(36, 26, 16, 0.95);
  border: 2px solid #8c6f45;
  border-radius: 6px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fef08a;
  font-size: 0.78rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.7);
  z-index: 50;
}

.map-jump-overlay-box input {
  width: 44px;
  background: #100b06;
  border: 1px solid #785a28;
  color: #fff;
  text-align: center;
  font-family: monospace;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 4px;
}

.btn-jump-ok {
  background: linear-gradient(180deg, #65a30d 0%, #3f6212 100%);
  border: 1px solid #4d7c0f;
  color: #fff;
  font-weight: 900;
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
}

/* Tile Detail Popup Card */
.tile-detail-popup {
  position: absolute;
  top: 60px;
  right: 14px;
  width: 280px;
  background: #fdfaf3;
  border: 3px solid #8c6f45;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.8);
  z-index: 100;
  color: #2c1a0e;
  overflow: hidden;
  animation: popIn 0.15s ease-out;
}

.popup-inner-frame {
  position: relative;
  padding: 12px;
}

.popup-close-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #65a30d;
  color: white;
  border: 1px solid #3f6212;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  font-weight: bold;
  cursor: pointer;
}

.tile-popup-header {
  border-bottom: 1px solid #b5a07c;
  padding-bottom: 6px;
  margin-bottom: 8px;
}

.tile-popup-header h4 {
  margin: 0;
  font-size: 0.95rem;
  color: #78350f;
}

.tile-popup-body {
  font-size: 0.8rem;
  line-height: 1.4;
  margin-bottom: 10px;
}

.tile-popup-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tile-popup-actions button {
  width: 100%;
  padding: 6px;
  font-size: 0.82rem;
}

/* ==========================================================================
   REAL-TIME MAP MOVEMENT & ACTIVE ATTACK INDICATORS
   ========================================================================== */

/* Active Attack Pulse on Target Tile */
.cell-under-attack-pulse {
  outline: 3px solid #ef4444 !important;
  outline-offset: -2px;
  animation: attackPulseGlow 1s infinite alternate ease-in-out;
  position: relative;
  z-index: 5;
}

@keyframes attackPulseGlow {
  0% { box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.8), 0 0 15px rgba(239, 68, 68, 0.8); }
  100% { box-shadow: inset 0 0 4px rgba(239, 68, 68, 0.3), 0 0 5px rgba(239, 68, 68, 0.4); }
}

.map-attack-target-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc2626;
  color: #fff;
  font-size: 0.72rem;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid #fecaca;
  font-weight: 900;
  animation: bounceAlert 0.8s infinite;
  box-shadow: 0 2px 6px rgba(0,0,0,0.8);
  z-index: 8;
}

@keyframes bounceAlert {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Marching Army Badge on Current Coordinate */
.map-marching-troop-badge {
  position: absolute;
  bottom: 2px;
  left: 2px;
  background: linear-gradient(180deg, #ca8a04 0%, #854d0e 100%);
  color: #fff;
  border: 1px solid #fef08a;
  border-radius: 4px;
  font-size: 0.68rem;
  padding: 1px 4px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 9;
  animation: marcherWalk 0.6s infinite alternate ease-in-out;
}

@keyframes marcherWalk {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}

.map-marching-troop-badge.hostile {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  border-color: #fca5a5;
}

/* ==========================================================================
   BLUE DOME FORCEFIELD (PEACE SHIELD)
   ========================================================================== */

.cell-shield-protected {
  position: relative;
}

.map-shield-dome {
  position: absolute;
  top: -4px;
  left: 2px;
  right: 2px;
  bottom: 0px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 8;
}

/* Semi-spherical Arched Forcefield Canopy */
.dome-canopy {
  position: absolute;
  top: 4px;
  left: 2px;
  right: 2px;
  bottom: 3px;
  border-radius: 50% 50% 14% 14% / 65% 65% 15% 15%;
  background: radial-gradient(ellipse at 50% 25%, rgba(186, 230, 253, 0.45) 0%, rgba(56, 189, 248, 0.25) 45%, rgba(2, 132, 199, 0.45) 80%, rgba(3, 105, 161, 0.65) 100%);
  border: 1.5px solid rgba(125, 211, 252, 0.95);
  border-bottom: 2.5px solid rgba(56, 189, 248, 1);
  box-shadow: 
    0 0 14px rgba(14, 165, 233, 0.85),
    inset 0 4px 10px rgba(224, 242, 254, 0.7),
    inset 0 -2px 6px rgba(2, 132, 199, 0.6);
  backdrop-filter: blur(0.5px);
  animation: domePulseGlow 2.4s infinite ease-in-out alternate;
}

/* Top Apex Crown Badge */
.dome-apex-spark {
  position: absolute;
  top: -4px;
  background: linear-gradient(180deg, #0284c7 0%, #0369a1 100%);
  border: 1px solid #bae6fd;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 0.62rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 8px #38bdf8;
  z-index: 9;
}

/* Glowing Ground Ring Anchor */
.dome-ground-ring {
  position: absolute;
  bottom: 2px;
  left: 4px;
  right: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.9);
  opacity: 0.8;
}

@keyframes domePulseGlow {
  0% {
    transform: scale(0.97);
    border-color: rgba(125, 211, 252, 0.75);
    box-shadow: 0 0 10px rgba(14, 165, 233, 0.6), inset 0 2px 8px rgba(224, 242, 254, 0.5);
  }
  100% {
    transform: scale(1.02);
    border-color: rgba(224, 242, 254, 1);
    box-shadow: 0 0 18px rgba(56, 189, 248, 0.95), inset 0 5px 14px rgba(224, 242, 254, 0.85);
  }
}

@keyframes shieldIconFloat {
  0% { transform: translateY(0); }
  100% { transform: translateY(-2px); }
}
