/* Game Grid Styles */
.game-grid {
  background: linear-gradient(145deg, #ecfdf5, #d1fae5);
  border: 3px solid var(--primary-green);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  position: relative;
  display: inline-block;
  border-spacing: 0;
  border-collapse: separate;
}

.game-grid table {
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
}

.game-grid td {
  width: 130px !important;
  height: 130px !important;
  padding: 0;
  border: none;
  vertical-align: middle;
  text-align: center;
}

.game-grid .animal-emoji {
  font-size: 2rem;
  line-height: 1;
  display: block;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
}

.game-grid::before {
  content: "";
  position: absolute;
  inset: -3px;
  background: linear-gradient(
    45deg,
    var(--primary-green),
    var(--secondary-yellow),
    var(--primary-green)
  );
  border-radius: inherit;
  z-index: -1;
  animation: borderGlow 3s ease-in-out infinite;
}

.grid-cell {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  border: 2px solid #e2e8f0;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  flex-grow: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
}

.grid-cell.grass {
  background: linear-gradient(145deg, #65a30d, #4d7c0f);
  border: 2px solid #365314;
  cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2);
}

.grid-cell.grass::before {
  content: "🌱";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.6;
  animation: grassSway 3s ease-in-out infinite;
}

.grid-cell.grass:hover {
  background: linear-gradient(145deg, #84cc16, #65a30d);
  transform: translateY(-2px) scale(1.02);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 8px 20px rgba(0, 0, 0, 0.25);
}

.grid-cell.grass::after {
  content: attr(data-cost);
  position: absolute;
  bottom: 4px;
  right: 6px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
}

.grid-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.grid-cell:hover::before {
  transform: translateX(100%);
}

.grid-cell:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-green);
}

.grid-cell.occupied {
  background: linear-gradient(145deg, #fef7e3, #fef3c7);
  border-color: var(--secondary-yellow);
}

.grid-cell.occupied:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.15);
}

/* NEW: Butcher value display in bottom-right corner */
.grid-cell-value {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
  line-height: 1;
  z-index: 10;
  pointer-events: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Auto-merge glow effect */
.grid-cell.auto-merge-glow {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06),
    0 8px 20px rgba(0, 0, 0, 0.15), 0 0 20px rgba(139, 92, 246, 0.6),
    0 0 40px rgba(139, 92, 246, 0.4) !important;
  border-color: #8b5cf6 !important;
  border-width: 3px !important;
  background: linear-gradient(145deg, #f3e8ff, #e9d5ff) !important;
  animation: autoMergeGlow 0.5s ease-in-out infinite alternate !important;
}

/* Drag and Drop States */
.drag-preview {
  opacity: 0.7;
  transform: scale(1.1);
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.drag-valid-target {
  background: linear-gradient(145deg, #d1fae5, #a7f3d0) !important;
  border-color: var(--success-green) !important;
  animation: validTargetPulse 1s ease-in-out infinite;
}

.drag-invalid-target {
  background: linear-gradient(145deg, #fee2e2, #fecaca) !important;
  border-color: var(--accent-red) !important;
  animation: invalidTargetShake 0.5s ease-in-out infinite;
}
